SaveTool: skip prereleases in update check.
This commit is contained in:
parent
a05f3eeed0
commit
065e63f27c
1 changed files with 25 additions and 16 deletions
|
@ -402,22 +402,32 @@ void SaveTool::updateCheckEvent(SDL_Event& event) {
|
|||
};
|
||||
|
||||
static const Version current_ver{SAVETOOL_VERSION};
|
||||
Version latest_ver{response[0]["tag_name"]};
|
||||
|
||||
if(latest_ver > current_ver || (latest_ver == current_ver && Utility::String::endsWith(SAVETOOL_VERSION, "-pre"))) {
|
||||
_queue.addToast(Toast::Type::Warning, "Your version is out of date.\nCheck the settings for more information.",
|
||||
std::chrono::milliseconds{5000});
|
||||
_updateAvailable = true;
|
||||
_latestVersion = Utility::formatString("{}.{}.{}", latest_ver.major, latest_ver.minor, latest_ver.patch);
|
||||
_releaseLink = response[0]["html_url"];
|
||||
_downloadLink = response[0]["assets"][0]["browser_download_url"];
|
||||
}
|
||||
else if(latest_ver == current_ver) {
|
||||
_queue.addToast(Toast::Type::Success, "The application is already up to date.");
|
||||
}
|
||||
else if(current_ver > latest_ver) {
|
||||
_queue.addToast(Toast::Type::Warning, "Your version is more recent than the latest one in the repo. How???");
|
||||
for(auto& release : response) {
|
||||
if(release["prerelease"] == true) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Version latest_ver{release["tag_name"]};
|
||||
|
||||
if(latest_ver > current_ver || (latest_ver == current_ver && Utility::String::endsWith(SAVETOOL_VERSION, "-pre"))) {
|
||||
_queue.addToast(Toast::Type::Warning, "Your version is out of date.\nCheck the settings for more information.",
|
||||
std::chrono::milliseconds{5000});
|
||||
_updateAvailable = true;
|
||||
_latestVersion = Utility::formatString("{}.{}.{}", latest_ver.major, latest_ver.minor, latest_ver.patch);
|
||||
_releaseLink = response[0]["html_url"];
|
||||
_downloadLink = response[0]["assets"][0]["browser_download_url"];
|
||||
}
|
||||
else if(latest_ver == current_ver) {
|
||||
_queue.addToast(Toast::Type::Success, "The application is already up to date.");
|
||||
}
|
||||
else if(current_ver > latest_ver) {
|
||||
_queue.addToast(Toast::Type::Warning, "Your version is more recent than the latest one in the repo. How???");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void SaveTool::initialiseConfiguration() {
|
||||
|
@ -762,8 +772,7 @@ void SaveTool::checkGameState() {
|
|||
}
|
||||
|
||||
void SaveTool::checkForUpdates() {
|
||||
cpr::Response r = cpr::Get(cpr::Url{"https://williamjcm.ovh/git/api/v1/repos/williamjcm/MassBuilderSaveTool/releases"},
|
||||
cpr::Parameters{{"limit", "1"}}, cpr::Timeout{10000});
|
||||
cpr::Response r = cpr::Get(cpr::Url{"https://williamjcm.ovh/git/api/v1/repos/williamjcm/MassBuilderSaveTool/releases"}, cpr::Timeout{10000});
|
||||
|
||||
SDL_Event event;
|
||||
SDL_zero(event);
|
||||
|
|
Loading…
Reference in a new issue