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

NXM Handler Issues #734

Closed
har-nick opened this issue Feb 8, 2023 · 12 comments
Closed

NXM Handler Issues #734

har-nick opened this issue Feb 8, 2023 · 12 comments
Labels
bug Something isn't working Flatpak Issues related to SteamTinkerLaunch Flatpak ModOrganizer 2 Issues related to installing or using ModOrganizer 2 with SteamTinkerLaunch

Comments

@har-nick
Copy link

har-nick commented Feb 8, 2023

System Information

  • SteamTinkerLaunch version: 12.0.0
  • Distribution: Arch Linux
  • Installation Method: Flatpak

Issue Description

Tried downloading a file through Nexus' Mod Manager button, and was asked to specify a handler through Firefox.

The desktop file was not created in .local/desktop, so I created it myself using the wiki page here, and set the association in Firefox's Applications menu.

While the handler prompt isn't shown anymore, nothing happens. I then noticed the MO2 file specified in the desktop file (under Path) does not exist. In fact, no directory exists past ~/.var/app/com.valvesoftware.Steam/config/steamtinkerlaunch/mo2/compatdata.

I've tried reinstalling STL through Flatpak, but no difference was made.

Given this, and Flatpak STL not having an executable in /usr/bin, I'm assuming a different desktop file spec may need to be made for the Flatpak version.

@har-nick har-nick added the bug Something isn't working label Feb 8, 2023
@sonic2kk
Copy link
Owner

sonic2kk commented Feb 8, 2023

Hi!

Flatpak STL is only for Flatpak Steam, as noted on the wiki.

NXM link handling issues are already being tracked at #637, though no progress has been made. I'm not sure why it isn't working, and it isn't a feature I use very often. Though on my machine running Arch Linux Plasma Wayland and Firefox, it works without issue.

Closing as this is a duplicate of an already known issue even if it has no known resolution :-)

@sonic2kk sonic2kk closed this as completed Feb 8, 2023
@sonic2kk
Copy link
Owner

sonic2kk commented Feb 8, 2023

Oh, I think I misunderstood your issue description. It's that the .desktop file for Flatpak needs to point to a different location, right?

You don't mention that you're using Flatpak Steam so I assume you aren't and you'll want to use regular STL, however the desktop file pointing to the wrong place is something I'll take a look at when I have time.

No guarantees that link handling will work, especially with Flatpak ,and I highly encourage you to install your mods manually even on Windows (not a fan of these "one-click" buttons...), but I'll see about updating the .desktop file generation. Should hopefully be easy :-)

@sonic2kk sonic2kk reopened this Feb 8, 2023
@har-nick
Copy link
Author

har-nick commented Feb 8, 2023

Thanks for the quick reply!

I am using Flatpak Steam. It used to work previously, but I honestly can't say why it's stopped. The lacking directories being the cause is just my best guess.

@sonic2kk
Copy link
Owner

Had a quick look at the code, the path issue when creating the .desktop file was actually resolved a long time ago back with e92e68d. From re-reading, it seems the /usr/bin/steamtinkerlaunch issue is from copying from the wiki -- I guess the wiki just assumed users of the Flatpak release would know to substitute the correct path, sorry for that! When using Flatpaks in general, if you see something pointing at /usr or in general outside of the Flatpak sandbox folder, it's probably for regular users and not Flatpak users. It would defeat the purpose of Flatpaks were installed outside of the sandbox after all :-)

Probably the solution to this issue is twofold:

  1. In the short-term, creating the .desktop file manually with the correct STL path will be needed. I am not sure what the path to the SteamTinkerLaunch script is in Flatpak, maybe /home/<your username>/.var/app/ccom.valvesoftware.Steam.Utility.steamtinkerlaunch/ is a good place to start and look around. You can put the .desktop file still in ~/.local/share/applications I believe, and name it ModOrganizer-steamtinkerlaunch-dl.desktop
  2. In the long-term, we need to find out why it wasn't created. I am not sure why this would be the case but even outside of Flatpak it has been reported that occasionally permissions issues cause this. Actually iirc the issue I specifically remember (but of course cannot find...) was also on Manjaro. Not sure if anything on the STL side can actually resolve it.

