From bd9363d05128067f3f41bd08e0c0fe0e9c54327b Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Mon, 25 Oct 2021 13:46:20 -0400 Subject: [PATCH 1/3] Change default manifest version in helper.py to 2.0.0. --- helper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helper.py b/helper.py index 3792f51a..5ca352d7 100755 --- a/helper.py +++ b/helper.py @@ -169,7 +169,7 @@ def create_manifest(slug, plugin_dir="."): # Query manifest information manifest['name'] = input_default("Plugin name", manifest.get('name', slug)) - manifest['version'] = input_default("Version", manifest.get('version', "1.0.0")) + manifest['version'] = input_default("Version", manifest.get('version', "2.0.0")) manifest['license'] = input_default("License (if open-source, use license identifier from https://spdx.org/licenses/)", manifest.get('license', "proprietary")) manifest['brand'] = input_default("Brand (prefix for all module names)", manifest.get('brand', manifest['name'])) manifest['author'] = input_default("Author", manifest.get('author', "")) From 8d911c559eec54323310bf7d361605dfd3ccfca1 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Mon, 25 Oct 2021 14:28:05 -0400 Subject: [PATCH 2/3] 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; From 8de2c36de30c34800673ed421343c05e295c0aa2 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Mon, 25 Oct 2021 17:05:11 -0400 Subject: [PATCH 3/3] Add Window::activateContext(). --- include/window/Window.hpp | 1 + src/window/Window.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/include/window/Window.hpp b/include/window/Window.hpp index 36861762..6302b9bb 100644 --- a/include/window/Window.hpp +++ b/include/window/Window.hpp @@ -71,6 +71,7 @@ struct Window { void setSize(math::Vec size); void run(); void step(); + void activateContext(); /** Takes a screenshot of the screen and saves it to a PNG file. */ void screenshot(const std::string& screenshotPath); /** Saves a PNG image of all modules to `screenshotsDir//.png`. diff --git a/src/window/Window.cpp b/src/window/Window.cpp index fc1fc387..b189cdce 100644 --- a/src/window/Window.cpp +++ b/src/window/Window.cpp @@ -517,6 +517,11 @@ void Window::step() { } +void Window::activateContext() { + glfwMakeContextCurrent(win); +} + + static void flipBitmap(uint8_t* pixels, int width, int height, int depth) { for (int y = 0; y < height / 2; y++) { int flipY = height - y - 1;