Browse Source

Replace old malicious explorer URLs if they are found in a config file

pull/112/head
Duke Leto 2 years ago
parent
commit
c3ea342c7c
  1. 11
      src/settings.cpp
  2. 6
      src/settings.h

11
src/settings.cpp

@ -40,9 +40,20 @@ Explorer Settings::getExplorer() {
auto txExplorerUrl = s.value("explorer/txExplorerUrl", explorer + "/tx/").toString(); auto txExplorerUrl = s.value("explorer/txExplorerUrl", explorer + "/tx/").toString();
auto addressExplorerUrl = s.value("explorer/addressExplorerUrl", explorer + "/address/").toString(); auto addressExplorerUrl = s.value("explorer/addressExplorerUrl", explorer + "/address/").toString();
auto testnetTxExplorerUrl = s.value("explorer/testnetTxExplorerUrl").toString(); auto testnetTxExplorerUrl = s.value("explorer/testnetTxExplorerUrl").toString();
auto testnetAddressExplorerUrl = s.value("explorer/testnetAddressExplorerUrl").toString(); auto testnetAddressExplorerUrl = s.value("explorer/testnetAddressExplorerUrl").toString();
// Some users have the old malicious explorer URL saved in their config file, help them out
if (txExplorerUrl == "https://explorer.myhush.org/tx/") {
txExplorerUrl = explorer + "/tx/";
saveExplorer(txExplorerUrl, addressExplorerUrl, testnetTxExplorerUrl, testnetAddressExplorerUrl);
}
if (addressExplorerUrl == "https://explorer.myhush.org/address/") {
addressExplorerUrl = explorer + "/address/";
saveExplorer(txExplorerUrl, addressExplorerUrl, testnetTxExplorerUrl, testnetAddressExplorerUrl);
}
return Explorer{txExplorerUrl, addressExplorerUrl, testnetTxExplorerUrl, testnetAddressExplorerUrl}; return Explorer{txExplorerUrl, addressExplorerUrl, testnetTxExplorerUrl, testnetAddressExplorerUrl};
} }

6
src/settings.h

@ -132,6 +132,7 @@ public:
static double getZboardAmount(); static double getZboardAmount();
static QString getZboardAddr(); static QString getZboardAddr();
//TODO: this could be an advanced setting too
static int getMaxMobileAppTxns() { return 30; } static int getMaxMobileAppTxns() { return 30; }
static bool isValidAddress(QString addr); static bool isValidAddress(QString addr);
@ -162,12 +163,11 @@ private:
bool _isTestnet = false; bool _isTestnet = false;
bool _isSyncing = false; bool _isSyncing = false;
int _blockNumber = 0; int _blockNumber = 0;
int _hushdVersion = 0; int _hushdVersion = 0;
bool _useEmbedded = false; bool _useEmbedded = false;
bool _headless = false; bool _headless = false;
int _peerConnections = 0; int _peerConnections = 0;
double hushPrice = 0.0;
double hushPrice = 0.0;
double fiat_price = 0.0; double fiat_price = 0.0;
unsigned int btcPrice = 0; unsigned int btcPrice = 0;
std::map<QString, double> prices; std::map<QString, double> prices;

Loading…
Cancel
Save