From 11a868070595c5a41406e51c6bb6e2e9fb68b493 Mon Sep 17 00:00:00 2001 From: surepy <24486494+surepy@users.noreply.github.com> Date: Mon, 27 Mar 2023 00:11:41 -0700 Subject: [PATCH] update: fix when local version > latest would return bogus version numbers before. --- tf2_bot_detector/UI/MainWindow.cpp | 2 +- tf2_bot_detector/UpdateManager.cpp | 17 ++++++++++------- tf2_bot_detector/Version.base.h | 2 -- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/tf2_bot_detector/UI/MainWindow.cpp b/tf2_bot_detector/UI/MainWindow.cpp index 4a861a62..eebf3a1d 100644 --- a/tf2_bot_detector/UI/MainWindow.cpp +++ b/tf2_bot_detector/UI/MainWindow.cpp @@ -55,7 +55,7 @@ namespace tf2_bot_detector } MainWindow::MainWindow(ImGuiDesktop::Application& app) : - ImGuiDesktop::Window(app, 800, 600, mh::fmtstr<128>("TF2 Bot Detector v{}", VERSION).c_str()), + ImGuiDesktop::Window(app, 800, 600, mh::fmtstr<128>("TF2 Bot Detector v{} (sleepybuild)", VERSION).c_str()), m_WorldState(IWorldState::Create(m_Settings)), m_ActionManager(IRCONActionManager::Create(m_Settings, GetWorld())), m_TextureManager(ITextureManager::Create()), diff --git a/tf2_bot_detector/UpdateManager.cpp b/tf2_bot_detector/UpdateManager.cpp index cc999e39..78ce67e4 100644 --- a/tf2_bot_detector/UpdateManager.cpp +++ b/tf2_bot_detector/UpdateManager.cpp @@ -240,19 +240,22 @@ namespace "Checking for updates...", std::async([sharedClient, releaseChannel]() -> BuildInfo { - auto a = sharedClient->shared_from_this(); - - auto newver = tf2_bot_detector::GithubAPI::CheckForNewVersion(*a); - newver.wait(); + auto newver = tf2_bot_detector::GithubAPI::CheckForNewVersion(*sharedClient); tf2_bot_detector::GithubAPI::NewVersionResult result = newver.get(); BuildInfo ret; - ret.m_GitHubURL = result.GetURL(); - // TODO: pre-release == ReleaseChannel::Preview ret.m_ReleaseChannel = ReleaseChannel::Public; - ret.m_Version = result.m_Stable->m_Version; + + if (result.m_Stable) { + ret.m_GitHubURL = result.GetURL(); + ret.m_Version = result.m_Stable->m_Version; + } + // if result.m_Stable == null, that means no new versions to look at, so just return our current version. + else { + ret.m_Version = tf2_bot_detector::VERSION; + } return ret; })); diff --git a/tf2_bot_detector/Version.base.h b/tf2_bot_detector/Version.base.h index 5f567665..6d2af3b8 100644 --- a/tf2_bot_detector/Version.base.h +++ b/tf2_bot_detector/Version.base.h @@ -51,8 +51,6 @@ namespace tf2_bot_detector { os << v.m_Major << '.' << v.m_Minor << '.' << v.m_Patch; - os << " (sleepybuild)"; - if (v.IsCustomBuild()) os << " (Custom Build)"; else