protocolHandler: keep inline with official webui syntax

This commit is contained in:
R-L-T-Y
2020-06-19 13:33:31 +08:00
committed by CzBiX
parent fcb26eb64e
commit e51fa04ce6

View File

@@ -8,7 +8,7 @@ function registerProtocolHandler() {
}
try {
navigator.registerProtocolHandler('magnet', location.origin + '#url=%s', document.title);
navigator.registerProtocolHandler('magnet', location.origin + '#download=%s', document.title);
} catch (e) {
log('Register protocol handler failed.', e);
}
@@ -20,14 +20,14 @@ function checkDownloadUrl() {
}
const params = new URLSearchParams(location.hash.substring(1));
const url = params.get('url')
const url = params.get('download')
if (!url) {
return null;
}
params.delete('url');
params.delete('download');
location.hash = '#' + params.toString()
return url
}
export { registerProtocolHandler, checkDownloadUrl };
export { registerProtocolHandler, checkDownloadUrl };