Add backup deletion support

This commit is contained in:
mfwadejr
2026-08-29 16:18:58 -04:00
committed by GitHub
parent e65749c658
commit d9f26d52b8
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "vseebox-stockroom",
"version": "1.8.0",
"version": "1.8.1",
"private": true,
"type": "module",
"engines": { "node": ">=22.13.0" },
+2
View File
@@ -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();