Open comments for this post
I used these first two hours working out the QR codes and starting on the database. Since the base game does not have an expansion code, it made sense to start with that. I got about halfway through making a CSV containing the card ID (which is encoded in the QR code as well as written on both sides), author, title and release year of each song in tue base game. My end goal is to write an iOS app, and I am already thinking about how to distribute these databases. Do I include them in the bundle, or do I load them from a web site?
Open comments for this post
Over some time, I made a few improvements. The service now no longer runs as root, but as a dynamic user, which allocates a UID and GID at random. I had a few issues in the meantime, because this also automatically enables a lot of hardening functionality, preventing Deno from downloading its dependencies. I overrode the DENO_DIR environment variable and had systemd create a cache directory, and now it works.
Also, the access token is now no longer provided as a string, but inside an encrypted .env file. The dotenv file, however, is not loaded by Deno, but by systemd, which then passes it to the Deno process as usual.
Thanks to @jak2k for a lot of pointers to these systemd features!
Open comments for this post
It turns out the library hiccups when using a RAM buffer. I now save the files to /tmp, and create a ReadStream, and now it works! The rest of the time was spent writing a Nix flake, which both wraps the package (currently using a shell script, until I figure out how to run deno compile in the offline sandbox), and contains a NixOS module, which creates a systemd timer to run the bot as a oneshot service.
Open comments for this post
I wrote code that should work™. But for some reason, I get an HTTP error 400, and the stacktrace is of no use, since it is somewhere within the event loop. Also, some time is missing from Hackatime, since it only tracks git repositories.