Merge branch 'filebrowser:master' into add-username-in-sidebar

pull/2821/head
Jonathan Bout 2024-02-23 21:29:11 +01:00 committed by GitHub
commit 8307232ed5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 75 additions and 45 deletions

View File

@ -13,26 +13,26 @@ jobs:
lint-frontend: lint-frontend:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
- uses: actions/setup-node@v2 - uses: actions/setup-node@v4
with: with:
node-version: '18' node-version: '18'
- run: make lint-frontend - run: make lint-frontend
lint-backend: lint-backend:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
- uses: actions/setup-go@v2 - uses: actions/setup-go@v5
with: with:
go-version: 1.21.0 go-version: 1.21.0
- run: make lint-backend - run: make lint-backend
lint-commits: lint-commits:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- uses: actions/setup-node@v2 - uses: actions/setup-node@v4
with: with:
node-version: '18' node-version: '18'
- run: make lint-commits - run: make lint-commits
@ -46,16 +46,16 @@ jobs:
test-frontend: test-frontend:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
- uses: actions/setup-node@v2 - uses: actions/setup-node@v4
with: with:
node-version: '18' node-version: '18'
- run: make test-frontend - run: make test-frontend
test-backend: test-backend:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
- uses: actions/setup-go@v2 - uses: actions/setup-go@v5
with: with:
go-version: 1.21.0 go-version: 1.21.0
- run: make test-backend - run: make test-backend
@ -71,13 +71,13 @@ jobs:
needs: [lint, test] needs: [lint, test]
if: startsWith(github.event.ref, 'refs/tags/v') if: startsWith(github.event.ref, 'refs/tags/v')
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- uses: actions/setup-go@v2 - uses: actions/setup-go@v5
with: with:
go-version: 1.21.0 go-version: 1.21.0
- uses: actions/setup-node@v2 - uses: actions/setup-node@v4
with: with:
node-version: '18' node-version: '18'
- name: Set up QEMU - name: Set up QEMU

View File

@ -16,6 +16,8 @@
[{[ if .Name -]}][{[ .Name ]}][{[ else ]}]File Browser[{[ end ]}] [{[ if .Name -]}][{[ .Name ]}][{[ else ]}]File Browser[{[ end ]}]
</title> </title>
<meta name="robots" content="noindex,nofollow">
<link <link
rel="icon" rel="icon"
type="image/png" type="image/png"

View File

@ -2,7 +2,7 @@
<div <div
class="shell" class="shell"
:class="{ ['shell--hidden']: !showShell }" :class="{ ['shell--hidden']: !showShell }"
:style="{ height: `${this.shellHeight}em` }" :style="{ height: `${this.shellHeight}em`, direction: 'ltr' }"
> >
<div <div
@pointerdown="startDrag()" @pointerdown="startDrag()"

View File

