From 334773ba2aa62c5b539273e2888df5b3befdf5b0 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Thu, 19 Oct 2023 10:23:19 -0400 Subject: Check for updates on Four Island now --- src/tracker_frame.cpp | 40 +++++++++++++++------------------------- 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/src/tracker_frame.cpp b/src/tracker_frame.cpp index 49f947f..a74e81e 100644 --- a/src/tracker_frame.cpp +++ b/src/tracker_frame.cpp @@ -135,9 +135,7 @@ void TrackerFrame::OnStatusChanged(wxCommandEvent &event) { void TrackerFrame::CheckForUpdates(bool manual) { wxWebRequest request = wxWebSession::GetDefault().CreateRequest( - this, - "https://api.github.com/repos/hatkirby/lingo-ap-tracker/" - "releases?per_page=8"); + this, "https://code.fourisland.com/lingo-ap-tracker/plain/VERSION"); if (!request.IsOk()) { if (manual) { @@ -153,28 +151,20 @@ void TrackerFrame::CheckForUpdates(bool manual) { Bind(wxEVT_WEBREQUEST_STATE, [this, manual](wxWebRequestEvent &evt) { if (evt.GetState() == wxWebRequest::State_Completed) { std::string response = evt.GetResponse().AsString().ToStdString(); - nlohmann::json parsed_response = nlohmann::json::parse(response); - - if (parsed_response.is_array() && !parsed_response.empty()) { - // This will parse to 0.0.0 if it's invalid, which will always be older - // than our current version. - Version latest_version( - parsed_response[0]["tag_name"].get()); - if (kTrackerVersion < latest_version) { - std::ostringstream message_text; - message_text << "There is a newer version of Lingo AP Tracker " - "available. You have " - << kTrackerVersion << ", and the latest version is " - << latest_version << ". Would you like to update?"; - - if (wxMessageBox(message_text.str(), "Update available", wxYES_NO) == - wxYES) { - wxLaunchDefaultBrowser( - parsed_response[0]["html_url"].get()); - } - } else if (manual) { - wxMessageBox("Lingo AP Tracker is up to date!", "Lingo AP Tracker", - wxOK); + + Version latest_version(response); + if (kTrackerVersion < latest_version) { + std::ostringstream message_text; + message_text << "There is a newer version of Lingo AP Tracker " + "available. You have " + << kTrackerVersion << ", and the latest version is " + << latest_version << ". Would you like to update?"; + + if (wxMessageBox(message_text.str(), "Update available", wxYES_NO) == + wxYES) { + wxLaunchDefaultBrowser( + "https://code.fourisland.com/lingo-ap-tracker/about/" + "CHANGELOG.md"); } } else if (manual) { wxMessageBox("Lingo AP Tracker is up to date!", "Lingo AP Tracker", -- cgit 1.4.1