I’m trying to get maplestory worlds working, and the main pain point is that it requires a link with a token that is regenerated every time. I can paste the link from the browser inspect log in the arguments field, but the next day the token expires so then I have to fetch a new link.
I currently worked around this by adding a launcher script that does this:
Which edits the lutris configfile in-place. This is then called from firefox by registering a desktop file with xdg-mime that passes the link to this script.
My question is basically just: is there a better way to accomplish this? I’ve thought about making a batch script on the windows side instead which does essentially the same thing, but that would be just that: the same thing.
Of course, I tried adding a bash variable as “arguments”, but it doesn’t expand, sadly.
how about an game specific prefix_command?
it is run with the commandline that lutris otherwise would execute itself as args.
it would be easy to get the needed token in the script and amend the commandline.
How would that work exactly? Does the arguments field expand windows variables?
I tried using the batch file which reads the link from a file that my bash script writes, but that didn’t work as the batch file is called with wine cmd /c, which fails silently.
This is an basic example of what i am thinking of:
#!/bin/bash
set -euxo pipefail
DOMAIN="example.com" # Replace it with the URL where you get the token/URL whatever
cookiefile=$(mktemp)
echo '# Custom cookiefile since curl can't read sqlite3 files (yet)'
sqlite3 -separator $'\t' .mozilla/firefox/otmmx9nf.default-release/cookies.sqlite "SELECT host, case substr(host,1,1)='.' when 0 then 'FALSE' else 'TRUE' end, path, case isSecure when 0 then 'FALSE' else 'TRUE' end, expiry, name, value FROM moz_cookies WHERE host = '$DOMAIN';">>"$cookiefile"
token=$(curl --silent --cookie "$cookiefile" https://example.com/URLTOGETTOKEN | PROCESSING)
rm "$cookiefile"
"$@" $token
I wrapped the $@ in quotes to protect spaces in the argument list.
The complete commandline run by lutris would look like this:
PATH/TO/SCRIPT WINEPATH /path/to/exetutable ARG1 ARG2 …