updater
updater copied to clipboard
Fetch all URLs from a single URL, fix #46
Only one URL is hardcoded, which is a json file telling everything else.
The format is meant to be able to update the paths after a release, and to improve the updater to support multiple mirrors in the future. See #46
The overall concept is good. Besides permitting flexibility in the server configuration, this will be helpful when testing the updater.
However, I think some more work will be needed to correctly deal with the asynchronous nature of the versions.json request: the results are not always available when you want them. For example, if the game update page is opened while we still don't have the news URL (this will be especially important with the feature I am working on for Windows to relaunch as administrator, in which the splash screen will be skipped on the second launch).
We may postpone the news part, right? For the updater and game URLs I don't believe this PR adds more issue than there was before since those URLs were computed from fetched version numbers anyway.
It doesn't introduce an issue for the updater URL, since updater update can only be initiated when the versions request has succeeded.
It does create new problems for the game update. The game URL actually doesn't depend on the version number currently.
The game URL actually doesn't depend on the version number currently.
Ah, yes… 😕
So I rebased, and race conditions should now be avoided.
Here is an example of current.json
: https://cdn.unvanquished.net/current.json
{
"news": {
"version": "rolling",
"mirrors": [ "https://unvanquished.net" ],
"parcels": {
"all-all": {
"path": "api/get_recent_posts",
"content": "raw",
"container": "json"
}
}
},
"game": {
"version": "0.54.1",
"mirrors": [ "https://cdn.unvanquished.net" ],
"parcels": {
"all-all": {
"path": "unvanquished_0.54.1.torrent",
"content": "mixed-files",
"container": "torrent"
}
}
},
"updater": {
"version": "0.2.0",
"mirrors": [ "https://github.com/Unvanquished/updater/releases/download/v0.2.0" ],
"parcels": {
"linux-amd64": {
"path": "UnvUpdaterLinux.zip",
"content": "single-file",
"container": "zip"
},
"windows-i686": {
"path": "UnvUpdaterWin.zip",
"content": "single-file",
"container": "zip"
},
"macos-amd64": {
"path": "UnvUpdaterOSX.zip",
"content": "single-directory",
"container": "zip"
}
}
}
}
This new file is already generated by default on release (I added generation code for it in release scripts in 2021 when I opened this PR).
Some command line changed, the --internalcommand updateupdater
will reinstall the updater from the current known version if --updaterurl
is not set, or the one from --updaterurl
if provided.
The json file already supports multiple mirrors, but the updater code doesn't for now. In the future I want it to.