From 0a5cf0762a15de19ce0f56b008ffc7c748a2af0e Mon Sep 17 00:00:00 2001 From: Wimberton Date: Mon, 9 Mar 2026 14:42:41 -0400 Subject: [PATCH 1/4] fix: make invalidver auto-open behavior opt-in via autoOpenDownloadUrl flag Replace the unconditional URL open and exit on invalidver with a configurable autoOpenDownloadUrl flag (default false). When disabled, the library stores the download link and returns control to the caller, allowing custom error handling. Set true before init() to restore the old auto-open-and-exit behavior. --- auth.cpp | 15 ++++++--------- auth.hpp | 1 + 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/auth.cpp b/auth.cpp index 0af7ed4..55f731a 100644 --- a/auth.cpp +++ b/auth.cpp @@ -597,16 +597,13 @@ void KeyAuth::api::init() else if (json[(XorStr("message"))] == XorStr("invalidver")) { std::string dl = json[(XorStr("download"))]; - api::app_data.downloadLink = json[XorStr("download")]; - if (dl == "") - { - MessageBoxA(0, XorStr("Version in the loader does match the one on the dashboard, and the download link on dashboard is blank.\n\nTo fix this, either fix the loader so it matches the version on the dashboard. Or if you intended for it to have different versions, update the download link on dashboard so it will auto-update correctly.").c_str(), NULL, MB_ICONERROR); - } - else - { - ShellExecuteA(0, XorStr("open").c_str(), dl.c_str(), 0, 0, SW_SHOWNORMAL); + api::app_data.downloadLink = dl; + if (autoOpenDownloadUrl) { + if (!dl.empty()) { + ShellExecuteA(0, XorStr("open").c_str(), dl.c_str(), 0, 0, SW_SHOWNORMAL); + } + LI_FN(exit)(0); } - LI_FN(exit)(0); } } else { diff --git a/auth.hpp b/auth.hpp index ef22c0b..74973d6 100644 --- a/auth.hpp +++ b/auth.hpp @@ -59,6 +59,7 @@ namespace KeyAuth { bool block_proxy = false; bool block_custom_ca = false; bool block_private_dns = false; + bool autoOpenDownloadUrl = false; static std::string expiry_remaining(const std::string& expiry); static constexpr const char* kSavePath = "test.json"; static constexpr int kInitFailSleepMs = 1500; From 4c1484ce52d3246bf9143ba4a2fbc03d0064aa7c Mon Sep 17 00:00:00 2001 From: Wimberton Date: Mon, 9 Mar 2026 14:48:43 -0400 Subject: [PATCH 2/4] fix: store descriptive error in response.message on invalidver Populate response.message with a detailed diagnostic string when invalidver is returned and the download link is blank, allowing the caller to display the error in their own UI. When the download link is present, response.message is set to "invalidver" for easy detection. --- auth.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/auth.cpp b/auth.cpp index 55f731a..8272545 100644 --- a/auth.cpp +++ b/auth.cpp @@ -598,6 +598,12 @@ void KeyAuth::api::init() { std::string dl = json[(XorStr("download"))]; api::app_data.downloadLink = dl; + if (dl.empty()) { + api::response.message = XorStr("Version in the loader does not match the one on the dashboard, and the download link on dashboard is blank. To fix this, either fix the loader so it matches the version on the dashboard. Or if you intended for it to have different versions, update the download link on dashboard so it will auto-update correctly."); + } + else { + api::response.message = XorStr("invalidver"); + } if (autoOpenDownloadUrl) { if (!dl.empty()) { ShellExecuteA(0, XorStr("open").c_str(), dl.c_str(), 0, 0, SW_SHOWNORMAL); From ee588ee81366f82d55b09bb5fa9b1f4eba71350b Mon Sep 17 00:00:00 2001 From: Wimberton Date: Mon, 9 Mar 2026 15:17:35 -0400 Subject: [PATCH 3/4] The invalidver behavior is now controlled by the autoOpenDownloadUrl flag, which defaults to true for backward compatibility. --- auth.cpp | 19 ++++++++++++------- auth.hpp | 2 +- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/auth.cpp b/auth.cpp index 8272545..3c068a8 100644 --- a/auth.cpp +++ b/auth.cpp @@ -598,18 +598,23 @@ void KeyAuth::api::init() { std::string dl = json[(XorStr("download"))]; api::app_data.downloadLink = dl; - if (dl.empty()) { - api::response.message = XorStr("Version in the loader does not match the one on the dashboard, and the download link on dashboard is blank. To fix this, either fix the loader so it matches the version on the dashboard. Or if you intended for it to have different versions, update the download link on dashboard so it will auto-update correctly."); - } - else { - api::response.message = XorStr("invalidver"); - } if (autoOpenDownloadUrl) { - if (!dl.empty()) { + if (dl.empty()) { + MessageBoxA(0, XorStr("Version in the loader does not match the one on the dashboard, and the download link on dashboard is blank.\n\nTo fix this, either fix the loader so it matches the version on the dashboard. Or if you intended for it to have different versions, update the download link on dashboard so it will auto-update correctly.").c_str(), NULL, MB_ICONERROR); + } + else { ShellExecuteA(0, XorStr("open").c_str(), dl.c_str(), 0, 0, SW_SHOWNORMAL); } LI_FN(exit)(0); } + else { + if (dl.empty()) { + api::response.message = XorStr("Version in the loader does not match the one on the dashboard, and the download link on dashboard is blank. To fix this, either fix the loader so it matches the version on the dashboard. Or if you intended for it to have different versions, update the download link on dashboard so it will auto-update correctly."); + } + else { + api::response.message = XorStr("invalidver"); + } + } } } else { diff --git a/auth.hpp b/auth.hpp index 74973d6..bd7d00d 100644 --- a/auth.hpp +++ b/auth.hpp @@ -59,7 +59,7 @@ namespace KeyAuth { bool block_proxy = false; bool block_custom_ca = false; bool block_private_dns = false; - bool autoOpenDownloadUrl = false; + bool autoOpenDownloadUrl = true; static std::string expiry_remaining(const std::string& expiry); static constexpr const char* kSavePath = "test.json"; static constexpr int kInitFailSleepMs = 1500; From 3224586a1d7e2836141c0c4795c90a1e10cdf09b Mon Sep 17 00:00:00 2001 From: Wimberton Date: Mon, 9 Mar 2026 15:38:16 -0400 Subject: [PATCH 4/4] rename autoOpenDownloadUrl to auto_open_download_url for snake-case consistency --- auth.cpp | 2 +- auth.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/auth.cpp b/auth.cpp index 3c068a8..f1ef415 100644 --- a/auth.cpp +++ b/auth.cpp @@ -598,7 +598,7 @@ void KeyAuth::api::init() { std::string dl = json[(XorStr("download"))]; api::app_data.downloadLink = dl; - if (autoOpenDownloadUrl) { + if (auto_open_download_url) { if (dl.empty()) { MessageBoxA(0, XorStr("Version in the loader does not match the one on the dashboard, and the download link on dashboard is blank.\n\nTo fix this, either fix the loader so it matches the version on the dashboard. Or if you intended for it to have different versions, update the download link on dashboard so it will auto-update correctly.").c_str(), NULL, MB_ICONERROR); } diff --git a/auth.hpp b/auth.hpp index bd7d00d..c4128b4 100644 --- a/auth.hpp +++ b/auth.hpp @@ -59,7 +59,7 @@ namespace KeyAuth { bool block_proxy = false; bool block_custom_ca = false; bool block_private_dns = false; - bool autoOpenDownloadUrl = true; + bool auto_open_download_url = true; static std::string expiry_remaining(const std::string& expiry); static constexpr const char* kSavePath = "test.json"; static constexpr int kInitFailSleepMs = 1500;