@@ -52,13 +52,10 @@ export default {
computed: {
...mapState(["req", "reload", "loading"]),
currentView() {
- if (this.req.type == undefined) {
+ if (this.req.type == undefined || this.req.isDir) {
return null;
}
-
- if (this.req.isDir) {
- return "listing";
- } else if (
+ else if (
this.req.type === "text" ||
this.req.type === "textImmutable"
) {
@@ -72,7 +69,26 @@ export default {
this.fetchData();
},
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) {
if (value === true) {
this.fetchData();
@@ -101,7 +117,9 @@ export default {
this.$store.commit("closeHovers");
// Set loading to true and reset the error.
- this.setLoading(true);
+ if (window.sessionStorage.getItem('listFrozen') !=="true"){
+ this.setLoading(true);
+ }
this.error = null;
let url = this.$route.path;
diff --git a/frontend/src/views/files/Listing.vue b/frontend/src/views/files/Listing.vue
index c204de45..692593b6 100644
--- a/frontend/src/views/files/Listing.vue
+++ b/frontend/src/views/files/Listing.vue
@@ -383,17 +383,22 @@ export default {
},
watch: {
req: function () {
- // Reset the show value
- this.showLimit = 50;
+ if (window.sessionStorage.getItem('listFrozen') !=="true"){
+ // Reset the show value
+ this.showLimit = 50;
- // Ensures that the listing is displayed
- Vue.nextTick(() => {
- // How much every listing item affects the window height
- this.setItemWeight();
+ // Ensures that the listing is displayed
+ Vue.nextTick(() => {
+ // How much every listing item affects the window height
+ this.setItemWeight();
- // Fill and fit the window with listing items
- this.fillWindow(true);
- });
+ // Fill and fit the window with listing items
+ this.fillWindow(true);
+ });
+ }
+ if (this.req.isDir) {
+ window.sessionStorage.setItem('listFrozen', "false");
+ }
},
},
mounted: function () {
diff --git a/frontend/src/views/files/Preview.vue b/frontend/src/views/files/Preview.vue
index 6422ac5a..aa85e2eb 100644
--- a/frontend/src/views/files/Preview.vue
+++ b/frontend/src/views/files/Preview.vue
@@ -1,6 +1,8 @@
From cdf8def3304315bef261da7f52f8599d90b1f0f0 Mon Sep 17 00:00:00 2001
From: niubility000 <76441520+niubility000@users.noreply.github.com>
Date: Thu, 7 Mar 2024 18:14:40 +0800
Subject: [PATCH 2/4] fix: stay in the same position after renaming or deleting
(#3039)
---
frontend/src/components/prompts/Delete.vue | 1 +
frontend/src/components/prompts/Rename.vue | 1 +
frontend/src/views/Files.vue | 9 ++++-----
frontend/src/views/files/Editor.vue | 6 +++++-
frontend/src/views/files/Listing.vue | 5 +++--
5 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/frontend/src/components/prompts/Delete.vue b/frontend/src/components/prompts/Delete.vue
index f65e69b7..2527c855 100644
--- a/frontend/src/components/prompts/Delete.vue
+++ b/frontend/src/components/prompts/Delete.vue
@@ -45,6 +45,7 @@ export default {
submit: async function () {
buttons.loading("delete");
+ window.sessionStorage.setItem("modified", "true");
try {
if (!this.isListing) {
await api.remove(this.$route.path);
diff --git a/frontend/src/components/prompts/Rename.vue b/frontend/src/components/prompts/Rename.vue
index b6fb38ed..f3a96c2e 100644
--- a/frontend/src/components/prompts/Rename.vue
+++ b/frontend/src/components/prompts/Rename.vue
@@ -88,6 +88,7 @@ export default {
newLink =
url.removeLastDir(oldLink) + "/" + encodeURIComponent(this.name);
+ window.sessionStorage.setItem("modified", "true");
try {
await api.move([{ from: oldLink, to: newLink }]);
if (!this.isListing) {
diff --git a/frontend/src/views/Files.vue b/frontend/src/views/Files.vue
index 2d67fdd7..29a7afd9 100644
--- a/frontend/src/views/Files.vue
+++ b/frontend/src/views/Files.vue
@@ -54,8 +54,7 @@ export default {
currentView() {
if (this.req.type == undefined || this.req.isDir) {
return null;
- }
- else if (
+ } else if (
this.req.type === "text" ||
this.req.type === "textImmutable"
) {
@@ -72,11 +71,11 @@ export default {
$route: function (to, from) {
if (from.path.endsWith("/")) {
if (to.path.endsWith("/")) {
- window.sessionStorage.setItem('listFrozen', "false");
+ window.sessionStorage.setItem("listFrozen", "false");
this.fetchData();
return;
} else {
- window.sessionStorage.setItem('listFrozen', "true");
+ window.sessionStorage.setItem("listFrozen", "true");
this.fetchData();
return;
}
@@ -117,7 +116,7 @@ export default {
this.$store.commit("closeHovers");
// Set loading to true and reset the error.
- if (window.sessionStorage.getItem('listFrozen') !=="true"){
+ if (window.sessionStorage.getItem("listFrozen") !=="true" && window.sessionStorage.getItem("modified") !=="true"){
this.setLoading(true);
}
this.error = null;
diff --git a/frontend/src/views/files/Editor.vue b/frontend/src/views/files/Editor.vue
index bf0d47e2..f4871615 100644
--- a/frontend/src/views/files/Editor.vue
+++ b/frontend/src/views/files/Editor.vue
@@ -1,5 +1,9 @@
-
+
{{ req.name }}
diff --git a/frontend/src/views/files/Listing.vue b/frontend/src/views/files/Listing.vue
index 692593b6..aad09333 100644
--- a/frontend/src/views/files/Listing.vue
+++ b/frontend/src/views/files/Listing.vue
@@ -383,7 +383,7 @@ export default {
},
watch: {
req: function () {
- if (window.sessionStorage.getItem('listFrozen') !=="true"){
+ if (window.sessionStorage.getItem("listFrozen") !=="true" && window.sessionStorage.getItem("modified") !=="true"){
// Reset the show value
this.showLimit = 50;
@@ -397,7 +397,8 @@ export default {
});
}
if (this.req.isDir) {
- window.sessionStorage.setItem('listFrozen', "false");
+ window.sessionStorage.setItem("listFrozen", "false");
+ window.sessionStorage.setItem("modified", "false");
}
},
},
From 8dddc8a4507f5a4abff03fa9f12a60be898c693a Mon Sep 17 00:00:00 2001
From: niubility000 <76441520+niubility000@users.noreply.github.com>
Date: Thu, 7 Mar 2024 18:16:41 +0800
Subject: [PATCH 3/4] chore: show the current used filebrowser.db in cmd window
(#3028)
---
cmd/utils.go | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/cmd/utils.go b/cmd/utils.go
index 2bd9e760..d4ccbacc 100644
--- a/cmd/utils.go
+++ b/cmd/utils.go
@@ -87,16 +87,23 @@ func python(fn pythonFunc, cfg pythonConfig) cobraFunc {
data := pythonData{hadDB: true}
path := getParam(cmd.Flags(), "database")
+ absPath, err := filepath.Abs(path)
+ if err != nil {
+ panic(err)
+ }
exists, err := dbExists(path)
if err != nil {
panic(err)
} else if exists && cfg.noDB {
- log.Fatal(path + " already exists")
+ log.Fatal(absPath + " already exists")
} else if !exists && !cfg.noDB && !cfg.allowNoDB {
- log.Fatal(path + " does not exist. Please run 'filebrowser config init' first.")
+ log.Fatal(absPath + " does not exist. Please run 'filebrowser config init' first.")
+ } else if !exists && !cfg.noDB {
+ log.Println("Warning: filebrowser.db can't be found. Initialing in " + strings.TrimSuffix(absPath, "filebrowser.db"))
}
+ log.Println("Using database: " + absPath)
data.hadDB = exists
db, err := storm.Open(path)
checkErr(err)
From d70650689c34ce9f631fda6a453fd521faef22fa Mon Sep 17 00:00:00 2001
From: niubility000 <76441520+niubility000@users.noreply.github.com>
Date: Thu, 7 Mar 2024 18:25:01 +0800
Subject: [PATCH 4/4] feat: auto hiding header bar in preview to enlarge the
preview window (#3024)
---
frontend/src/css/mobile.css | 4 ----
frontend/src/css/styles.css | 21 ++++++++++++++++++---
frontend/src/views/files/Preview.vue | 2 +-
3 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/frontend/src/css/mobile.css b/frontend/src/css/mobile.css
index 3779d6e7..8047a5b6 100644
--- a/frontend/src/css/mobile.css
+++ b/frontend/src/css/mobile.css
@@ -2,10 +2,6 @@
nav {
width: 10em
}
- /* Mobile Only fix div hidden by bottom navigation bar of mobile browser when using height: 100vh */
- #previewer .preview {
- height: calc(100% - 4em) !important;
- }
}
@media (max-width: 1024px) {
diff --git a/frontend/src/css/styles.css b/frontend/src/css/styles.css
index f38f6b63..bac14c6d 100644
--- a/frontend/src/css/styles.css
+++ b/frontend/src/css/styles.css
@@ -153,7 +153,6 @@ main .spinner .bounce2 {
#previewer {
background-color: rgba(0, 0, 0, 0.99);
- padding-top: 4em;
position: fixed;
top: 0;
left: 0;
@@ -166,15 +165,25 @@ main .spinner .bounce2 {
#previewer header {
background: none;
color: #fff;
+ border-bottom: 0px;
+ box-shadow: 0px 0px 0px;
+ z-index: 19999;
}
#previewer header > .action i {
color: #fff;
+ text-shadow: 1px 1px 1px #000000;
+}
+
+#previewer header > title {
+ white-space: nowrap;
+ text-shadow: 1px 1px 1px #000000;
}
@media (min-width: 738px) {
#previewer header #dropdown .action i {
color: #fff;
+ text-shadow: 1px 1px 1px #000000;
}
}
@@ -188,7 +197,7 @@ main .spinner .bounce2 {
#previewer .preview {
text-align: center;
- height: calc(100vh - 4em);
+ height: 100%;
}
#previewer .preview pre {
@@ -203,6 +212,12 @@ main .spinner .bounce2 {
margin: 0;
}
+#previewer .preview audio {
+ width: 95%;
+ height: 88%;
+}
+
+
#previewer .preview video {
height: 100%;
}
@@ -247,7 +262,7 @@ main .spinner .bounce2 {
#previewer > button {
margin: 0;
position: fixed;
- top: calc(50% + 1.85em);
+ top: 50%;
transform: translateY(-50%);
background-color: rgba(80, 80, 80, 0.5);
color: white;
diff --git a/frontend/src/views/files/Preview.vue b/frontend/src/views/files/Preview.vue
index aa85e2eb..c6b0dbe0 100644
--- a/frontend/src/views/files/Preview.vue
+++ b/frontend/src/views/files/Preview.vue
@@ -6,7 +6,7 @@
@mousemove="toggleNavigation"
@touchstart="toggleNavigation"
>
-
+
{{ name }}