From f9f88c6a6650da30b162af20a19ebbd3bf636f43 Mon Sep 17 00:00:00 2001 From: Duke Date: Sat, 17 Dec 2022 06:50:18 -0800 Subject: [PATCH] Disable price feed by default Also prevent price fetching when disabled. As far as I can tell, disabling the price feed never worked. The option for disabling the price feed was only used in rendering the GUI checkbox for price fetching, but the price feed requests would always happen. --- src/rpc.cpp | 7 ++++++- src/settings.cpp | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/rpc.cpp b/src/rpc.cpp index af062aa..5a1b5cc 100644 --- a/src/rpc.cpp +++ b/src/rpc.cpp @@ -1363,6 +1363,12 @@ void RPC::refreshPrice() { if (conn == nullptr) return noConnection(); + auto s = Settings::getInstance(); + + if (s->getAllowFetchPrices() == false) { + qDebug() << "Price fetching disabled"; + return; + } QString price_feed = "https://api.coingecko.com/api/v3/simple/price?ids=hush&vs_currencies=btc%2Cusd%2Ceur%2Ceth%2Cgbp%2Ccny%2Cjpy%2Cidr%2Crub%2Ccad%2Csgd%2Cchf%2Cinr%2Caud%2Cinr%2Ckrw%2Cthb%2Cnzd%2Czar%2Cvef%2Cxau%2Cxag%2Cvnd%2Csar%2Ctwd%2Caed%2Cars%2Cbdt%2Cbhd%2Cbmd%2Cbrl%2Cclp%2Cczk%2Cdkk%2Chuf%2Cils%2Ckwd%2Clkr%2Cpkr%2Cnok%2Ctry%2Csek%2Cmxn%2Cuah%2Chkd&include_market_cap=true&include_24hr_vol=true&include_24hr_change=true"; qDebug() << "Requesting price feed data via " << price_feed; @@ -1376,7 +1382,6 @@ void RPC::refreshPrice() { QNetworkReply *reply = conn->restclient->get(req); qDebug() << "Created QNetworkReply"; - auto s = Settings::getInstance(); QObject::connect(reply, &QNetworkReply::finished, [=] { reply->deleteLater(); diff --git a/src/settings.cpp b/src/settings.cpp index 84c5394..e3fd871 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -25,7 +25,8 @@ void Settings::setCheckForUpdates(bool allow) { } bool Settings::getAllowFetchPrices() { - return QSettings().value("options/allowfetchprices", true).toBool(); + // now defaults to OFF, used to be ON + return QSettings().value("options/allowfetchprices", false).toBool(); } void Settings::setAllowFetchPrices(bool allow) {