diff options
| author | dax <me@dax.ist> | 2026-08-05 17:15:39 +0100 |
|---|---|---|
| committer | dax <me@dax.ist> | 2026-08-05 17:15:39 +0100 |
| commit | 70ce625487b5e0b7540b70de2ae59f0086134a9e (patch) | |
| tree | 50db2fba097b2965046e965587bde5143d23785b /server.mjs | |
| parent | 03dcc91c96ac45ff005a1c3e14a71a5733037447 (diff) | |
admin import panel with upload progress + recent photos; app empty-state links to /admin
Diffstat (limited to 'server.mjs')
| -rw-r--r-- | server.mjs | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -646,12 +646,14 @@ const server = http.createServer(async (req, res) => { if (path === "/api/admin/photos") { const q = (url.searchParams.get("q") || "").trim().toLowerCase() const limit = Math.min(100, Number(url.searchParams.get("limit") || 30)) + const recent = url.searchParams.get("recent") === "1" let list = Array.from(state.byId.values()) if (q) { const n = Number(q) list = list.filter((p) => (n && p.id === n) || (p.title || "").toLowerCase().includes(q)) } - list.sort((a, b) => (a.title || "").localeCompare(b.title || "")) + if (recent) list.sort((a, b) => b.id - a.id) + else list.sort((a, b) => (a.title || "").localeCompare(b.title || "")) return json(res, 200, { photos: list.slice(0, limit).map((p) => ({ id: p.id, title: p.title, thumb: p.thumb, date: p.date })) }) } if (path === "/api/admin/graph/reset") { |
