SaveTool: skip prereleases in update check.

This commit is contained in:
Guillaume Jacquemin 2021-12-02 20:37:47 +01:00
parent a05f3eeed0
commit 065e63f27c

View file

@ -402,7 +402,13 @@ void SaveTool::updateCheckEvent(SDL_Event& event) {
};
static const Version current_ver{SAVETOOL_VERSION};
Version latest_ver{response[0]["tag_name"]};
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.",
@ -418,6 +424,10 @@ void SaveTool::updateCheckEvent(SDL_Event& event) {
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);