ziahamza/webui-aria2

How to register webui-aria2 as a magnet protocol handler?

Closed this issue · 4 comments

qBitTorrent webui 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 webui-aria2 support that?

If not, any chance it could be added?

EDIT: This is what I have in mind

image

No, not possible.
It would be a disaster for any web page decide to be system-wise or browser-wise schema handler.
For browser-wise, I think it can be done either with a user script or with a add-on, by catching click event of magnet-ish URLs and prevent direct opening but send message to aria 2 instance after confirm.

It would be a disaster for any web page decide to be system-wise or browser-wise schema handler.

All browsers already support this, otherwise no web applications would be possible.

Furthermore, it requires user consent. You advertise yourself as protocol handler and user gets a prompt which they can refuse.

Please check here for details:
https://developer.mozilla.org/en-US/docs/Web/API/Navigator/registerProtocolHandler/Web-based_protocol_handlers#Registering

I hope you will reconsider once you get familiar with it.

EDIT:

To clarify a bit -- %s placeholder in the URL which is registered using the method described above will be the contents of href attribute of the link the user clicked (i.e. a magnet link), so you would need to have a simple HTTP GET URI which would accept only a magnet link as a parameter and somehow translate that to your existing Add URIs popup and addUri() RPC call.

The main problem I see is that RPC params are base64-encoded so it does not seem possible to map this directly, and the idea of separate URI for adding magnet links doesn't go well with your single page MVC style webui. Sadly, I am not a front-end developer myself so I am lost as to how I would go about implementing this.

That makes sense, but I am not currently interested. Hope some one can see to it.
But there is much less angular developer than React or Vue. It is possible that no one will work on it.
If you want do it yourself, you can refer to #417 for how to parse URI, src/js/app.js might be where you put register, src/js/ctrls/nav.js#L61 should be helpful for showing the download modal. CONTRIBUTING.md shows how to build with npm.

Thanks for considering, and for the explanation. Hopefully someone better equipped for frontend stuff coding will pick it up. It is really not my area of expertise.