From 70ce625487b5e0b7540b70de2ae59f0086134a9e Mon Sep 17 00:00:00 2001 From: dax Date: Wed, 5 Aug 2026 17:15:39 +0100 Subject: admin import panel with upload progress + recent photos; app empty-state links to /admin --- server.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'server.mjs') diff --git a/server.mjs b/server.mjs index ab5e763..9984ecc 100644 --- a/server.mjs +++ b/server.mjs @@ -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") { -- cgit v1.3.1