Jump to content

Recommended Posts

Posted (edited)

vintagestorymodinstall:// is not RFC compliant, and that's a problem!

I originally wanted to file this as a bug, because it's kind of a bug, but not quite. Let me explain.

vintagestorymodinstall URIs should have a form that would be correct and in compliance with RFC 3986.

Valid URIs will greatly help to bring 1-click mod installs on non-Windows systems. For compatibility reasons, a valid schema could be introduced under a different name, and the previous one could be still working but deprecated.

Why they are not valid now?

Let's take vintagestorymodinstall://modname@1.2.3 as an example.

An application that expects this to be an URI will parse it like this (3.)

1. Scheme: vintagestorymodinstall
2. Authority: modname@1.2.3
3. User Information: modname
4. Host: 1.2.3

As you can see, it's not quite accurate. While vintagestorymodinstall is a valid name for a scheme, modname@1.2.3 is not an authority, modname is not user information, 1.2.3 is not a valid host either. In my opinion, the URI should look different so it conveys accurate information about its nature.

Why it should be valid?

Some applications will rightfully expect that vintagestorymodinstall://modname@1.2.3 is a valid URI. For example, an internet browser in which this URI is clicked, or a shell component that passes it as a parameter to an application. If the URI is wrong, something along the chain might also go wrong.

This is exactly what happens on Linux. Consider the following XDG Desktop Entry:

[Desktop Entry]
MimeType=x-scheme-handler/vintagestorymodinstall
Exec=vintagestory -i %u
(...)

According to the XDG desktop entry specification, there is no way to pass a parameter to the application if it's not a valid URI or file. When xdg-open vintagestorymodinstall://modname@1.2.3 is run on my KDE Deskop, 1.2.3 subcomponent is actually parsed as a host and turns it into a valid IP number, 1.2.0.3.

Screenshot_20230425_220344.thumb.png.ea0b8ad5c7a0e6dc7dc8b44a70d5ad75.png

So I guess it's only coincidental that those URIs work correctly on Windows, somehow.

My suggestion for an alternative

Consider this URI, which, to my eye, looks valid:

vintagestorymodinstallv2:modname/1.2.3

There are two major differences here: We get rid of //, turning it into a mailto: style URI. This is an information for the parser that authority is not present (3.3.), and everything that happens after the colon is a path.

The path, modname/1.2.3, actually "contains data in hierarchical form", which is compliant with section 3.3.

If Vintage Story will be able to parse vintagestorymodinstallv2:modname/1.2.3 correctly, getting it working on Linux will require writing just a small XDG desktop entry. Otherwise, I don't know how to do achieve the same result as on Windows, without using standardized tools that are non-native to standard Linux desktop environments.

That's all. I'd love to hear your opinion, especially if you're a Linux user.

Edited by mard
  • Like 9
  • mard changed the title to Add an RFC 3986 compliant alternative to vintagestorymodinstall:// URI, for Linux compatibility
  • 2 years later...
Posted

Sorry for reviving an old post, I came from Vintage Story on Steam Deck which links here.

I'd love for this to be properly implemented, with the fallback method as you mentioned.

The only thing I don't like is having the version as part of the path, It'd make sense to have it as a parameter:

vintagestorymodinstallv2:modname?v=1.2.3

That way you could omit the v param and let it handle to the latest one, or the latest one for the current game version for example.

 

Also the possibility to handle things as collections/modpacks (which aren't currently suported afaik but one can wish)

vintagestorymodinstallv2:mod/modname?v=1.2.3

vintagestorymodinstallv2:modpack/packname?v=1.2.3

 

And just in case anyone is interested, on linux there's an ugly workaround (assuming you run with flatpak, but you can edit the script as needed)

I have this script as /home/$USER/.local/bin/exo-open and /home/$USER/.local/bin/xdg-open (remember to set execute permission)

#!/usr/bin/env bash

if echo "$1" | grep -qE '^vintagestorymodinstall?://'; then
    flatpak run at.vintagestory.VintageStory -i "${@}"
    exit 0
fi

"/usr/bin/$(basename "$0")" "$@"

It sends the mod install directly to vintage story before the real xdg/exo open handles it. Otherwise it calls the real one.

Hacky, but useful, I used something similar to handle links to some domains on different browers.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.