I was going to title this post "GETting Frustrated" but that inflicted psychic damage on me so I didn't
I've been playing around with adding an update checker to notify of new releases to the Astralathe launcher. No auto-updater, mind you, just a thing that checks the GitLab API and says "Hey there's a new version!!". Then I realised that making web requests in C/C++ sucks.
Really bad.
See, all I want to do is make a web request. A single, simple GET to the GitLab API. Then I'd parse the JSON response, parse out the version number, and see if the latest release is a newer version. And yet, to perform this simple task, I need to jump through a million hoops.
I tried different libraries before giving up and turning to plain old libcurl. The first library I tried was great in terms of usage but then I realised it didn't support HTTPS. You know, the thing basically every website uses these days.
I had to build libcurl myself to get a working static-link version. Static linking is important - it means I don't have to ship additional DLL files with Astralathe.1
To ship dynamically linked libcurl I'd have to ship libcurl itself, as well as two additional DLLs for OpenSSL. I had to build libcurl and OpenSSL myself just to get static builds. This was incredibly inconvenient and in the case of OpenSSL, annoyingly time consuming. I hate needing to wait on stuff. It's hard for me to maintain focus on something at the best of times, usually the smallest stall is enough to kill all my momentum.
I'm actually writing this post as I wait for OpenSSL to build just so I have something to do and don't get caught up in a distraction. It just failed by the way. It ran out of disk space.
To make ONE HTTPS GET REQUEST just to let people know that there's a new version available, I've had to build TWO SEPERATE LIBRARIES, one of which took THIRTY MINUTES.
Oh but it gets worse! Because actually the build I did sucks because OpenSSL when you build OpenSSL in static mode it ends up massive.
Built this way, libcrypto.lib is 37 MB! When I link this build of OpenSSL into Astralathe, it bloats the launcher executable from 151KB to 3 MEGABYTES. COME ON.
I know that that's still basically nothing but this bothers me A LOT on a personal level. I HATE this. I try my best to create a cut down OpenSSL build but the gains are minimal and it breaks the whole thing so I give up on that idea. In total I spent over 2 hours fiddling with OpenSSL.
2.8 extra MB taken up by the launcher for the sake of a single HTTPS GET request. God damnit. I know it's such a tiny increase I shouldn't care about but it really bugs me. The launcher is now larger than Astralathe itself.
Anyway, after then fighting with libcurl over more SSL nonsense (why would you not use the Windows cert store by default? Why did I have to find the exact right combo of words to find a solution that wasn't "Ship certs with your application"?) I finally make a single request.
The rest of the work is the easy part. I get the response JSON, check the tag, compare to the internal version and tell the user about it if the version differs. This is a very naive check - it'll also complain if your version is newer than that returned by GitLab's API, but that shouldn't really be a problem unless I really screw something up or you're working on the tool.

If you've got an outdated version the launcher will let you know about it, give you some numbers, tell you where to grab the newest release, and ask if you wanna be taken there in your default browser. Saying yes exits and takes you to the latest release, saying anything else continues as usual. In the future I plan to add an option to disable the update check but that'll be done when I rework the configuration module into being shared between launcher and plugin.
I'm still deciding if this is the final iteration of how I want to do things or not but this will most likely be shipped as part of Astralathe V1.8.2. I think it's better to get this out of the way sooner rather than later. Right now the audience for Astralathe is so small that everyone who cares is pretty much just notified of it updating via me posting in various Discord servers.
Which SUCKS you should NEVER have information that can ONLY be found on a Discord server if you're doing that STOP RIGHT NOW. SERIOUSLY. THAT INFORMATION WILL BE LOST.
Anyway yeah I'm done with this, that was painful, but it works.
I will most likely never add an actual auto-updater because that is an entirely seperate can of worms that I do not want to deal with. This is good enough for now.
-
Astralathe being as minimal as possible is important to me. Whenever I decide to put something in the Astralathe release ZIP files it has to have a good reason. It's already more than I'd like in no small part due to PolyHook2 having 4 DLL dependencies, but it's also my own fault because I have to ship CobwebDuster+PsychoPortal, as well as widescreen resources, and the recent addition of
astralathe_hooks.lua, and a BAT to work around an issue caused by Windows. So yes I understand the situation is already a bit out of hand and I realistically should not care about 2 extra libraries but damnit I'm gonna take the chance to cut out what I can.