From 6b9c19e019e3953eafea9f68ff2e97192be2bcce Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Tue, 5 Dec 2017 10:52:26 -0500 Subject: [PATCH 01/15] Update LICENSE --- LICENSE-dist.txt | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/LICENSE-dist.txt b/LICENSE-dist.txt index 62b28280..7260a68e 100644 --- a/LICENSE-dist.txt +++ b/LICENSE-dist.txt @@ -180,17 +180,34 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# portaudio +# RtAudio -PortAudio Portable Real-Time Audio Library -Copyright (c) 1999-2011 Ross Bencina and Phil Burk +RtAudio: a set of realtime audio i/o C++ classes +Copyright (c) 2001-2017 Gary P. Scavone -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation files +(the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, +and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. - The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +Any person wishing to distribute modifications to the Software is +asked to send the modifications to the original developer so that +they can be incorporated into the canonical version. This is, +however, not a binding provision of this license. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # RtMidi From a538fad3fc7db27a298146c7bf032d6907510e8a Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Fri, 8 Dec 2017 08:45:04 -0500 Subject: [PATCH 02/15] Add SSL support to curl build --- dep/Makefile | 2 +- src/app.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dep/Makefile b/dep/Makefile index 6f43c97b..68814487 100755 --- a/dep/Makefile +++ b/dep/Makefile @@ -117,7 +117,7 @@ $(libcurl): $(UNTAR) curl-7.56.0.tar.gz cd curl-7.56.0 && ./configure --prefix="$(LOCAL)" \ --disable-ftp --disable-file --disable-ldap --disable-ldaps --disable-rtsp --disable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-manual \ - --without-zlib --without-ssl --without-ca-bundle --without-ca-path --without-ca-fallback --without-libpsl --without-libmetalink --without-libssh2 --without-librtmp --without-winidn --without-libidn2 --without-nghttp2 + --without-zlib --without-ca-bundle --without-ca-fallback --without-libpsl --without-libmetalink --without-libssh2 --without-librtmp --without-winidn --without-libidn2 --without-nghttp2 $(MAKE) -C curl-7.56.0 $(MAKE) -C curl-7.56.0 install diff --git a/src/app.cpp b/src/app.cpp index 8b8bade6..18b07e30 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -10,7 +10,7 @@ std::string gApplicationVersion = #else ""; #endif -std::string gApiHost = "http://api.vcvrack.com"; +std::string gApiHost = "https://api.vcvrack.com"; RackWidget *gRackWidget = NULL; Toolbar *gToolbar = NULL; From e72618ea84153c4533e1c259b4cfa89d136f6d08 Mon Sep 17 00:00:00 2001 From: Jeremy Wentworth Date: Thu, 23 Nov 2017 12:51:01 -0500 Subject: [PATCH 03/15] fixed note off velocity --- src/core/MidiTriggerToCV.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/MidiTriggerToCV.cpp b/src/core/MidiTriggerToCV.cpp index 4bb60020..ec0f11db 100644 --- a/src/core/MidiTriggerToCV.cpp +++ b/src/core/MidiTriggerToCV.cpp @@ -110,7 +110,7 @@ void MIDITriggerToCVInterface::processMidi(std::vector msg) { if (status == 0x8) { // note off for (int i = 0; i < NUM_OUTPUTS; i++) { if (data1 == trigger[i].num) { - trigger[i].val = data2; + trigger[i].val = 0; } } return; From 862d9ed5758f2aba65663100c6c69ed814f5a239 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Sun, 10 Dec 2017 17:19:56 -0500 Subject: [PATCH 04/15] Add Rack version to plugin request --- src/plugin.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugin.cpp b/src/plugin.cpp index ca873ed0..e3adc0a4 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -359,6 +359,7 @@ void pluginRefresh() { downloadName = ""; json_t *reqJ = json_object(); + json_object_set(reqJ, "version", json_string(gApplicationVersion.c_str())); json_object_set(reqJ, "token", json_string(gToken.c_str())); json_t *resJ = requestJson(METHOD_GET, gApiHost + "/purchases", reqJ); json_decref(reqJ); From dc91b5d403fe564f46cd9d7d49f9958952c2c81e Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Mon, 18 Dec 2017 08:59:41 -0500 Subject: [PATCH 05/15] Update plugin manager to new online Rack plugin manager API --- Makefile | 2 +- include/plugin.hpp | 3 +- include/util/request.hpp | 1 + src/app.cpp | 1 + src/app/PluginManagerWidget.cpp | 64 ++++++++-- src/plugin.cpp | 207 +++++++++++++++++++++++--------- src/util/request.cpp | 33 +++++ 7 files changed, 240 insertions(+), 71 deletions(-) diff --git a/Makefile b/Makefile index 4ebc2723..fc24f213 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ ifeq ($(ARCH), lin) LDFLAGS += -rdynamic \ -lpthread -lGL -ldl \ $(shell pkg-config --libs gtk+-2.0) \ - -Ldep/lib -lGLEW -lglfw -ljansson -lsamplerate -lcurl -lzip -lrtaudio -lrtmidi + -Ldep/lib -lGLEW -lglfw -ljansson -lsamplerate -lcurl -lzip -lrtaudio -lrtmidi -lcrypto TARGET = Rack endif diff --git a/include/plugin.hpp b/include/plugin.hpp index bd243473..327249ac 100644 --- a/include/plugin.hpp +++ b/include/plugin.hpp @@ -107,7 +107,8 @@ void pluginInit(); void pluginDestroy(); void pluginLogIn(std::string email, std::string password); void pluginLogOut(); -void pluginRefresh(); +/** Returns whether a new plugin is available, and downloads it unless doing a dry run */ +bool pluginSync(bool dryRun); void pluginCancelDownload(); bool pluginIsLoggedIn(); bool pluginIsDownloading(); diff --git a/include/util/request.hpp b/include/util/request.hpp index d0405155..7ae510c7 100644 --- a/include/util/request.hpp +++ b/include/util/request.hpp @@ -19,5 +19,6 @@ json_t *requestJson(RequestMethod method, std::string url, json_t *dataJ); /** Returns the filename, blank if unsuccessful */ bool requestDownload(std::string url, std::string filename, float *progress); std::string requestEscape(std::string s); +std::string requestSHA256File(std::string filename); } // namespace rack diff --git a/src/app.cpp b/src/app.cpp index 18b07e30..84795945 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -11,6 +11,7 @@ std::string gApplicationVersion = ""; #endif std::string gApiHost = "https://api.vcvrack.com"; +// std::string gApiHost = "http://localhost:8081"; RackWidget *gRackWidget = NULL; Toolbar *gToolbar = NULL; diff --git a/src/app/PluginManagerWidget.cpp b/src/app/PluginManagerWidget.cpp index c246c325..096eb071 100644 --- a/src/app/PluginManagerWidget.cpp +++ b/src/app/PluginManagerWidget.cpp @@ -1,11 +1,57 @@ #include #include "app.hpp" #include "plugin.hpp" +#include "gui.hpp" +#include "../ext/osdialog/osdialog.h" namespace rack { +struct SyncButton : Button { + bool checked = false; + bool available = false; + bool completed = false; + + void step() override { + if (!checked) { + std::thread t([this]() { + if (pluginSync(true)) + available = true; + }); + t.detach(); + checked = true; + } + if (completed) { + if (osdialog_message(OSDIALOG_INFO, OSDIALOG_OK_CANCEL, "All plugins have been updated. Close Rack and re-launch it to load new updates.")) { + guiClose(); + } + completed = false; + } + } + void draw(NVGcontext *vg) override { + Button::draw(vg); + if (available) { + // Notification circle + nvgBeginPath(vg); + nvgCircle(vg, 3, 3, 4.0); + nvgFillColor(vg, nvgRGBf(1.0, 0.0, 0.0)); + nvgFill(vg); + nvgStrokeColor(vg, nvgRGBf(0.5, 0.0, 0.0)); + nvgStroke(vg); + } + } + void onAction(EventAction &e) override { + available = false; + std::thread t([this]() { + if (pluginSync(false)) + completed = true; + }); + t.detach(); + } +}; + + PluginManagerWidget::PluginManagerWidget() { box.size.y = BND_WIDGET_HEIGHT; float margin = 5; @@ -91,19 +137,13 @@ PluginManagerWidget::PluginManagerWidget() { manageWidget->addChild(manageButton); pos.x += manageButton->box.size.x; - struct RefreshButton : Button { - void onAction(EventAction &e) override { - std::thread t(pluginRefresh); - t.detach(); - } - }; pos.x += margin; - Button *refreshButton = new RefreshButton(); - refreshButton->box.pos = pos; - refreshButton->box.size.x = 125; - refreshButton->text = "Refresh plugins"; - manageWidget->addChild(refreshButton); - pos.x += refreshButton->box.size.x; + Button *syncButton = new SyncButton(); + syncButton->box.pos = pos; + syncButton->box.size.x = 125; + syncButton->text = "Update plugins"; + manageWidget->addChild(syncButton); + pos.x += syncButton->box.size.x; struct LogOutButton : Button { void onAction(EventAction &e) override { diff --git a/src/plugin.cpp b/src/plugin.cpp index e3adc0a4..7931efab 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -7,11 +7,12 @@ #include #include // for MAXPATHLEN #include +#include #include #include -#if ARCH_WIN +#if defined(ARCH_WIN) #include #include #define mkdir(_dir, _perms) _mkdir(_dir) @@ -225,35 +226,55 @@ static int extractZip(const char *filename, const char *dir) { return err; } -static void refreshPurchase(json_t *pluginJ) { +static void syncPlugin(json_t *pluginJ) { json_t *slugJ = json_object_get(pluginJ, "slug"); if (!slugJ) return; std::string slug = json_string_value(slugJ); + info("Syncing plugin %s", slug.c_str()); json_t *nameJ = json_object_get(pluginJ, "name"); if (!nameJ) return; std::string name = json_string_value(nameJ); - json_t *versionJ = json_object_get(pluginJ, "version"); - if (!versionJ) return; - std::string version = json_string_value(versionJ); - - // Check whether the plugin is already loaded - for (Plugin *plugin : gPlugins) { - if (plugin->slug == slug && plugin->version == version) { - return; + std::string download; + std::string sha256; + + json_t *downloadsJ = json_object_get(pluginJ, "downloads"); + if (downloadsJ) { +#if defined(ARCH_WIN) + #define DOWNLOADS_ARCH "win" +#elif defined(ARCH_MAC) + #define DOWNLOADS_ARCH "mac" +#elif defined(ARCH_LIN) + #define DOWNLOADS_ARCH "lin" +#endif + json_t *archJ = json_object_get(downloadsJ, DOWNLOADS_ARCH); + if (archJ) { + // Get download URL + json_t *downloadJ = json_object_get(archJ, "download"); + if (downloadJ) + download = json_string_value(downloadJ); + // Get SHA256 hash + json_t *sha256J = json_object_get(archJ, "sha256"); + if (sha256J) + sha256 = json_string_value(sha256J); } } - // Append token and version to download URL - std::string url = gApiHost; - url += "/download"; - url += "?product="; - url += slug; - url += "&version="; - url += requestEscape(gApplicationVersion); - url += "&token="; - url += requestEscape(gToken); + json_t *productIdJ = json_object_get(pluginJ, "productId"); + if (productIdJ) { + download = gApiHost; + download += "/download"; + download += "?slug="; + download += slug; + download += "&token="; + download += requestEscape(gToken); + } + + if (download.empty()) { + warn("Could not get download URL for plugin %s", slug.c_str()); + return; + } // If plugin is not loaded, download the zip file to /plugins downloadName = name; @@ -263,21 +284,127 @@ static void refreshPurchase(json_t *pluginJ) { std::string pluginsDir = assetLocal("plugins"); std::string pluginPath = pluginsDir + "/" + slug; std::string zipPath = pluginPath + ".zip"; - bool success = requestDownload(url, zipPath, &downloadProgress); + bool success = requestDownload(download, zipPath, &downloadProgress); if (success) { + if (!sha256.empty()) { + // Check SHA256 hash + std::string actualSha256 = requestSHA256File(zipPath); + if (actualSha256 != sha256) { + warn("Plugin %s does not match expected SHA256 checksum", slug.c_str()); + return; + } + } + // Unzip file int err = extractZip(zipPath.c_str(), pluginsDir.c_str()); if (!err) { // Delete zip remove(zipPath.c_str()); // Load plugin - loadPlugin(pluginPath); + // loadPlugin(pluginPath); } } downloadName = ""; } +static bool trySyncPlugin(json_t *pluginJ, json_t *communityPluginsJ, bool dryRun) { + std::string slug = json_string_value(pluginJ); + + // Find community plugin + size_t communityIndex; + json_t *communityPluginJ = NULL; + json_array_foreach(communityPluginsJ, communityIndex, communityPluginJ) { + json_t *communitySlugJ = json_object_get(communityPluginJ, "slug"); + if (communitySlugJ) { + std::string communitySlug = json_string_value(communitySlugJ); + if (slug == communitySlug) + break; + } + } + if (communityIndex == json_array_size(communityPluginsJ)) { + warn("Plugin sync error: %s not found in community", slug.c_str()); + return false; + } + + // Get community version + std::string version; + json_t *versionJ = json_object_get(communityPluginJ, "version"); + if (versionJ) { + version = json_string_value(versionJ); + } + + // Check whether we already have a plugin with the same slug and version + for (Plugin *plugin : gPlugins) { + if (plugin->slug == slug) { + // plugin->version might be blank, so adding a version of the manifest will update the plugin + if (plugin->version == version) + return false; + } + } + + if (!dryRun) + syncPlugin(communityPluginJ); + return true; +} + +bool pluginSync(bool dryRun) { + if (gToken.empty()) + return false; + + bool available = false; + + // Download my plugins + json_t *reqJ = json_object(); + json_object_set(reqJ, "version", json_string(gApplicationVersion.c_str())); + json_object_set(reqJ, "token", json_string(gToken.c_str())); + json_t *resJ = requestJson(METHOD_GET, gApiHost + "/plugins", reqJ); + json_decref(reqJ); + + // Download community plugins + json_t *communityResJ = requestJson(METHOD_GET, gApiHost + "/community/plugins", NULL); + + if (!dryRun) { + isDownloading = true; + downloadProgress = 0.0; + downloadName = ""; + } + + if (resJ && communityResJ) { + json_t *errorJ = json_object_get(resJ, "error"); + json_t *communityErrorJ = json_object_get(resJ, "error"); + if (errorJ) { + warn("Plugin sync error: %s", json_string_value(errorJ)); + } + else if (communityErrorJ) { + warn("Plugin sync error: %s", json_string_value(communityErrorJ)); + } + else { + // Check each plugin in list of my plugins + json_t *pluginsJ = json_object_get(resJ, "plugins"); + json_t *communityPluginsJ = json_object_get(communityResJ, "plugins"); + size_t index; + json_t *pluginJ; + json_array_foreach(pluginsJ, index, pluginJ) { + if (trySyncPlugin(pluginJ, communityPluginsJ, dryRun)) + available = true; + } + } + } + + if (resJ) + json_decref(resJ); + + if (communityResJ) + json_decref(communityResJ); + + if (!dryRun) { + isDownloading = false; + } + + return available; +} + //////////////////// // plugin API //////////////////// @@ -306,10 +433,10 @@ void pluginInit() { void pluginDestroy() { for (Plugin *plugin : gPlugins) { // Free library handle -#if ARCH_WIN +#if defined(ARCH_WIN) if (plugin->handle) FreeLibrary((HINSTANCE)plugin->handle); -#elif ARCH_LIN || ARCH_MAC +#elif defined(ARCH_LIN) || defined(ARCH_MAC) if (plugin->handle) dlclose(plugin->handle); #endif @@ -350,40 +477,6 @@ void pluginLogOut() { gToken = ""; } -void pluginRefresh() { - if (gToken.empty()) - return; - - isDownloading = true; - downloadProgress = 0.0; - downloadName = ""; - - json_t *reqJ = json_object(); - json_object_set(reqJ, "version", json_string(gApplicationVersion.c_str())); - json_object_set(reqJ, "token", json_string(gToken.c_str())); - json_t *resJ = requestJson(METHOD_GET, gApiHost + "/purchases", reqJ); - json_decref(reqJ); - - if (resJ) { - json_t *errorJ = json_object_get(resJ, "error"); - if (errorJ) { - const char *errorStr = json_string_value(errorJ); - warn("Plugin refresh error: %s", errorStr); - } - else { - json_t *purchasesJ = json_object_get(resJ, "purchases"); - size_t index; - json_t *purchaseJ; - json_array_foreach(purchasesJ, index, purchaseJ) { - refreshPurchase(purchaseJ); - } - } - json_decref(resJ); - } - - isDownloading = false; -} - void pluginCancelDownload() { // TODO } diff --git a/src/util/request.cpp b/src/util/request.cpp index c046bbb7..2c9ea524 100644 --- a/src/util/request.cpp +++ b/src/util/request.cpp @@ -4,6 +4,7 @@ #include #include #include +#include namespace rack { @@ -130,6 +131,7 @@ bool requestDownload(std::string url, std::string filename, float *progress) { curl_easy_setopt(curl, CURLOPT_WRITEDATA, file); curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, xferInfoCallback); curl_easy_setopt(curl, CURLOPT_XFERINFODATA, progress); + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, true); info("Downloading %s", url.c_str()); CURLcode res = curl_easy_perform(curl); @@ -153,5 +155,36 @@ std::string requestEscape(std::string s) { return ret; } +std::string requestSHA256File(std::string filename) { + FILE *f = fopen(filename.c_str(), "rb"); + if (!f) + return ""; + + uint8_t hash[SHA256_DIGEST_LENGTH]; + SHA256_CTX sha256; + SHA256_Init(&sha256); + const int bufferLen = 1 << 15; + uint8_t *buffer = new uint8_t[bufferLen]; + int len = 0; + while ((len = fread(buffer, 1, bufferLen, f))) { + SHA256_Update(&sha256, buffer, len); + } + SHA256_Final(hash, &sha256); + delete[] buffer; + fclose(f); + + // Convert binary hash to hex + char hashHex[64]; + const char hexTable[] = "0123456789abcdef"; + for (int i = 0; i < SHA256_DIGEST_LENGTH; i++) { + uint8_t h = hash[i]; + hashHex[2*i + 0] = hexTable[h >> 4]; + hashHex[2*i + 1] = hexTable[h & 0x0f]; + } + + std::string str(hashHex, sizeof(hashHex)); + return str; +} + } // namespace rack From 98df3e63aaa1755be6ea2bb407f1b48f660d76ef Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Mon, 18 Dec 2017 09:45:09 -0500 Subject: [PATCH 06/15] Add openssl to build system --- dep/Makefile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dep/Makefile b/dep/Makefile index 68814487..7c3f884e 100755 --- a/dep/Makefile +++ b/dep/Makefile @@ -42,6 +42,7 @@ ifeq ($(ARCH),mac) libzip = lib/libzip.dylib rtmidi = lib/librtmidi.dylib rtaudio = lib/librtaudio.dylib + openssl = lib/libssl.dylib endif ifeq ($(ARCH),win) @@ -112,12 +113,19 @@ $(libsamplerate): $(MAKE) -C libsamplerate-0.1.9/src $(MAKE) -C libsamplerate-0.1.9/src install -$(libcurl): +$(openssl): + $(WGET) https://www.openssl.org/source/openssl-1.1.0g.tar.gz + $(UNTAR) openssl-1.1.0g.tar.gz + cd openssl-1.1.0g && ./config --prefix="$(LOCAL)" + $(MAKE) -C openssl-1.1.0g + $(MAKE) -C openssl-1.1.0g install + +$(libcurl): $(openssl) $(WGET) https://github.com/curl/curl/releases/download/curl-7_56_0/curl-7.56.0.tar.gz $(UNTAR) curl-7.56.0.tar.gz cd curl-7.56.0 && ./configure --prefix="$(LOCAL)" \ --disable-ftp --disable-file --disable-ldap --disable-ldaps --disable-rtsp --disable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-manual \ - --without-zlib --without-ca-bundle --without-ca-fallback --without-libpsl --without-libmetalink --without-libssh2 --without-librtmp --without-winidn --without-libidn2 --without-nghttp2 + --without-zlib --without-ca-bundle --without-ca-fallback --without-libpsl --without-libmetalink --without-libssh2 --without-librtmp --without-winidn --without-libidn2 --without-nghttp2 --with-ssl="$(LOCAL)" $(MAKE) -C curl-7.56.0 $(MAKE) -C curl-7.56.0 install From e042f823b61f1fa4d495ae72832eb3bdb40d64b2 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Mon, 18 Dec 2017 09:51:25 -0500 Subject: [PATCH 07/15] Add -lcrypto to Mac/Windows build --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index fc24f213..3c83b5c9 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ ifeq ($(ARCH), mac) CXXFLAGS += -DAPPLE -stdlib=libc++ LDFLAGS += -stdlib=libc++ -lpthread -ldl \ -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo \ - -Ldep/lib -lGLEW -lglfw -ljansson -lsamplerate -lcurl -lzip -lrtaudio -lrtmidi + -Ldep/lib -lGLEW -lglfw -ljansson -lsamplerate -lcurl -lzip -lrtaudio -lrtmidi -lcrypto TARGET = Rack BUNDLE = dist/$(TARGET).app endif @@ -34,7 +34,7 @@ ifeq ($(ARCH), win) -Wl,--export-all-symbols,--out-implib,libRack.a -mwindows \ -lgdi32 -lopengl32 -lcomdlg32 -lole32 \ -Ldep/lib -lglew32 -lglfw3dll -lcurl -lzip -lrtaudio -lrtmidi \ - -Wl,-Bstatic -ljansson -lsamplerate + -Wl,-Bstatic -ljansson -lsamplerate -lcrypto TARGET = Rack.exe OBJECTS = Rack.res endif From 1b44985a0fde2cea64d963f96c5d6d33798cd961 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Mon, 18 Dec 2017 15:34:38 -0500 Subject: [PATCH 08/15] Add CKSSThree switch, ENUMS macro --- include/components.hpp | 8 + include/util.hpp | 10 + res/ComponentLibrary/CKSSThree_0.svg | 321 ++++++++++++++++++++++++++ res/ComponentLibrary/CKSSThree_1.svg | 322 +++++++++++++++++++++++++++ res/ComponentLibrary/CKSSThree_2.svg | 322 +++++++++++++++++++++++++++ 5 files changed, 983 insertions(+) create mode 100644 res/ComponentLibrary/CKSSThree_0.svg create mode 100644 res/ComponentLibrary/CKSSThree_1.svg create mode 100644 res/ComponentLibrary/CKSSThree_2.svg diff --git a/include/components.hpp b/include/components.hpp index c300e44b..6e4807c3 100644 --- a/include/components.hpp +++ b/include/components.hpp @@ -461,6 +461,14 @@ struct CKSS : SVGSwitch, ToggleSwitch { } }; +struct CKSSThree : SVGSwitch, ToggleSwitch { + CKSSThree() { + addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKSSThree_0.svg"))); + addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKSSThree_1.svg"))); + addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKSSThree_2.svg"))); + } +}; + struct CKD6 : SVGSwitch, MomentarySwitch { CKD6() { addFrame(SVG::load(assetGlobal("res/ComponentLibrary/CKD6_0.svg"))); diff --git a/include/util.hpp b/include/util.hpp index f7e4732a..3e7b53dc 100644 --- a/include/util.hpp +++ b/include/util.hpp @@ -30,6 +30,16 @@ will expand to #define LENGTHOF(arr) (sizeof(arr) / sizeof((arr)[0])) +/** Reserve space for _count enums starting with _name. +Example: + enum Foo { + ENUMS(BAR, 14) + }; + + BAR + 0 to BAR + 11 is reserved +*/ +#define ENUMS(_name, _count) _name, _name ## _LAST = _name + (_count) - 1 + /** Deprecation notice for GCC */ #define DEPRECATED __attribute__ ((deprecated)) diff --git a/res/ComponentLibrary/CKSSThree_0.svg b/res/ComponentLibrary/CKSSThree_0.svg new file mode 100644 index 00000000..a8283517 --- /dev/null +++ b/res/ComponentLibrary/CKSSThree_0.svg @@ -0,0 +1,321 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/res/ComponentLibrary/CKSSThree_1.svg b/res/ComponentLibrary/CKSSThree_1.svg new file mode 100644 index 00000000..46656fcf --- /dev/null +++ b/res/ComponentLibrary/CKSSThree_1.svg @@ -0,0 +1,322 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/res/ComponentLibrary/CKSSThree_2.svg b/res/ComponentLibrary/CKSSThree_2.svg new file mode 100644 index 00000000..cbfd986b --- /dev/null +++ b/res/ComponentLibrary/CKSSThree_2.svg @@ -0,0 +1,322 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + From 9b6c04f3014bffc80fd186c3d00e722caea1265c Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Mon, 18 Dec 2017 15:51:51 -0500 Subject: [PATCH 09/15] Update Mac make dist --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 3c83b5c9..ee75ac3c 100644 --- a/Makefile +++ b/Makefile @@ -106,9 +106,9 @@ ifeq ($(ARCH), mac) cp dep/lib/libsamplerate.0.dylib $(BUNDLE)/Contents/MacOS/ cp dep/lib/libcurl.4.dylib $(BUNDLE)/Contents/MacOS/ cp dep/lib/libzip.5.dylib $(BUNDLE)/Contents/MacOS/ - cp dep/lib/libportaudio.2.dylib $(BUNDLE)/Contents/MacOS/ + cp dep/lib/librtaudio.dylib $(BUNDLE)/Contents/MacOS/ cp dep/lib/librtmidi.4.dylib $(BUNDLE)/Contents/MacOS/ - cp dep/lib/librtaudio.6.dylib $(BUNDLE)/Contents/MacOS/ + cp dep/lib/libcrypto.1.1.dylib $(BUNDLE)/Contents/MacOS/ install_name_tool -change /usr/local/lib/libGLEW.2.1.0.dylib @executable_path/libGLEW.2.1.0.dylib $(BUNDLE)/Contents/MacOS/Rack install_name_tool -change lib/libglfw.3.dylib @executable_path/libglfw.3.dylib $(BUNDLE)/Contents/MacOS/Rack @@ -116,9 +116,9 @@ ifeq ($(ARCH), mac) install_name_tool -change $(PWD)/dep/lib/libsamplerate.0.dylib @executable_path/libsamplerate.0.dylib $(BUNDLE)/Contents/MacOS/Rack install_name_tool -change $(PWD)/dep/lib/libcurl.4.dylib @executable_path/libcurl.4.dylib $(BUNDLE)/Contents/MacOS/Rack install_name_tool -change $(PWD)/dep/lib/libzip.5.dylib @executable_path/libzip.5.dylib $(BUNDLE)/Contents/MacOS/Rack - install_name_tool -change $(PWD)/dep/lib/libportaudio.2.dylib @executable_path/libportaudio.2.dylib $(BUNDLE)/Contents/MacOS/Rack + install_name_tool -change librtaudio.dylib @executable_path/librtaudio.dylib $(BUNDLE)/Contents/MacOS/Rack install_name_tool -change $(PWD)/dep/lib/librtmidi.4.dylib @executable_path/librtmidi.4.dylib $(BUNDLE)/Contents/MacOS/Rack - install_name_tool -change $(PWD)/dep/lib/librtaudio.6.dylib @executable_path/librtaudio.6.dylib $(BUNDLE)/Contents/MacOS/Rack + install_name_tool -change $(PWD)/dep/lib/libcrypto.1.1.dylib @executable_path/libcrypto.1.1.dylib $(BUNDLE)/Contents/MacOS/Rack otool -L $(BUNDLE)/Contents/MacOS/Rack From a2d815db8465e05e46eb7008b46ddfcb7aee6481 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Tue, 19 Dec 2017 03:51:55 -0500 Subject: [PATCH 10/15] Leave Add Module popup metadata window open after mouse leaves module section --- src/app/AddModuleWindow.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/app/AddModuleWindow.cpp b/src/app/AddModuleWindow.cpp index 48f2d91d..ac99389e 100644 --- a/src/app/AddModuleWindow.cpp +++ b/src/app/AddModuleWindow.cpp @@ -70,7 +70,7 @@ struct MetadataMenu : ListMenu { // Plugin metadata if (!model->plugin->website.empty()) { - addChild(construct(&MenuEntry::text, "Website", &UrlItem::url, model->plugin->path)); + addChild(construct(&MenuEntry::text, "Website", &UrlItem::url, model->plugin->website)); } if (!model->plugin->manual.empty()) { addChild(construct(&MenuEntry::text, "Manual", &UrlItem::url, model->plugin->manual)); @@ -120,10 +120,6 @@ struct ModelItem : MenuItem { sModel = model; MenuItem::onMouseEnter(e); } - void onMouseLeave(EventMouseLeave &e) override { - sModel = NULL; - MenuItem::onMouseLeave(e); - } }; From d558f1d316711f69aa6c53c43fccd885328fee95 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Tue, 19 Dec 2017 04:55:00 -0500 Subject: [PATCH 11/15] Fix Windows build --- dep/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dep/Makefile b/dep/Makefile index 7c3f884e..485b13e6 100755 --- a/dep/Makefile +++ b/dep/Makefile @@ -53,7 +53,8 @@ ifeq ($(ARCH),win) libcurl = bin/libcurl-4.dll libzip = bin/libzip-5.dll rtmidi = bin/librtmidi-4.dll - rtaudio = bin/librtaudio-6.dll + rtaudio = bin/librtaudio.dll + openssl = bin/libssl-1_1-x64.dll endif # Library configuration From e2239bcc6dc6625c76d91aff036b1ffca4428922 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Tue, 19 Dec 2017 05:38:53 -0500 Subject: [PATCH 12/15] Disable SSL cert verification, add openssl dlls to Windows build --- Makefile | 2 ++ dep/Makefile | 3 ++- src/util/request.cpp | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ee75ac3c..b4c75ff5 100644 --- a/Makefile +++ b/Makefile @@ -145,6 +145,8 @@ ifeq ($(ARCH), win) cp dep/bin/libsamplerate-0.dll dist/Rack/ cp dep/bin/libzip-5.dll dist/Rack/ cp dep/bin/librtaudio.dll dist/Rack/ + cp dep/bin/libcrypto-1_1-x64.dll dist/Rack/ + cp dep/bin/libssl-1_1-x64.dll dist/Rack/ mkdir -p dist/Rack/plugins cp -R plugins/Fundamental/dist/Fundamental dist/Rack/plugins/ # Make ZIP diff --git a/dep/Makefile b/dep/Makefile index 485b13e6..de3b1915 100755 --- a/dep/Makefile +++ b/dep/Makefile @@ -126,7 +126,8 @@ $(libcurl): $(openssl) $(UNTAR) curl-7.56.0.tar.gz cd curl-7.56.0 && ./configure --prefix="$(LOCAL)" \ --disable-ftp --disable-file --disable-ldap --disable-ldaps --disable-rtsp --disable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-manual \ - --without-zlib --without-ca-bundle --without-ca-fallback --without-libpsl --without-libmetalink --without-libssh2 --without-librtmp --without-winidn --without-libidn2 --without-nghttp2 --with-ssl="$(LOCAL)" + --without-zlib --without-libpsl --without-libmetalink --without-libssh2 --without-librtmp --without-winidn --without-libidn2 --without-nghttp2 \ + --without-ca-bundle --with-ca-fallback --with-ssl="$(LOCAL)" $(MAKE) -C curl-7.56.0 $(MAKE) -C curl-7.56.0 install diff --git a/src/util/request.cpp b/src/util/request.cpp index 2c9ea524..72702c04 100644 --- a/src/util/request.cpp +++ b/src/util/request.cpp @@ -80,6 +80,7 @@ json_t *requestJson(RequestMethod method, std::string url, json_t *dataJ) { curl_easy_setopt(curl, CURLOPT_POSTFIELDS, reqStr); std::string resText; + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeStringCallback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &resText); @@ -132,6 +133,7 @@ bool requestDownload(std::string url, std::string filename, float *progress) { curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, xferInfoCallback); curl_easy_setopt(curl, CURLOPT_XFERINFODATA, progress); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, true); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false); info("Downloading %s", url.c_str()); CURLcode res = curl_easy_perform(curl); From 85a5ed46db7f6c93c3f0e172932d00766d7d9480 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Tue, 19 Dec 2017 05:55:09 -0500 Subject: [PATCH 13/15] Add openssl to Linux build --- dep/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/dep/Makefile b/dep/Makefile index 7c3f884e..620972d9 100755 --- a/dep/Makefile +++ b/dep/Makefile @@ -31,6 +31,7 @@ ifeq ($(ARCH),lin) libzip = lib/libzip.so rtmidi = lib/librtmidi.so rtaudio = lib/librtaudio.so + openssl = lib/libssl.so endif ifeq ($(ARCH),mac) From 2dabf2a9c7af12e8603b397533a61739986ba0f8 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Tue, 19 Dec 2017 05:56:25 -0500 Subject: [PATCH 14/15] Add openssl to Linux dist --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index ee75ac3c..7728476d 100644 --- a/Makefile +++ b/Makefile @@ -165,6 +165,8 @@ ifeq ($(ARCH), lin) cp dep/lib/libzip.so.5 dist/Rack/ cp dep/lib/librtaudio.so dist/Rack/ cp dep/lib/librtmidi.so.4 dist/Rack/ + cp dep/lib/libssl.so.1.1 dist/Rack/ + cp dep/lib/libcrypto.so.1.1 dist/Rack/ mkdir -p dist/Rack/plugins cp -R plugins/Fundamental/dist/Fundamental dist/Rack/plugins/ # Make ZIP From 2c17b654afc7e5c6e8e70f41df9dd3f8ad9dde24 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Tue, 19 Dec 2017 06:11:54 -0500 Subject: [PATCH 15/15] Add -lssl to Linux build --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f5d816ee..7bc2b92e 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ ifeq ($(ARCH), lin) LDFLAGS += -rdynamic \ -lpthread -lGL -ldl \ $(shell pkg-config --libs gtk+-2.0) \ - -Ldep/lib -lGLEW -lglfw -ljansson -lsamplerate -lcurl -lzip -lrtaudio -lrtmidi -lcrypto + -Ldep/lib -lGLEW -lglfw -ljansson -lsamplerate -lcurl -lzip -lrtaudio -lrtmidi -lcrypto -lssl TARGET = Rack endif