For now the change I was planning to make in the code with my original comment, seems to already have been done.

See if you can create the .desktop file with the correct Path. However still no promises that this will work, given #637 and the fact that Flatpaks are quite limited.

@sonic2kk sonic2kk added ModOrganizer 2 Issues related to installing or using ModOrganizer 2 with SteamTinkerLaunch Flatpak Issues related to SteamTinkerLaunch Flatpak labels Feb 10, 2023
@har-nick
Copy link
Author

har-nick commented Feb 10, 2023

Hi! Thanks for looking further into this! Busy day today, so I haven't been able to update on here until now.


I guess the wiki just assumed users of the Flatpak release would know to substitute the correct path

I did check in what I assumed would be the Flatpak equivalent given both Flatpak applications' and non-Flatpak STL's user data directories reside in the home directory (.config and .var) however I honestly don't know enough about how Flatpak organises its packages to make a more informed guess.

maybe /home//.var/app/com.valvesoftware.Steam.Utility.steamtinkerlaunch/ is a good place to start and look around

I'd originally presumed it installed alongside Steam inside /var/lib/flatpak, but didn't delve too far into Steam's weird directory structure. Turns out I'd completely forgotten find exists, which got it right away.

The (current) directory for STL's script is:

/var/lib/flatpak/runtime/com.valvesoftware.Steam.Utility.steamtinkerlaunch/x86_64/stable/7ed2fbc59d517596efcb039ad8596bb453419cb2bc305d0ad4f197eaea8feaa8/files/bin/steamtinkerlaunch

That giant string gives me pause though. At 64 characters maybe it's a SHA256 checksum? I'll check it again when Steam updates to see if it changes.


After completely deleting the configuration folder in .var, along with Steam's Proton prefix folder for Skyrim, and then relaunching, I have a somewhat better structured config/steamtinkerlaunch/mo2 folder, however it currently only shows a users folder.

If it helps, Here's a tree of the mo2 directory in .var.

Tree
~/.var/app/com.valvesoftware.Steam/config/steamtinkerlaunch/mo2
> tree
.
├── compatdata
│   ├── pfx
│   │   └── drive_c
│   │       └── users
│   │           └── steamuser
│   │               └── AppData
│   │                   └── Local
│   │                       └── ModOrganizer
│   │                           └── Skyrim Special Edition
│   │                               ├── downloads
│   │                               ├── mods
│   │                               ├── overwrite
│   │                               ├── profiles
│   │                               │   └── Default
│   │                               │       ├── archives.txt
│   │                               │       ├── initweaks.ini
│   │                               │       ├── loadorder.txt
│   │                               │       ├── lockedorder.txt
│   │                               │       ├── modlist.txt
│   │                               │       ├── plugins.txt
│   │                               │       ├── settings.ini
│   │                               │       ├── skyrimcustom.ini
│   │                               │       ├── skyrim.ini
│   │                               │       └── skyrimprefs.ini
│   │                               └── webcache
│   │                                   ├── data8
│   │                                   │   ├── 0
│   │                                   │   ├── 1
│   │                                   │   ├── 2
│   │                                   │   ├── 3
│   │                                   │   ├── 4
│   │                                   │   │   └── 23rjofsd.d
│   │                                   │   ├── 5
│   │                                   │   ├── 6
│   │                                   │   ├── 7
│   │                                   │   ├── 8
│   │                                   │   ├── 9
│   │                                   │   ├── a
│   │                                   │   ├── b
│   │                                   │   ├── c
│   │                                   │   ├── d
│   │                                   │   ├── e
│   │                                   │   └── f
│   │                                   ├── nexus_cookies.dat
│   │                                   ├── prepared
│   │                                   ├── user_prefs.json
│   │                                   └── Visited Links
│   └── tracked_files
└── dldata
    └── skyrimspecialedition.conf

