mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-02 10:52:27 +00:00
Merge pull request #1097 from PR0M3TH3AN/fix-sw-cancel-404-17695042221773744950
Fix 404 on Service Worker cancel route
This commit is contained in:
1 file changed
+11
-1
@@ -4260,6 +4260,14 @@ class Application {
|
||||
// Tell webtorrent to cleanup
|
||||
await torrentClient.cleanup();
|
||||
this.log("[cleanup] WebTorrent cleanup resolved.");
|
||||
|
||||
try {
|
||||
if (navigator.serviceWorker && navigator.serviceWorker.controller) {
|
||||
await fetch("/webtorrent/cancel/", { mode: "no-cors" });
|
||||
}
|
||||
} catch (err) {
|
||||
// Ignore errors when cancelling the service worker stream; it may not be active.
|
||||
}
|
||||
} catch (err) {
|
||||
devLogger.error("Cleanup error:", err);
|
||||
} finally {
|
||||
@@ -4895,7 +4903,9 @@ class Application {
|
||||
// user-visible UI is already closed.
|
||||
const performCleanup = async () => {
|
||||
try {
|
||||
await fetch("/webtorrent/cancel/", { mode: "no-cors" });
|
||||
if (navigator.serviceWorker && navigator.serviceWorker.controller) {
|
||||
await fetch("/webtorrent/cancel/", { mode: "no-cors" });
|
||||
}
|
||||
} catch (err) {
|
||||
devLogger.warn("[hideModal] webtorrent cancel fetch failed:", err);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user