2 # Run z-machine interpreter, allowing the user to save their game in a
3 # directory specific to their client cert.
7 [ -n "$TLS_CLIENT_HASH" ] ||
exit 1
9 echo "Choose your poison:"
13 sanitised
="$(tr -dc [:alnum:]_ <<< "$input")"
14 gamefile
="$var/games/$sanitised"
15 if [ -n "$sanitised" ] && [ -e "$gamefile" ]; then
18 echo "Please enter one of the listed games"
21 echo "Starting $sanitised. Savefiles will be preserved."
24 savesdir
="$var/$TLS_CLIENT_HASH/$sanitised"
26 mkdir
-p "$savesdir" ||
exit 1
27 cd "$savesdir" ||
exit 1
29 # Impose some limits to reduce potential for abuse
34 # using the z-machine interpreter infuse, which has a nice stdio interface:
35 # https://gitlab.com/monkeymind/infuse
36 stdbuf
-i0 -o0 infuse
"$gamefile"
38 # Previous attempt: using dfrotz, but it has some problems.
39 #dfrotz -m -Z0 -R. "$gamefile"