CitiesSkylinesMultiplayer / CSM

Source code for the Cities: Skylines Multiplayer mod (CSM)

Home Page:https://citiesskylinesmultiplayer.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update check on startup

DominicMaas opened this issue · comments

Is your feature request related to a problem? Please describe.
Since many users are using this mod outside of the Steam Workshop, it would be a good idea to have an update check (maybe alongside the changelog code?) that checks the installed version, against the latest version (there is a GitHub API that gives us information about the latest release, could either ask it directly, or abstract that check behind the website .e.g. https://citiesskylinesmultiplayer.com/latest-version).

Describe the solution you'd like
A dialog that lets the user know that they are running an outdated version of the mod. This could be done near the changelog code (since we are comparing versions, and displaying dialog there already).

commented

I don't understand C# all that much but to the best of my ability a fair few things use the raw version of GH content to read a file with the version stored raw in it. I'm sure since there is building with Github CI that you could find a way to find the latest build and work off that. And just doing a HTTP req to it. But again, this is the way I've done it in the past with a HTTP request and worked for what I done.

hmmm, I was updating the website to supply an endpoint, but yeah, I wonder if we just have a VERSION file in the root of the repo that contains the latest version (we'll have to update it during releases, but we have to do other stuff during releases anyway).

Can then access it using the raw.github api. Saves me having to chuck up an express server and host it, vs leaving it on GitHub pages.

Yeah I'm liking this idea way better than my website endpoint idea, just spent 30 minutes battling with node, so I'd rather not continue doing that lol

commented

Yeah understandable, I'd take that way aswell since Express is just lovely to work with on the best of days....

commented

Actually to come back to this I found something that might be interesting https://api.github.com/repos/CitiesSkylinesMultiplayer/CSM/actions/artifacts can return a JSON reply with all the past artifacts and lists all of them, could get the first one and check the version of that.

Yeah, came across https://api.github.com/repos/CitiesSkylinesMultiplayer/CSM/releases/latest earlier. Parsing the JSON in cities might be interesting...

commented

Oh if that would be worse they I'd revert to the raw.github method 🤣🤣

Ahhh, WebClient within Cities / Unity does not support https.... just to make things interesting! haha

commented

If you can hold off for 5 minutes and let me test something I might have something that can help. Mind if I drop you a DM on Discord?

Sure thing, I'm currently attempting to use the cities http api