Fix magnet playback handling and update agent guidance

This commit is contained in:
thePR0M3TH3AN committed 2025-09-24 13:07:14 -04:00
1 parent 2442be4e77
commit 7742e3968c
3 files changed
+138 -59

No files matched your search

+13 -8
View File
@@ -2042,16 +2042,21 @@ class bitvidApp {
);
}
let cacheBustedMagnet = trimmedCandidate;
try {
const parsed = new URL(trimmedCandidate);
parsed.searchParams.set("ts", Date.now().toString());
cacheBustedMagnet = parsed.toString();
} catch (err) {
const separator = trimmedCandidate.includes("?") ? "&" : "?";
cacheBustedMagnet = `${trimmedCandidate}${separator}ts=${Date.now()}`;
const timestamp = Date.now().toString();
const [magnetPrefix, magnetQuery = ""] = trimmedCandidate.split("?", 2);
let normalizedMagnet = magnetPrefix;
let queryParts = magnetQuery
.split("&")
.map((part) => part.trim())
.filter((part) => part && !/^ts=\d+$/.test(part));
if (queryParts.length) {
normalizedMagnet = `${magnetPrefix}?${queryParts.join("&")}`;
}
const separator = normalizedMagnet.includes("?") ? "&" : "?";
const cacheBustedMagnet = `${normalizedMagnet}${separator}ts=${timestamp}`;
await torrentClient.cleanup();
this.resetTorrentStats();