Magnet link handler (#15)

* feat: Magnet link handler registration on the config page
This commit is contained in:
Elias Benbourenane
2025-01-28 15:02:33 -05:00
committed by GitHub
parent d58b327957
commit d9b06fb518
2 changed files with 40 additions and 1 deletions

View File

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