mirror of
https://github.com/CzBiX/qb-web.git
synced 2026-04-15 18:59:57 +08:00
protocolHandler: keep inline with official webui syntax
This commit is contained in:
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user