Skip to content
This repository has been archived by the owner on May 9, 2024. It is now read-only.

Commit

Permalink
Fixes to beta updater
Browse files Browse the repository at this point in the history
  • Loading branch information
pierr3 committed Jan 17, 2024
1 parent cbb3537 commit 792f842
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ void App::render_frame()
Updater::draw_beta_hint();

// Version
ImGui::TextUnformatted(shared::kClientName.c_str());
ImGui::TextUnformatted(VECTOR_VERSION);

// Licenses

Expand Down
12 changes: 6 additions & 6 deletions src/updater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ Updater::Updater()

try {
std::string cleanBody = res->body;
absl::StripAsciiWhitespace(&res->body);
pNewVersion = semver::version { res->body };
absl::StripAsciiWhitespace(&cleanBody);
pNewVersion = semver::version { cleanBody };
} catch (std::invalid_argument& ex) {
spdlog::critical(
"Cannot parse updater version, please update manually!");
Expand All @@ -48,22 +48,22 @@ Updater::Updater()
// isBetaAvailable
auto betaRes = pCli.Get(pBetaVersionUrl);

if (res->status == 200) {
if (res->status != 200) {
spdlog::warn("Cannot access updater beta endpoint!");
return;
}

try {
std::string cleanBody = betaRes->body;
absl::StripAsciiWhitespace(&betaRes->body);
absl::StripAsciiWhitespace(&cleanBody);
pBetaVersion = semver::version { cleanBody };
} catch (std::invalid_argument& ex) {
spdlog::warn("Cannot parse updater beta version!");
spdlog::warn(ex.what());
return;
}

if (pBetaVersion == currentVersion) {
if (pBetaVersion <= currentVersion && currentVersion != pNewVersion) {
// We are using the beta version
shared::isUsingBeta = true;
shared::betaVersionString = pBetaVersion.to_string();
Expand Down Expand Up @@ -109,7 +109,7 @@ void Updater::draw_beta_hint()
if (shared::isUsingBeta) {
ImGui::NewLine();

ImGui::TextColored(ImColor(30, 140, 45).Value,
ImGui::TextColored(ImColor(74, 159, 224).Value,
"You are using a\nbeta version.\n"
"Please report "
"any\n"
Expand Down

0 comments on commit 792f842

Please sign in to comment.