-
Notifications
You must be signed in to change notification settings - Fork 7
Fetch all URLs from a single URL, fix #46 #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
5fdaf2f to
3d0f2b5
Compare
|
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. |
Ah, yes… 😕 |
|
So I rebased, and race conditions should now be avoided. Here is an example of {
"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 The json file already supports multiple mirrors, but the updater code doesn't for now. In the future I want it to. |
ef4580b to
14215fc
Compare
|
Revisiting this due to Unvanquished/Unvanquished#3457. The sticking point was that adding URLs into the former
|
We have a script fetching current lists of known good trackers and merging them, then the release script use that merged list. Both scripts (fetching tracker list, and publishing a release) are part of the release process. So it is generated once when publishing a release. |
If we want the updater iterate a list of mirrors, we better not blumb the list of URLs through the command line arguments but let the elevated updater fetch the list of mirrors by itself, even if that means downloading twice the json file. |
Peoples syncing the CDN with rsync are already syncing the torrent file and that json file (they're all stored in the same folder). Unlike the original https://dl.unvanquished.net/versions.json, this was designed from the start to be hosted as https://cdn.unvanquished.net/current.json to make it purposely synced with the CDN. |
|
The thing is that we may have torrent mirrors on places where there is no version json mirrored files, and the json mirrored file may be mirrored before the torrent is. So we may save a request by looking at the torrent file on the same place the version file is, but we would still do a request as a fallback if for some reason the CDN is incompletely mirrored and we need to find another torrent location. |
14215fc to
776f642
Compare
|
Here is the current generated https://cdn.unvanquished.net/current.json file: {
"news": {
"version": "rolling",
"mirrors": [ "https://unvanquished.net/" ],
"parcels": {
"all-all": {
"path": "api/get_recent_posts",
"content": "wordpress-posts",
"container": "json"
}
}
},
"game": {
"version": "0.55.5",
"mirrors": [
"https://github.com/Unvanquished/Unvanquished/releases/download/v0.55.5/",
"https://master.dl.sourceforge.net/project/unvanquished/v0.55.5/",
"https://cdn.unvanquished.net/",
"https://cdn.illwieckz.net/unvanquished/",
"https://unvcdn.viech.name/",
"https://webseed.unv.kangz.net/",
"https://fosstorrents.com/files/download.php?file="
],
"parcels": {
"all-all": {
"path": "unvanquished_0.55.5.torrent",
"content": "mixed-files",
"container": "torrent"
}
}
},
"updater": {
"version": "0.2.1",
"mirrors": [
"https://github.com/Unvanquished/updater/releases/download/0.2.1/",
"https://master.dl.sourceforge.net/project/unvanquished/Updaters/0.2.1/"
],
"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"
}
}
}
}I verified that the updater succeeds to download the torrent from GitHub, SourceForge and FOSS Torrents, so redirections are properly handled in that part of the updater. |
878fe7a to
4016854
Compare
We probably don't want a list of mirrors for this anyway since we just have to trust the download source (unless we add more code to check a hash). Are there any plans to host the updater binary somewhere besides Github? This would increase code complexity since for the updater update case we would have to add extra logic to wait indefinitely for the versions data, error if an update is not detected, etc.
As mentioned in the other thread, we probably don't want to mirror the torrent everywhere since it needs to be trusted, like the JSON file. What if we embed the torrent inside the JSON? Then there would be no problems with synchronization or chained downloads. |
ea954c4 to
78d72fd
Compare
f8f2228 to
0f81b66
Compare
The updater is usually mirrored to SourceForge and we trust that. |
|
I added a commit that can look for alternate I also added a commit that attempts to also iterate the torrents, but it crashes. I guess we never took care of properly closing a download before, so starting a download while once have been tried first is crashing the updater. I kept a |
|
Or maybe that's the contrary: we destroy too much things when stopping a download, and maybe it was never written to be able to do more than one download. Actually, removing |
eaf870b to
0e526e2
Compare
|
For the updater url passed to the command line, we may implement an alternate command line option where we pass the |
|
Or we may add as much as url there are on the command line. |
|
Like this: ./updater --splashms 1 --internalcommand updateupdater \
--updaterurl 'https://github.com/Unvanquished/updater/releases/download/0.2.1/UnvUpdaterLinux.zip' \
--updaterurl 'https://master.dl.sourceforge.net/project/unvanquished/Updaters/0.2.1/UnvUpdaterLinux.zip' |
513cde3 to
f013053
Compare
I implemented that. I don't know if it works, but at least it builds. |
3768940 to
71750f3
Compare
|
It looks like everything is now implemented. I verified that if torrent or updater mirror is wrong, the next in list is picked, and if all urls are wrong, an error message is displayed after having iterated all the mirrors. |
|
The mirroring of the For the |
|
|
It's a way to mirror it on a reliable host, but I would prefer it to be mirrored on less static places. One of the purpose of having such We already have something similar with the master server, as we have |
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