-
Notifications
You must be signed in to change notification settings - Fork 64
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
Rework protocol registration #1691
Conversation
src/Networking/NexusMods.Networking.NexusWebApi/HandlerRegistration.cs
Outdated
Show resolved
Hide resolved
src/NexusMods.CrossPlatform/ProtocolRegistration/IProtocolRegistration.cs
Show resolved
Hide resolved
src/NexusMods.CrossPlatform/ProtocolRegistration/ProtocolRegistrationWindows.cs
Show resolved
Hide resolved
Notes on crappy Windows stuff: Both Vortex and MO2 follow the documentation on Registering an Application to a URI Scheme. This is done by updating the registry. Using
Under this sub-key you set two values:
Followed by creating a sub-key at Vortex uses Electron's build-in function for this, while MO2 uses a custom function that does the same thing. Since Vortex and MO2 write to the same keys, they are overwriting each other. These show the registry after Vortex ran, it updates these values on startup: This has so far been on the OS level. If you open the Windows "Run" tool and try to run Browser abstract file associations one step further. Depending on the browser, you have something like this in your settings: If you then open a new tab and go to All of this works fine if there is only every one application that makes use of this protocol. However, as well know, many mod managers exists and want to register themselves as a handler for Vortex, MO2, and other tools use the same method, which is setting registry keys at For the longest time, Windows had support for selecting a "Default Program". Before Windows 10, this was done using the Control Panel, with Windows 10 and Windows 11 you have a new settings page called "Default Apps": This is the preferred way of setting default applications for both file and link types: This is described in the Default Programs documentation. Vortex and MO2 don't show up here because they haven't registered themselves as an application to Windows. They used the very ancient method of registering a link handler. Following the documentation and recommendations by Microsoft, we can add the Nexus Mods App to the "Default Apps" settings page on Windows: Doing the same things as before, "Run" and the Browser both recognize the App as a handler for However, registration differs from what Vortex and MO2 do. Instead of using the generic ProgID However, opening the "Default Apps" page on Windows after Vortex has updated the registry will get Windows confused: Because Vortex doesn't register itself as an application, the page says "NexusMods.App" but the Selecting "NexusMods.App" here will result in Vortex still being selected and appearing broken in the page. However, this is only appearances. If you run The same happens in the browser, it will only show "NexusMods.App" and use that. Since Vortex isn't a registered application, it won't show up anywhere. Not only that, Vortex and MO2 will never be able to register themselves as the default handler anymore. Windows and Browsers will look for registered applications, if they can't find a registered application, they will default to the generic ProgID handler. If we register the App as an application, then it doesn't matter if Vortex or MO2 set a generic ProgID handler, it will never be used. SummaryWe can do two things:
Option 1 is better integrated into the OS, but it will prevent Vortex and MO2 from ever being the default handler again, unless they also register themselves as an application. If they register themselves, then the user has the best experience since they can actually pick and choose in the OS and Browser. Note that with Option 1, we won't be able to set ourselves as the default handler if there are multiple applications registered to handle Option 2 is the same method Vortex and MO2 use, and it's the "old" way of doing things. Going with this option means the App, Vortex, and MO2 fight for the same registry key, and setting a "default handler" is now up to the application. We'd need user interaction and settings to replicate the same things that Option 1 would give us, but instead of having the OS do all of this for us, we now need to implement user interactions ourselves. Specifically, we'd probably want to ask the user if we should be the default handler, or not. |
Can this be mitigated by submitting PRs to vortex and mo2? Obviously that only affects future versions. My instinct is that option 1 is better, but I feel like you'll also have to check the legacy registry key and (if it is set):
|
Option 1 would require changes to all other existing nxm protocol users, or risk preventing them from working. I would go with Option 2 because it is the least likely to cause issues. |
My opinion as a Community Manager is to prefer Option 1. With the following rationale:
|
As a bonus to Option 1, if every application registers itself, this standalone app could automatically get a list of those applications instead of requiring the user to manually add each app with the correct arguments. |
Lets assume, that Vortex and MO2 and App were all using Option1, Can applications change the default programmatically? |
If you run If you open a tab in your browser and go to
The OS settings can't be changed automatically. I'm not sure about browser settings, but I don't think it's a great idea to muck with those. The user can just open the settings and change to "always use X" or "always ask". |
I've been trying to refrain from speaking on the topic yesterday, but my opinion here is the same in general. The core issue is that at the end of the day, To that effect, we either could:
I would go with Option 1 though if we can easily prompt the user to change the default (I.e. open settings in right page like browsers do). Because then the Proxy could auto-populate available managers because the handlers already specify how they wish for their programs to be invoked. |
Then I think this would strictly be a worse experience for end users, as with Option 2 you can switch handler by simply opening the application you wish to use before starting the download, while with Option 1 users would have to manually change the default application when wanting to switch to another game on another manager, or they would have to make the selection on every single link. |
I will also summarise what I've ranted about in Slack a while back. A Likewise, we also have the policy where only Vortex supported games are allowed to have the Then there's also 3rd party Mod Managers, as this would allow them to better integrate with the site by supporting games 1st party ones might not. Instead of say, providing a worse UX and potentially losing games to competition. But I've been trying not to speak about that as the general attitude I've been receiving thus far is |
I've seen (third-party) nxm proxy apps in the wild, since this is already a problem for users who have both mo2 and vortex installed. Here's one example, and another.
100% agree, that's a poor attitude. Though I do think you can still encourage best practices in third-party apps where appropriate, but you can't expect third-parties to always agree and/or have time to work on whatever it is. IMO this is a good opportunity to encourage all nxm handling apps to start using the platform's best practices (option 1) rather than simply following suit and continuing to use the worse option. |
As an end-user, I would generally prefer if things broke once to ensure a better experience down the line, rather than having to deal with an ever-increasing heap of patches to a subpar "legacy" solution that is likely to create conflicts and issues down the line either way. Especially since, in my understanding, NMA is meant as a "next generation" mod manager for Nexus, and as such I wouldn't be opposed if it uses a new/updated protocol for handling Nexus mod links. Besides, NMA is still in it's early development stage, and I wouldn't expect many end users combining it with other mod managers. Also wouldn't it be possible to use the "best practices new protocol" as the default while offering a compatibility fallback option in settings? |
Option 1 for windows has been discarded for the following reasons:
Option 1 is the Microsoft advised version, but it assumes something where the user will have a clear preference that does not need to change every time, e.g. what program to use to open PDF files. NXM protocol has the problem that it is used for every Nexus game, but the reality is that users will likely have a different preferred application for different games, especially since the App and Vortex will coexist for a period as App builds up game support. |
Resolves #1668.
.desktop
file and update MIME cache (we won't do this if the App has been installed with a package manager)xdg-settings
to set default