question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to register AriaNg as a magnet protocol handler?

See original GitHub issue

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):

image

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:

https://core.levicki.lan:8001/#!/new?link=%s

Where %s is a magnet link placeholder.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
retardToniccommented, Feb 23, 2021

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
  1. Open Browser console (Ctrl+Shift+J)
  2. Type in the following (replace <URL> with URL and <AriaNg> with preferred handler name):
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. AriaNg still needs to be hosted on a server, as the browser prohibits accessing local files from DOM in any way.

References

mozilla/gecko-dev@1f1b24c/browser/components/protocolhandler/WebProtocolHandlerRegistrar.jsm

Still, implementing unsafe URLs or just using an extension/bookmarklet would be the proper way.

0reactions
levickicommented, Feb 23, 2021

For anyone interested, I have managed to find a way to register a protocol handler in Firefox using brute force, bypassing all sanity checks.

Interesting approach. Is there a way to do similar thing in Chrome perhaps?

Still, implementing unsafe URLs or just using an extension/bookmarklet would be the proper way.

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 edcakfpjaobkpdfpicldlccdffkhpbfk.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Installing and Registering Protocol Handlers (Windows Search)
Installing protocol handlers involves copying the DLL(s) to an appropriate location in the Program Files directory, and then registering the DLL ...
Read more >
Aria2 for Chrome
Aria2 is a lightweight multi-protocol & multi-source command-line ... the UI launch logic of magnet handler page V1.5.4 + Update AriaNG to ...
Read more >
Add support for Protocol Handler - Vivaldi Forum
But registering qBt the application (not WebUI) to handle magnet links should work even for a portable install. Try going to Tools >...
Read more >
qKy - River Thames Conditions - Environment Agency - GOV.UK
Dj ashba finger tattoos, Tv online arirang channel, Nike factory store las ... Ikaw na ang bahala mp3, Mmpa permanent magnet guidelines, Fall...
Read more >
How to Open a Magnet Link in Any Browser - Make Tech Easier
Many torrent file download sites prominently display a “magnet download” menu option which will activate the magnet links.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found