@ -191,7 +191,12 @@ export default {
action(overwrite, rename); action(overwrite, rename);
}, },
itemClick: function (event) { itemClick: function (event) {
if (!(event.ctrlKey || event.metaKey) && this.singleClick && !this.$store.state.multiple) this.open(); if (
!(event.ctrlKey || event.metaKey) &&
this.singleClick &&
!this.$store.state.multiple
)
this.open();
else this.click(event); else this.click(event);
}, },
click: function (event) { click: function (event) {

View File

@ -12,7 +12,7 @@
<div <div
class="card-action" class="card-action"
style="display: flex; align-items: center; justify-content: space-between;" style="display: flex; align-items: center; justify-content: space-between"
> >
<template v-if="user.perm.create"> <template v-if="user.perm.create">
<button <button
@ -20,7 +20,7 @@
@click="$refs.fileList.createDir()" @click="$refs.fileList.createDir()"
:aria-label="$t('sidebar.newFolder')" :aria-label="$t('sidebar.newFolder')"
:title="$t('sidebar.newFolder')" :title="$t('sidebar.newFolder')"
style="justify-self: left;" style="justify-self: left"
> >
<span>{{ $t("sidebar.newFolder") }}</span> <span>{{ $t("sidebar.newFolder") }}</span>
</button> </button>

View File

@ -133,14 +133,13 @@ export default {
: this.req.items[this.selected[0]].isDir) : this.req.items[this.selected[0]].isDir)
); );
}, },
resolution: function() { resolution: function () {
if (this.selectedCount === 1) { if (this.selectedCount === 1) {
const selectedItem = this.req.items[this.selected[0]]; const selectedItem = this.req.items[this.selected[0]];
if (selectedItem && selectedItem.type === 'image') { if (selectedItem && selectedItem.type === "image") {
return selectedItem.resolution; return selectedItem.resolution;
} }
} } else if (this.req && this.req.type === "image") {
else if (this.req && this.req.type === 'image') {
return this.req.resolution; return this.req.resolution;
} }
return null; return null;

View File

@ -11,7 +11,7 @@
<div <div
class="card-action" class="card-action"
style="display: flex; align-items: center; justify-content: space-between;" style="display: flex; align-items: center; justify-content: space-between"
> >
<template v-if="user.perm.create"> <template v-if="user.perm.create">
<button <button
@ -19,7 +19,7 @@
@click="$refs.fileList.createDir()" @click="$refs.fileList.createDir()"
:aria-label="$t('sidebar.newFolder')" :aria-label="$t('sidebar.newFolder')"
:title="$t('sidebar.newFolder')" :title="$t('sidebar.newFolder')"
style="justify-self: left;" style="justify-self: left"
> >
<span>{{ $t("sidebar.newFolder") }}</span> <span>{{ $t("sidebar.newFolder") }}</span>
</button> </button>

View File

@ -152,7 +152,7 @@ main .spinner .bounce2 {
/* PREVIEWER */ /* PREVIEWER */
#previewer { #previewer {
background-color: rgba(0, 0, 0, 0.9); background-color: rgba(0, 0, 0, 0.99);
padding-top: 4em; padding-top: 4em;
position: fixed; position: fixed;
top: 0; top: 0;

View File

@ -3,10 +3,10 @@
<header-bar v-if="error || req.type == null" showMenu showLogo /> <header-bar v-if="error || req.type == null" showMenu showLogo />
<breadcrumbs base="/files" /> <breadcrumbs base="/files" />
<listing />
<errors v-if="error" :errorCode="error.status" /> <errors v-if="error" :errorCode="error.status" />
<component v-else-if="currentView" :is="currentView"></component> <component v-else-if="currentView" :is="currentView"></component>
<div v-else> <div v-else-if="currentView !== null">
<h2 class="message delayed"> <h2 class="message delayed">
<div class="spinner"> <div class="spinner">
<div class="bounce1"></div> <div class="bounce1"></div>
@ -52,13 +52,10 @@ export default {
computed: { computed: {
...mapState(["req", "reload", "loading"]), ...mapState(["req", "reload", "loading"]),
currentView() { currentView() {
if (this.req.type == undefined) { if (this.req.type == undefined || this.req.isDir) {
return null; return null;
} }
else if (
if (this.req.isDir) {
return "listing";
} else if (
this.req.type === "text" || this.req.type === "text" ||
this.req.type === "textImmutable" this.req.type === "textImmutable"
) { ) {
@ -72,7 +69,26 @@ export default {
this.fetchData(); this.fetchData();
}, },
watch: { watch: {
$route: "fetchData", $route: function (to, from) {
if (from.path.endsWith("/")) {
if (to.path.endsWith("/")) {
window.sessionStorage.setItem('listFrozen', "false");
this.fetchData();
return;
} else {
window.sessionStorage.setItem('listFrozen', "true");
this.fetchData();
return;
}
} else if (to.path.endsWith("/")) {
this.$store.commit("updateRequest", {});
this.fetchData();
return;
} else {
this.fetchData();
return;
}
},
reload: function (value) { reload: function (value) {
if (value === true) { if (value === true) {
this.fetchData(); this.fetchData();
@ -101,7 +117,9 @@ export default {
this.$store.commit("closeHovers"); this.$store.commit("closeHovers");
// Set loading to true and reset the error. // Set loading to true and reset the error.
if (window.sessionStorage.getItem('listFrozen') !=="true"){
this.setLoading(true); this.setLoading(true);
}
this.error = null; this.error = null;
let url = this.$route.path; let url = this.$route.path;

View File

@ -129,6 +129,7 @@ export default {
try { try {
await api.put(this.$route.path, this.editor.getValue()); await api.put(this.$route.path, this.editor.getValue());
this.editor.session.getUndoManager().markClean();
buttons.success(button); buttons.success(button);
} catch (e) { } catch (e) {
buttons.done(button); buttons.done(button);
@ -136,9 +137,7 @@ export default {
} }
}, },
close() { close() {
const originalContent = this.req.content; if (!this.editor.session.getUndoManager().isClean()) {
const currentContent = this.editor.getValue();
if (originalContent !== currentContent) {
this.$store.commit("showHover", "discardEditorChanges"); this.$store.commit("showHover", "discardEditorChanges");
return; return;
} }

View File

@ -383,6 +383,7 @@ export default {
}, },
watch: { watch: {
req: function () { req: function () {
if (window.sessionStorage.getItem('listFrozen') !=="true"){
// Reset the show value // Reset the show value
this.showLimit = 50; this.showLimit = 50;
@ -394,6 +395,10 @@ export default {
// Fill and fit the window with listing items // Fill and fit the window with listing items
this.fillWindow(true); this.fillWindow(true);
}); });
}
if (this.req.isDir) {
window.sessionStorage.setItem('listFrozen', "false");
}
}, },
}, },
mounted: function () { mounted: function () {

View File

@ -1,6 +1,8 @@
<template> <template>
<div <div
id="previewer" id="previewer"
@touchmove.prevent.stop
@wheel.prevent.stop
@mousemove="toggleNavigation" @mousemove="toggleNavigation"
@touchstart="toggleNavigation" @touchstart="toggleNavigation"
> >