-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to register AriaNg as a magnet protocol handler? #551
Comments
I'm afraid AriaNg cannot do this, but I think there are some browser addons can do this job. This page (http://ariang.mayswind.net/3rd-extensions.html) lists some browser addons. |
I'm afraid AriaNg cannot do this...
On the other hand I am almost sure it could, but sadly there seems to be no interest in implementing this feature in any of Aria web UIs.
It is nice that there is a Firefox addon, but I am not looking to fully replace Firefox download manager with AriaNg, just to register AriaNg as a magnet protocol handler.
|
Although the web UI doesn't implement this, if the native app registers as a magnet protocol handler (association) system-wide then technically Firefox should pick this up and present you with the dialog just like with QBitTorrent (which is just another "native app" in Firefox's perspective). |
@VaslD If I am not mistaken, that would require using native app? I have AriaNg Web UI served from an Owin-based Windows Service (which I wrote myself in C#, and which also brings up and down |
@mayswind I have managed to register AriaNg as protocol handler: However, the current implementation requires URL to be base64 encoded. When clicking on the magnet link I am getting the following error: This is expected because browser always passes the plain URL and that cannot be changed without extension or say TamperMonkey userscript. Could you please implement an API version that accepts unencoded URL, and encodes it before passing to Aria RPC server? For example: Then it would be possible to handle magnet links directly from AriaNg. The only other thing you would need is a button which says Register AriaNg as magnet link handler and which executes the following javascript:
Which would look like this (Firefox Options) after registration: |
For anyone interested, I have managed to find a way to register a protocol handler in Firefox using brute force, bypassing all sanity checks. Spoiler
var handler = Cc["@mozilla.org/uriloader/web-handler-app;1"].createInstance(Ci.nsIWebHandlerApp);
handler.name = "<AriaNg>";
handler.uriTemplate = "javascript:(function(){window.location.href='<URL>/#!/new/task?url='+btoa('%s').replace('+', '-').replace('/', '_')})()";
var handlerInfo = Cc["@mozilla.org/uriloader/external-protocol-service;1"].getService(Ci.nsIExternalProtocolService).getProtocolHandlerInfo("magnet");
handlerInfo.possibleApplicationHandlers.appendElement(handler);
handlerInfo.alwaysAskBeforeHandling = true;
Cc["@mozilla.org/uriloader/handler-service;1"].getService(Ci.nsIHandlerService).store(handlerInfo); However, internal API might change at any time, and I am not liable to any damage this snippet may cause. Referencesmozilla/gecko-dev@1f1b24c/browser/components/protocolhandler/WebProtocolHandlerRegistrar.jsm Still, implementing unsafe URLs or just using an extension/bookmarklet would be the proper way. |
Interesting approach. Is there a way to do similar thing in Chrome perhaps?
I'd prefer if AriaNg exposed an API for this purpose which is compliant with normal ways browsers handle this. In the meantime I am using Chrome extension |
qBitTorrent web UI has an option to register as a protocol handler for magnet links.
After it is registered, clicking on a magnet link in your browser automatically opens Add URL dialog.
Does AriaNg support that?
If not, is there any chance it could be added?
This is what I have in mind (screenshot is from Firefox):
Please check here for implementation details:
https://developer.mozilla.org/en-US/docs/Web/API/Navigator/registerProtocolHandler/Web-based_protocol_handlers#Registering
The only obstacle I see is the way adding a new download is implemented at the moment. You should have a GET-able URL which receives link as a parameter. For example:
Where
%s
is a magnet link placeholder.The text was updated successfully, but these errors were encountered: