fix: Don't immediately download torrents with the magnet link handler (#28)

This commit is contained in:
Elias Benbourenane
2025-01-29 23:02:28 -05:00
committed by GitHub
parent 84b70464da
commit 5d7ddbd208

View File

@@ -90,17 +90,12 @@
} }
}); });
// Read the URL parameters for a magnet link and add it to the download queue if found // Read the URL parameters for a magnet link and add it to the download textarea if found
const urlParams = new URLSearchParams(window.location.search); const urlParams = new URLSearchParams(window.location.search);
const magnetURI = urlParams.get('magnet'); const magnetURI = urlParams.get('magnet');
if (magnetURI) { if (magnetURI) {
document.getElementById('magnetURI').value = magnetURI; document.getElementById('magnetURI').value = magnetURI;
try { history.replaceState({}, document.title, window.location.pathname);
document.getElementById('submitDownload').click();
history.replaceState({}, document.title, window.location.pathname);
} catch (error) {
console.error('Error adding download:', error);
}
} }
}); });
</script> </script>