From 2d8b1485a06b1e57dca7e2163dcfbabf626de9c2 Mon Sep 17 00:00:00 2001 From: Tomas Date: Fri, 9 Jan 2026 04:01:25 +0100 Subject: [PATCH] Don't redownload urls --- src/index.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/index.ts b/src/index.ts index 6c926ac..b69cf48 100644 --- a/src/index.ts +++ b/src/index.ts @@ -38,6 +38,14 @@ app.get("/download/:filename", (req,res)=>{ parts.shift(); const url = parts.join("?"); + for (const dl of Object.entries(dlmgr.getDownloads())) + if (dl[1].url == url) + return res.status(303).header("Location", "/#"+dl[0]).send(dl[0]); + + for (const dl of Object.entries(dlmgr.getQueue())) + if (dl[1].url == url) + return res.status(303).header("Location", "/#"+dl[0]).send(dl[0]); + const id = dlmgr.download(url, filename); return res.status(303).header("Location", "/#"+id).send(id);