From 8d911c559eec54323310bf7d361605dfd3ccfca1 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Mon, 25 Oct 2021 14:28:05 -0400 Subject: [PATCH] Log edition name instead of abbreviation in standalone adapter. --- adapters/standalone.cpp | 2 +- src/library.cpp | 15 ++++++++++++--- src/network.cpp | 2 ++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/adapters/standalone.cpp b/adapters/standalone.cpp index 45135a52..535a6f9c 100644 --- a/adapters/standalone.cpp +++ b/adapters/standalone.cpp @@ -128,7 +128,7 @@ int main(int argc, char* argv[]) { } // Log environment - INFO("%s %s v%s", APP_NAME.c_str(), APP_EDITION.c_str(), APP_VERSION.c_str()); + INFO("%s %s v%s", APP_NAME.c_str(), APP_EDITION_NAME.c_str(), APP_VERSION.c_str()); INFO("%s", system::getOperatingSystemInfo().c_str()); std::string argsList; for (int i = 0; i < argc; i++) { diff --git a/src/library.cpp b/src/library.cpp index 5851cd9e..4ad07da2 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -154,6 +154,15 @@ void checkUpdates() { updateStatus = "Querying for updates..."; + // Check user token + std::string userUrl = API_URL + "/user"; + json_t* userResJ = network::requestJson(network::METHOD_GET, userUrl, NULL, getTokenCookies()); + if (!userResJ) { + DEBUG("User failed"); + return; + } + DEFER({json_decref(userResJ);}); + // Get user's plugins list std::string pluginsUrl = API_URL + "/plugins"; json_t* pluginsResJ = network::requestJson(network::METHOD_GET, pluginsUrl, NULL, getTokenCookies()); @@ -219,9 +228,9 @@ void checkUpdates() { } update.version = json_string_value(versionJ); // Reject plugins with ABI mismatch - // if (!string::startsWith(update.version, APP_VERSION_MAJOR + ".")) { - // continue; - // } + if (!string::startsWith(update.version, APP_VERSION_MAJOR + ".")) { + continue; + } // Check if update is needed plugin::Plugin* p = plugin::getPlugin(slug); diff --git a/src/network.cpp b/src/network.cpp index a50d7b81..4ff4fc04 100644 --- a/src/network.cpp +++ b/src/network.cpp @@ -138,6 +138,8 @@ json_t* requestJson(Method method, const std::string& url, json_t* dataJ, const curl_easy_cleanup(curl); curl_slist_free_all(headers); + DEBUG("response: %s", resText.c_str()); + if (res != CURLE_OK) { WARN("Could not request %s: %s", urlS.c_str(), curl_easy_strerror(res)); return NULL;