35 directories, 16 files

@sonic2kk
Copy link
Owner

The (current) directory for STL's script is:

/var/lib/flatpak/runtime/com.valvesoftware.Steam.Utility.steamtinkerlaunch/x86_64/stable/7ed2fbc59d517596efcb039ad8596bb453419cb2bc305d0ad4f197eaea8feaa8/files/bin/steamtinkerlaunch

Good find! I was on the complete wrong track, shows how much I use Flatpaks 😅 This is probably where you'll want to point the script to, however...

That giant string gives me pause though. At 64 characters maybe it's a SHA256 checksum? I'll check it again when Steam updates to see if it changes.

I was wondering the same. At the very least I am not sure that it is a "reliable" path. I've pinged the STL Flatpak maintainer at the bottom of this issue, though this is not exactly an issue specific to STL Flatpak as it just seems to occasionally happen, perhaps they have some better insight :-)

In the meantime, feel free to try using that as the Path and see if that does anything!

If it helps, Here's a tree of the mo2 directory in .var.

That's the Skyrim profile it looks like, that doesn't show the MO2 installation structure, which in your case should be somewhere like ~/.var/app/com.valvesoftware.Steam/config/steamtinkerlaunch/mo2/compatdata/pfx/drive_c/Modding/MO2/ - This holds the MO2 installation

image

As a little tidbit, in the directory structure you showed, the AppData/Local/ModOrganizer/Skyrim Special Edition/downloads folder is where mods that you download with the 1-click button will be stored (if/when we resolve the problem), if you're interested 🙂


@HanPrower Do you know where the "real" path to the Flatpak steamtinkerlaunch script is, and/or where would be the correct place to point the .desktop file's Path parameter so that it can find the STL script and run the MO2 command? (the tl;dr is that the .desktop file is missing and in this instance we want to manually create it, so we need the path to the steamtinkerlaunch script).

@har-nick
Copy link
Author

har-nick commented Feb 11, 2023

At the very least I am not sure that it is a "reliable" path.

AFAIK, there's only one other child in the same directory as that one, named "Active", so if anything were to be done that required targeting that folder you could just do whatever the Bash equivalent is of "the one that isn't active".

To run a command in a Flatpak container, I suppose you could use this command?

flatpak run --command=steamtinkerlaunch com.valvesoftware.Steam <ARGUMENTS>

So, something like this in the desktop file:

[Desktop Entry]
Type=Application
Categories=Game;
Name=ModOrganizer (SteamTinkerLaunch - steamtinkerlaunch)
MimeType=x-scheme-handler/nxm;x-scheme-handler/nxm-protocol
Terminal=false
X-KeepTerminal=false
Path=~/.var/app/com.valvesoftware.Steam/config/steamtinkerlaunch/mo2/compatdata/pfx/drive_c/Modding/MO2
Exec=flatpak run --command=steamtinkerlaunch com.valvesoftware.Steam mo2 u %u
NoDisplay=true

As I don't actually know how an NXM link is structured (monke bash download button) I tried running the command in Exec directly with an empty Url and it seemed to pass fine. Just an issue with not being able to find an associated source script because of said empty link. I doubt the desktop file would require a specified Path as that spawned instance MO2 uses my .var directory just fine.

@har-nick
Copy link
Author

As an aside in relation to the desktop file I've personally created - it doesn't seem to do anything when triggered by my browser? I currently have Exec set to sh -c "flatpak run --command=steamtinkerlaunch com.valvesoftware.Steam mo2 u %u" > log.txt.

If I run it with gtk-launch the output log is created, but there's nothing at all when ran through a browser. I have tried both the Flatpak and non-Flatpak versions of Firefox, but the issue's the same.

@sonic2kk
Copy link
Owner

