This commit is contained in:
Graham Steffaniak 2023-08-31 18:28:34 -05:00
parent 4cda1d1c63
commit 736489b577
9 changed files with 41 additions and 145 deletions

View File

@ -8,7 +8,9 @@ All notable changes to this project will be documented in this file. See [standa
- Works with new more advanced filebrowser.json
- improved GUI
- more unified coehisive look
-
- The shell is dead.
- If you need to use the shell, exec into the docker container.
- All configuration is done via filebrowser.yml
# v0.1.4
- various UI fixes

View File

@ -1,10 +0,0 @@
{
"port": 8080,
"baseURL": "",
"address": "",
"log": "stdout",
"database": "./database.db",
"root": "/srv"
}

35
backend/filebrowser.yml Normal file
View File

@ -0,0 +1,35 @@
server:
port: 8080
baseURL: /files
address: ''
log: stdout
database: ./database.db
root: /srv
disable-thumbnails: false
disable-preview-resize: false
disable-exec: false
disable-type-detection-by-header: false
auth:
header: ''
method: ''
command: ''
signup: false
shell: ''
branding:
name: ''
color: ''
files: ''
disableExternal: ''
disableUsedPercentage: ''
permissions:
Admin: false
Execute: true
Create: true
Rename: true
Modify: true
Delete: true
Share: true
Download: true
commands:
shell:
rules:

View File

View File

@ -1,125 +0,0 @@
<template>
<div
@click="focus"
class="shell"
ref="scrollable"
:class="{ ['shell--hidden']: !showShell }"
>
<div v-for="(c, index) in content" :key="index" class="shell__result">
<div class="shell__prompt">
<i class="material-icons">chevron_right</i>
</div>
<pre class="shell__text">{{ c.text }}</pre>
</div>
<div class="shell__result" :class="{ 'shell__result--hidden': !canInput }">
<div class="shell__prompt">
<i class="material-icons">chevron_right</i>
</div>
<pre
tabindex="0"
ref="input"
class="shell__text"
contenteditable="true"
@keydown.prevent.38="historyUp"
@keydown.prevent.40="historyDown"
@keypress.prevent.enter="submit"
/>
</div>
</div>
</template>
<script>
import { mapMutations, mapState, mapGetters } from "vuex";
import { commands } from "@/api";
export default {
name: "shell",
computed: {
...mapState(["user", "showShell"]),
...mapGetters(["isFiles", "isLogged"]),
path: function () {
if (this.isFiles) {
return this.$route.path;
}
return "";
},
},
data: () => ({
content: [],
history: [],
historyPos: 0,
canInput: true,
}),
methods: {
...mapMutations(["toggleShell"]),
scroll: function () {
this.$refs.scrollable.scrollTop = this.$refs.scrollable.scrollHeight;
},
focus: function () {
this.$refs.input.focus();
},
historyUp() {
if (this.historyPos > 0) {
this.$refs.input.innerText = this.history[--this.historyPos];
this.focus();
}
},
historyDown() {
if (this.historyPos >= 0 && this.historyPos < this.history.length - 1) {
this.$refs.input.innerText = this.history[++this.historyPos];
this.focus();
} else {
this.historyPos = this.history.length;
this.$refs.input.innerText = "";
}
},
submit: function (event) {
const cmd = event.target.innerText.trim();
if (cmd === "") {
return;
}
if (cmd === "clear") {
this.content = [];
event.target.innerHTML = "";
return;
}
if (cmd === "exit") {
event.target.innerHTML = "";
this.toggleShell();
return;
}
this.canInput = false;
event.target.innerHTML = "";
let results = {
text: `${cmd}\n\n`,
};
this.history.push(cmd);
this.historyPos = this.history.length;
this.content.push(results);
commands(
this.path,
cmd,
(event) => {
results.text += `${event.data}\n`;
this.scroll();
},
() => {
results.text = results.text.trimEnd();
this.canInput = true;
this.$refs.input.focus();
this.scroll();
}
);
},
},
};
</script>

View File

@ -4,7 +4,6 @@
@import "./_variables.css";
@import "./_buttons.css";
@import "./_inputs.css";
@import "./_shell.css";
@import "./_share.css";
@import "./fonts.css";
@import "./base.css";

View File

@ -10,7 +10,6 @@
<sidebar></sidebar>
<main>
<router-view></router-view>
<shell v-if="isExecEnabled && isLogged && user.perm.execute" />
</main>
<prompts></prompts>
<upload-files></upload-files>
@ -22,12 +21,11 @@ import editorBar from "./files/Editor.vue"
import defaultBar from "./files/Default.vue"
import listingBar from"./files/Listing.vue"
import previewBar from "./files/Preview.vue"
import Action from "@/components/header/Action.vue";
import Prompts from "@/components/prompts/Prompts";
import Action from "@/components/header/Action";
import { mapState, mapGetters } from "vuex";
import Sidebar from "@/components/Sidebar.vue";
import Prompts from "@/components/header/Action.vue";
import Shell from "@/components/Shell.vue";
import UploadFiles from "../components/prompts/UploadFiles.vue";
import UploadFiles from "../components/prompts/UploadFiles";
import { enableExec } from "@/utils/constants";
export default {
@ -40,7 +38,6 @@ export default {
Action,
Sidebar,
Prompts,
Shell,
UploadFiles,
},
data: function () {

View File

@ -128,7 +128,6 @@ export default {
select: this.selectedCount > 0,
upload: this.user.perm.create && this.selectedCount > 0,
download: this.user.perm.download && this.selectedCount > 0,
shell: this.user.perm.execute && enableExec,
delete: this.selectedCount > 0 && this.user.perm.delete,
rename: this.selectedCount === 1 && this.user.perm.rename,
share: this.selectedCount === 1 && this.user.perm.share,

View File

@ -301,7 +301,6 @@ export default {
select: this.selectedCount > 0,
upload: this.user.perm.create && this.selectedCount > 0,
download: this.user.perm.download && this.selectedCount > 0,
shell: this.user.perm.execute && enableExec,
delete: this.selectedCount > 0 && this.user.perm.delete,
rename: this.selectedCount === 1 && this.user.perm.rename,
share: this.selectedCount === 1 && this.user.perm.share,