From b328e98444baecdef1828e0c2379cc6ef1ebfcf7 Mon Sep 17 00:00:00 2001 From: DavidXanatos <3890945+DavidXanatos@users.noreply.github.com> Date: Sun, 12 Feb 2023 13:17:20 +0100 Subject: [PATCH] 1.7.3 --- CHANGELOG.md | 1 + Sandboxie/apps/control/Updater.cpp | 29 ++++++++++++++++++++++++----- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4e7ba64..375a0f60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - moved the "Support" settings page the above "Advance Options" page and renamed it to "Support & Updates" - when dragging and dropping a file on to the sandman UI to run it the currently selected box will be pre-selected in the box picker dialog - improved access rule handling [#2633](https://github.com/sandboxie-plus/Sandboxie/discussions/2633) +- sbiectrl now uses the new update format when checking for updates ### Fixed - added AppContainer support for Compartment type boxes diff --git a/Sandboxie/apps/control/Updater.cpp b/Sandboxie/apps/control/Updater.cpp index 5c5c8cc3..b47f385d 100644 --- a/Sandboxie/apps/control/Updater.cpp +++ b/Sandboxie/apps/control/Updater.cpp @@ -208,6 +208,20 @@ CleanupExit: } +//--------------------------------------------------------------------------- +// GetJSONObjectSafe +//--------------------------------------------------------------------------- + + +JSONObject GetJSONObjectSafe(const JSONObject& root, const std::wstring& key) +{ + auto I = root.find(key); + if (I == root.end() || !I->second->IsObject()) + return JSONObject(); + return I->second->AsObject(); +} + + //--------------------------------------------------------------------------- // GetJSONStringSafe //--------------------------------------------------------------------------- @@ -236,8 +250,10 @@ BOOLEAN CUpdater::QueryUpdateData(UPDATER_DATA* Context) char* jsonString = NULL; JSONValue* jsonObject = NULL; JSONObject jsonRoot; + JSONObject release; + JSONObject installer; - Path.Format(L"/update.php?software=sandboxie&version=%S&system=windows-%d.%d.%d-%s&language=%d&auto=%s", + Path.Format(L"/update.php?action=update&software=sandboxie&channel=stable&version=%S&system=windows-%d.%d.%d-%s&language=%d&auto=%s", MY_VERSION_STRING, m_osvi.dwMajorVersion, m_osvi.dwMinorVersion, m_osvi.dwBuildNumber, #ifdef _M_ARM64 L"ARM64", @@ -269,11 +285,14 @@ BOOLEAN CUpdater::QueryUpdateData(UPDATER_DATA* Context) Context->userMsg = GetJSONStringSafe(jsonRoot, L"userMsg").c_str(); Context->infoUrl = GetJSONStringSafe(jsonRoot, L"infoUrl").c_str(); - Context->version = GetJSONStringSafe(jsonRoot, L"version").c_str(); + release = GetJSONObjectSafe(jsonRoot, L"release"); + Context->updateMsg = GetJSONStringSafe(release, L"infoMsg").c_str(); + Context->updateUrl = GetJSONStringSafe(release, L"infoUrl").c_str(); + Context->version = GetJSONStringSafe(release, L"version").c_str(); //Context->updated = (uint64_t)jsonRoot[L"updated"]->AsNumber(); - Context->updateMsg = GetJSONStringSafe(jsonRoot, L"updateMsg").c_str(); - Context->updateUrl = GetJSONStringSafe(jsonRoot, L"updateUrl").c_str(); - Context->downloadUrl = GetJSONStringSafe(jsonRoot, L"downloadUrl").c_str(); + + installer = GetJSONObjectSafe(release, L"installer"); + Context->downloadUrl = GetJSONStringSafe(installer, L"downloadUrl").c_str(); success = TRUE;