I tried running the command in Exec directly with an empty Url and it seemed to pass fine

Ah, so this is a bit of a quirk with these one-click buttons. When I was first playing around with these probably almost a year ago now, I discovered something really strange. These one-click buttons don't just pass the URL to the mod. For example I thought it would be something like steamtinkerlaunch mo2 u nxm:https://nexusmods.com/blah/blah - But surprisingly not! What it actually does it pass a specific "nxm" url.

This structure is a little buried. Just hovering over the mod manager button isn't very helpful, as this takes you to the page that has the Slow or Fast download. But if you click on it, and then right click and inspect element on the Slow or Fast download button, you'll see a link like this (in this case, this is for the Clarity mod): nxm://newvegas/mods/42507/files/105803?key=blah&expires=blah&user_id=blah. This is the link you'll want to pass to your command I believe, so to run your Flatpak command manually, you'll want to do something like Exec=flatpak run --command=steamtinkerlaunch com.valvesoftware.Steam mo2 u nxm://newvegas/mods/42507/files/105803?key=blah&expires=blah&user_id=blah.

After this you should also be able to use xdg-open nxm://newvegas/mods/42507/files/105803?key=blah&expires=blah&user_id=blah and have that download the mods too, as the mime associations should be set up to properly use the .desktop file, meaning it will pass that url to the %u part of the Exec command. But we can't really test this until after we know the Exec command in the .desktop file is valid.


If all works as expected here, then we can move onto the next part you mentioned:

As an aside in relation to the desktop file I've personally created - it doesn't seem to do anything when triggered by my browser?

This is the crux of the NXM link handling issue in #637, and also an issue many users are experiencing with Hedge Mod Manager's link handling. And unfortunately the bottom line is that I don't really know why it's working for some users but not working for others. What's worse, several users have reported that sometimes it just starts and stops working for no real reason.

On Steam Deck usually nothing happens, or sometimes it prompts to ask for an application to use, but I can't figure out what's going on with this link handling or lack thereof. I have spent a lot of time looking into it in the past with Frostworx as part of #598 and other issues before that, but honestly a solution here will probably have to come from someone with more understanding of how these links work. Unfortunately it is rare for anyone to step up and contribute anything to STL so I am not holding my breath too much on that one :-)

If it gets to the point where the .desktop file command works but the browser isn't properly using it, then I don't think we'll make much more progress as this will probably be the same problem as #637 sadly, which has no solution yet. Sorry about that 😦

@har-nick
Copy link
Author

Awesome! Thank you so much for explaining the link to me.

I'm used to tracing network requests for stuff, but I didn't realise the Slow/Fast Download screen atuomatically redirects you if you have Premium lol. I had to copy the link and then visit it manually.

But it works! Sadly. Which means it's that infamous issue you've talked about.

For the sake of documentation, here's the Desktop file I'm using for Flatpak:

[Desktop Entry]
Type=Application
Categories=Game;
Name=ModOrganizer (SteamTinkerLaunch - steamtinkerlaunch)
MimeType=x-scheme-handler/nxm;x-scheme-handler/nxm-protocol
Terminal=false
X-KeepTerminal=false
Exec=flatpak run --command=steamtinkerlaunch com.valvesoftware.Steam mo2 u %u
NoDisplay=false

I'll close this issue as my problem's fixed, but I'll read through #637 and see if I can't help at all. I guess I'd mistakenly thought it was fixed when I commented there.

@sonic2kk
Copy link
Owner

Thanks for attaching that .desktop file structure! I will get that added to the wiki :-)

@GamertechAU
Copy link

Just want to add that har-nick's .desktop file works great for flatpak Vortex too, obviously with swapping mo2 to vortex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Flatpak Issues related to SteamTinkerLaunch Flatpak ModOrganizer 2 Issues related to installing or using ModOrganizer 2 with SteamTinkerLaunch
Projects
None yet
Development

No branches or pull requests

3 participants