mirror of
https://github.com/PR0M3TH3AN/bitvid-seeder.git
synced 2026-10-29 17:01:12 +00:00
update
This commit is contained in:
1 parent
48cad129ec
commit
a75c91ee3f
2 files changed
+31
-3
No files matched your search
+12
-3
@@ -374,7 +374,7 @@
|
||||
tr.appendChild(tdStatus);
|
||||
const tdActions = document.createElement("td");
|
||||
|
||||
// Existing Pause/Resume button
|
||||
// Pause/Resume button
|
||||
const toggleBtn = document.createElement("button");
|
||||
toggleBtn.className = "btn btn-warning btn-sm me-2";
|
||||
if (torrent.paused) {
|
||||
@@ -394,7 +394,7 @@
|
||||
}
|
||||
tdActions.appendChild(toggleBtn);
|
||||
|
||||
// Existing Remove button
|
||||
// Remove button
|
||||
const removeBtn = document.createElement("button");
|
||||
removeBtn.textContent = "Remove";
|
||||
removeBtn.className = "btn btn-danger btn-sm me-2";
|
||||
@@ -406,7 +406,7 @@
|
||||
};
|
||||
tdActions.appendChild(removeBtn);
|
||||
|
||||
// New Copy Magnet button
|
||||
// Copy Magnet button
|
||||
const copyMagnetBtn = document.createElement("button");
|
||||
copyMagnetBtn.textContent = "Copy Magnet";
|
||||
copyMagnetBtn.className = "btn btn-secondary btn-sm me-2";
|
||||
@@ -425,6 +425,15 @@
|
||||
};
|
||||
tdActions.appendChild(copyMagnetBtn);
|
||||
|
||||
// New Download button
|
||||
const downloadBtn = document.createElement("button");
|
||||
downloadBtn.textContent = "Download";
|
||||
downloadBtn.className = "btn btn-primary btn-sm";
|
||||
downloadBtn.onclick = () => {
|
||||
window.location.href = `/download/${torrent.infoHash}`;
|
||||
};
|
||||
tdActions.appendChild(downloadBtn);
|
||||
|
||||
tr.appendChild(tdActions);
|
||||
list.appendChild(tr);
|
||||
});
|
||||
|
||||
@@ -262,6 +262,25 @@ app.get("/torrents", (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
// Add after existing routes in server.js
|
||||
app.get("/download/:infoHash", async (req, res) => {
|
||||
const infoHash = req.params.infoHash;
|
||||
const savedData = savedTorrents.find((t) => t.infoHash === infoHash);
|
||||
if (!savedData) {
|
||||
return res.status(404).json({ error: "Torrent not found" });
|
||||
}
|
||||
const filePath = path.join(STORAGE_DIR, savedData.name);
|
||||
if (!(await pathExists(filePath))) {
|
||||
return res.status(404).json({ error: "File not found" });
|
||||
}
|
||||
res.download(filePath, savedData.name, (err) => {
|
||||
if (err) {
|
||||
logger.error("Error downloading file: " + err);
|
||||
res.status(500).json({ error: "Error downloading file" });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Pause a torrent
|
||||
app.post("/pause/:infoHash", async (req, res) => {
|
||||
const infoHash = req.params.infoHash;
|
||||
|
||||
Reference in new issue
Block a user