Browse Source

Add verifyHttpsCerts setting to disable verifying HTTPS certificates.

tags/v2.5.0
Andrew Belt 11 months ago
parent
commit
859cf1b484
3 changed files with 13 additions and 0 deletions
  1. +1
    -0
      include/settings.hpp
  2. +5
    -0
      src/network.cpp
  3. +7
    -0
      src/settings.cpp

+ 1
- 0
include/settings.hpp View File

@@ -78,6 +78,7 @@ extern bool skipLoadOnLaunch;
extern std::list<std::string> recentPatchPaths; extern std::list<std::string> recentPatchPaths;
extern std::vector<NVGcolor> cableColors; extern std::vector<NVGcolor> cableColors;
extern bool autoCheckUpdates; extern bool autoCheckUpdates;
extern bool verifyHttpsCerts;
extern bool showTipsOnLaunch; extern bool showTipsOnLaunch;
extern int tipIndex; extern int tipIndex;
enum BrowserSort { enum BrowserSort {


+ 5
- 0
src/network.cpp View File

@@ -7,6 +7,7 @@
#include <network.hpp> #include <network.hpp>
#include <system.hpp> #include <system.hpp>
#include <asset.hpp> #include <asset.hpp>
#include <settings.hpp>




namespace rack { namespace rack {
@@ -35,9 +36,13 @@ static CURL* createCurl() {
// So tell curl not to signal. // So tell curl not to signal.
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1); curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);


// Load root certificates
std::string caPath = asset::system("cacert.pem"); std::string caPath = asset::system("cacert.pem");
curl_easy_setopt(curl, CURLOPT_CAINFO, caPath.c_str()); curl_easy_setopt(curl, CURLOPT_CAINFO, caPath.c_str());


// Don't verify HTTPS certificates if verifyHttpsCerts is false
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, settings::verifyHttpsCerts);

return curl; return curl;
} }




+ 7
- 0
src/settings.cpp View File

@@ -61,6 +61,7 @@ std::vector<NVGcolor> cableColors = {
color::fromHexString("#8b4ade"), // purple color::fromHexString("#8b4ade"), // purple
}; };
bool autoCheckUpdates = true; bool autoCheckUpdates = true;
bool verifyHttpsCerts = true;
bool showTipsOnLaunch = true; bool showTipsOnLaunch = true;
int tipIndex = -1; int tipIndex = -1;
BrowserSort browserSort = BROWSER_SORT_UPDATED; BrowserSort browserSort = BROWSER_SORT_UPDATED;
@@ -187,6 +188,8 @@ json_t* toJson() {


json_object_set_new(rootJ, "autoCheckUpdates", json_boolean(autoCheckUpdates)); json_object_set_new(rootJ, "autoCheckUpdates", json_boolean(autoCheckUpdates));


json_object_set_new(rootJ, "verifyHttpsCerts", json_boolean(verifyHttpsCerts));

json_object_set_new(rootJ, "showTipsOnLaunch", json_boolean(showTipsOnLaunch)); json_object_set_new(rootJ, "showTipsOnLaunch", json_boolean(showTipsOnLaunch));


json_object_set_new(rootJ, "tipIndex", json_integer(tipIndex)); json_object_set_new(rootJ, "tipIndex", json_integer(tipIndex));
@@ -411,6 +414,10 @@ void fromJson(json_t* rootJ) {
if (autoCheckUpdatesJ) if (autoCheckUpdatesJ)
autoCheckUpdates = json_boolean_value(autoCheckUpdatesJ); autoCheckUpdates = json_boolean_value(autoCheckUpdatesJ);


json_t* verifyHttpsCertsJ = json_object_get(rootJ, "verifyHttpsCerts");
if (verifyHttpsCertsJ)
verifyHttpsCerts = json_boolean_value(verifyHttpsCertsJ);

json_t* showTipsOnLaunchJ = json_object_get(rootJ, "showTipsOnLaunch"); json_t* showTipsOnLaunchJ = json_object_get(rootJ, "showTipsOnLaunch");
if (showTipsOnLaunchJ) if (showTipsOnLaunchJ)
showTipsOnLaunch = json_boolean_value(showTipsOnLaunchJ); showTipsOnLaunch = json_boolean_value(showTipsOnLaunchJ);


Loading…
Cancel
Save