Skip to content
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

Improve torrent handler registration #773

Closed
feross opened this issue Aug 11, 2016 · 10 comments
Closed

Improve torrent handler registration #773

feross opened this issue Aug 11, 2016 · 10 comments

Comments

@feross
Copy link
Member

feross commented Aug 11, 2016

On macOS, the .torrent association is automatic (defined in Info.plist). So if there's no other handler, WebTorrent will be default. If there's another default, then the user can still use "Open With..." to select WebTorrent.

On Windows / Linux, the current situation (after PR #771) is that WebTorrent does nothing until the preference is toggled. This is not ideal.

Now the .desktop file will not get installed on Linux systems. But that file is needed for the app icon to show up correctly in the Unity launcher, and to support pinning etc. And there's no way to do "Open With..." on Windows, until the user toggles the preference option.

I think we need to change handlers.js to distinguish between installing handlers and making WebTorrent the default.

  • install: associate with .torrent (but not as the default program), i.e. install .desktop file (linux), add to registry (windows)
  • makeDefault: become default .torrent handler, register magnet handler (there can only be one)
  • removeDefault: give up .torrent handler, unregister magnet handler
  • uninstall: only used by the Windows program uninstaller to completely clean up registry entries, never called on Mac or Linux

@dcposch @mathiasvr Does that seem reasonable to you?

@mathiasvr
Copy link
Contributor

Looks good, but is the removeDefault necessary? I'm used to just overriding the default extension handler from the OS or another program.
I don't feel WebTorrent should handle setting the default .torrent handler but i guess it's okay. I would still separate this from magnet handlers, what if a user wants to have WebTorrent be the default magnet (or stream-magnet) handler but use another program for .torrent files?

@feross
Copy link
Member Author

feross commented Aug 11, 2016

@mathiasvr is the removeDefault necessary? I'm used to just overriding the default extension handler from the OS or another program.

removeDefault isn't strictly necessary, but we want the setting to be a toggle with on/off instead of a button that you press with no change in the UI. I think that is clearer.

I don't feel WebTorrent should handle setting the default .torrent handler but i guess it's okay

Interesting point. On macOS and Linux, we don't currently have code to make WebTorrent the default .torrent file handler. On Windows, we do. What do other apps do? I think uTorrent asks if you want to make it the default handler for torrent files and magnet links on startup.

what if a user wants to have WebTorrent be the default magnet (or stream-magnet) handler but use another program for .torrent files?

@dcposch and I discussed and decided to keep things simple. I can't see a situation where the user wants to handle magnet links in uTorrent by .torrent files in WebTorrent, for example. But, with stream-magnet links, I can actually see people wanting to make WebTorrent default for that, but use a traditional torrent client for the rest. Still, it's kind of an edge case.

I think it would be acceptable to have these options in Preferences:

  • Open torrent files in WebTorrent
  • Open magnet links in WebTorrent
  • Open stream-magnet links in WebTorrent

Later, we can have an "Advanced..." section in Preferences that is collapsed by default, like the Chrome preferences has, so this complexity won't be exposed to most users.

@mathiasvr
Copy link
Contributor

@feross removeDefault isn't strictly necessary, but we want the setting to be a toggle with on/off instead of a button that you press with no change in the UI. I think that is clearer.

I like that, but can we detect if the default has been changed by another program?

@feross On Windows, we do. What do other apps do? I think uTorrent asks if you want to make it the default handler for torrent files and magnet links on startup.

With Windows I am also used to programs associating with file extensions and not becoming the default. There are several ways to set the default, I usually right click a file. I guess making this an option at startup or toggle in preferences is convenient for some users, but I really don't think it's necessary. If WebTorrent is the only program associated with the .torrent extension it becomes the default handler anyway.

@feross
Copy link
Member Author

feross commented Aug 11, 2016

@mathiasvr I like that, but can we detect if the default has been changed by another program?

Yes, the uninstall() code for Windows in handlers.js already handles this case. If the default program is not WebTorrent, then that registry entry is not touched.

With Windows I am also used to programs associating with file extensions and not becoming the default. There are several ways to set the default, I usually right click a file.

We don't have a way to become the default on Mac/Linux right now, so I'm starting to agree with you. Either we support this on all platforms, or we should remove it. It would be misleading to have a "Open torrent files in WebTorrent" option that doesn't work on Mac/Linux.

I guess making this an option at startup or toggle in preferences is convenient for some users, but I really don't think it's necessary.

I think showing a dialog on first startup asking "Use WebTorrent as your default torrent client?" is a reasonable way to help users switching from other clients.

If WebTorrent is the only program associated with the .torrent extension it becomes the default handler anyway.

That's the good news in all of this. The most inexperienced users are the ones who are likely to have no torrent clients installed already and they'll be in good shape with WebTorrent as the default torrent handler.

But for magnet links, they're still out of luck unless we have a "Use WebTorrent as your default torrent client?" prompt. How do we help them?

@grunjol
Copy link
Contributor

grunjol commented Aug 11, 2016

In Linux case, the .desktop only registers the association between the application and the protocol(scheme) or mime-type but never force it to be default.

As @mathiasvr said, in the torrent case, you can select other alternatives and make it default

image

To force to default in linux you need to edit $HOME/.config/mimeapps.list as specified in XDG -Association between MIME types and applications

@mathiasvr
Copy link
Contributor

@feross But for magnet links, they're still out of luck unless we have a "Use WebTorrent as your default torrent client?" prompt. How do we help them?

You are right, a dialog on first startup is probably a good way to handle this.

@feross
Copy link
Member Author

feross commented Aug 11, 2016

@grunjol Thanks for clarifying. So that means that if we just find a way to do this on macOS, we can have a "Use WebTorrent as your default torrent client?" option on first startup for all platforms, if we want to.

@grunjol
Copy link
Contributor

grunjol commented Aug 11, 2016

I am not macOS users but it seems this link can help

@stale
Copy link

stale bot commented May 10, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale label May 10, 2018
@stale stale bot removed the stale label May 11, 2018
@github-actions
Copy link

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

@github-actions github-actions bot added the stale label Oct 25, 2022
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants