From d9f26d52b808e950d8b993dfc1e3e8c8b8f826ab Mon Sep 17 00:00:00 2001 From: mfwadejr <125498560+mfwadejr@users.noreply.github.com> Date: Sat, 29 Aug 2026 16:18:58 -0400 Subject: [PATCH] Add backup deletion support --- package.json | 2 +- server.mjs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 25ea476..0cff909 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vseebox-stockroom", - "version": "1.8.0", + "version": "1.8.1", "private": true, "type": "module", "engines": { "node": ">=22.13.0" }, diff --git a/server.mjs b/server.mjs index b136cc3..7c0db77 100644 --- a/server.mjs +++ b/server.mjs @@ -111,6 +111,8 @@ async function api(req, res, url) { if(action==="download"&&req.method==="GET"){const content=await readFile(path);res.writeHead(200,{"content-type":"application/vnd.sqlite3","content-disposition":`attachment; filename="${name}"`,"content-length":content.length});return res.end(content);} if(action==="restore"&&req.method==="POST")return await restoreFrom(path,res); } + const deleteBackupMatch=url.pathname.match(/^\/api\/admin\/backups\/([^/]+)$/); + if(deleteBackupMatch&&req.method==="DELETE"){const path=safeBackup(decodeURIComponent(deleteBackupMatch[1]));await unlink(path);res.writeHead(204);return res.end();} if (url.pathname === "/api/products" && req.method === "GET") return json(res, 200, list.all()); if (url.pathname === "/api/products" && req.method === "POST") { const p = productInput(await body(req)); const id = crypto.randomUUID();