From ef8f822736997bbd76e443150cbf77816fa184fa Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Sun, 7 Apr 2024 12:39:20 -0400 Subject: [PATCH] minor gallery fix --- TODO.md | 2 ++ javascript/gallery.js | 2 +- modules/api/gallery.py | 5 ++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/TODO.md b/TODO.md index a7bb1b0d4..db4fbea02 100644 --- a/TODO.md +++ b/TODO.md @@ -7,6 +7,8 @@ Main ToDo list can be found at [GitHub projects](https://github.com/users/vladma ### Logistics - defork +- test upgrades due to submodule changes +- integrate uiux ### Models diff --git a/javascript/gallery.js b/javascript/gallery.js index e8f1b5310..e53345b76 100644 --- a/javascript/gallery.js +++ b/javascript/gallery.js @@ -146,7 +146,6 @@ class GalleryFile extends HTMLElement { const img = document.createElement('img'); img.className = 'gallery-file'; img.loading = 'lazy'; - img.title = `Folder: ${this.folder}\nFile: ${this.name}\nSize: ${this.size.toLocaleString()} bytes\nModified: ${this.mtime.toLocaleString()}`; img.onload = async () => { img.title += `\nResolution: ${this.width} x ${this.height}`; this.title = img.title; @@ -201,6 +200,7 @@ class GalleryFile extends HTMLElement { currentImage = this.src; el.btnSend.click(); }; + img.title = `Folder: ${this.folder}\nFile: ${this.name}\nSize: ${this.size.toLocaleString()} bytes\nModified: ${this.mtime.toLocaleString()}`; this.title = img.title; this.style.display = this.title.toLowerCase().includes(el.search.value.toLowerCase()) ? 'unset' : 'none'; this.shadow.appendChild(img); diff --git a/modules/api/gallery.py b/modules/api/gallery.py index 49119473d..5e51a9c94 100644 --- a/modules/api/gallery.py +++ b/modules/api/gallery.py @@ -162,7 +162,10 @@ def register_api(app: FastAPI): # register api folder = unquote(folder).replace('%3A', ':') t0 = time.time() numFiles = 0 - for f in files_cache.directory_files(folder, recursive=True): + files = files_cache.directory_files(folder, recursive=True) + # files = list(files_cache.directory_files(folder, recursive=True)) + # files.sort(key=os.path.getmtime) + for f in files: numFiles += 1 file = os.path.relpath(f, folder) msg = quote(folder) + '##F##' + quote(file)