From 9cff5b8af49ea602a563d30e0eb4887fab2cd461 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sat, 8 Jun 2024 14:07:52 +0200 Subject: [PATCH] fix: Release notes in about page not working in nightly builds --- plugins/builtin/source/content/views/view_about.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/builtin/source/content/views/view_about.cpp b/plugins/builtin/source/content/views/view_about.cpp index 7c02a9795..de1cf311b 100644 --- a/plugins/builtin/source/content/views/view_about.cpp +++ b/plugins/builtin/source/content/views/view_about.cpp @@ -540,6 +540,7 @@ namespace hex::plugin::builtin { struct ReleaseNotes { std::string title; + std::string versionString; std::vector notes; }; @@ -561,6 +562,9 @@ namespace hex::plugin::builtin { // Get the release title notes.title = json["name"].get(); + // Get the release version string + notes.versionString = json["tag_name"].get(); + // Get the release notes and split it into lines auto body = json["body"].get(); notes.notes = wolv::util::splitString(body, "\r\n"); @@ -575,8 +579,9 @@ namespace hex::plugin::builtin { static ReleaseNotes notes; // Set up the request to get the release notes the first time the page is opened + const static auto ImHexVersionString = ImHexApi::System::getImHexVersion(false); AT_FIRST_TIME { - static HttpRequest request("GET", GitHubApiURL + std::string("/releases/tags/v") + ImHexApi::System::getImHexVersion(false)); + static HttpRequest request("GET", GitHubApiURL + std::string("/releases/") + (ImHexVersionString.ends_with(".WIP") ? "latest" : ( "tags/v" + ImHexVersionString))); m_releaseNoteRequest = request.execute(); }; @@ -593,7 +598,7 @@ namespace hex::plugin::builtin { // Draw the release title if (!notes.title.empty()) { - auto title = hex::format("v{}: {}", ImHexApi::System::getImHexVersion(false), notes.title); + auto title = hex::format("{}: {}", notes.versionString, notes.title); ImGuiExt::Header(title.c_str(), true); ImGui::Separator(); }