From eb831a1e69cbed16e656fd7877f3544a1f442bc0 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Fri, 26 Feb 2021 13:40:25 -0500 Subject: [PATCH 01/13] Use only 4 cores for now to prevent running out of RAM --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index de066b6..3476061 100755 --- a/build.sh +++ b/build.sh @@ -4,7 +4,7 @@ UNAME=$(uname) if [ "$UNAME" == "Linux" ] ; then - JOBS=$(nproc) + JOBS=4 elif [ "$UNAME" == "FreeBSD" ] ; then JOBS=$(nproc) elif [ "$UNAME" == "Darwin" ] ; then From eeba8ec9dabdb6e148bf9f4177bc38a5514ccabd Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Fri, 26 Feb 2021 13:41:04 -0500 Subject: [PATCH 02/13] convert to git.hush.is --- lib/Cargo.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Cargo.lock b/lib/Cargo.lock index 03fad9d..79fb276 100644 --- a/lib/Cargo.lock +++ b/lib/Cargo.lock @@ -1192,7 +1192,7 @@ dependencies = [ "blake3 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", - "silentdragonlitelib 0.1.0 (git+https://github.com/MyHush/silentdragonlite-cli?rev=8535a11e3774d79de2ebeaa5540567ccb4988f81)", + "silentdragonlitelib 0.1.0 (git+https://git.hush.is/hush/silentdragonlite-cli?rev=8535a11e3774d79de2ebeaa5540567ccb4988f81)", ] [[package]] @@ -1655,7 +1655,7 @@ dependencies = [ [[package]] name = "silentdragonlitelib" version = "0.1.0" -source = "git+https://github.com/MyHush/silentdragonlite-cli?rev=8535a11e3774d79de2ebeaa5540567ccb4988f81#8535a11e3774d79de2ebeaa5540567ccb4988f81" +source = "git+https://git.hush.is/hush/silentdragonlite-cli?rev=8535a11e3774d79de2ebeaa5540567ccb4988f81#8535a11e3774d79de2ebeaa5540567ccb4988f81" dependencies = [ "base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "bellman 0.1.0 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)", @@ -2672,7 +2672,7 @@ dependencies = [ "checksum serde_yaml 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)" = "691b17f19fc1ec9d94ec0b5864859290dff279dbd7b03f017afda54eb36c3c35" "checksum sha2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "27044adfd2e1f077f649f59deb9490d3941d674002f7d062870a60ebe9bd47a0" "checksum signal-hook-registry 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94f478ede9f64724c5d173d7bb56099ec3e2d9fc2774aac65d34b8b890405f41" -"checksum silentdragonlitelib 0.1.0 (git+https://github.com/MyHush/silentdragonlite-cli?rev=8535a11e3774d79de2ebeaa5540567ccb4988f81)" = "" +"checksum silentdragonlitelib 0.1.0 (git+https://git.hush.is/hush/silentdragonlite-cli?rev=8535a11e3774d79de2ebeaa5540567ccb4988f81)" = "" "checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" "checksum smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6" "checksum socket2 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "e8b74de517221a2cb01a53349cf54182acdc31a074727d3079068448c0676d85" From 0bede7d2021e2e61d961ba0145c3ac0f63d6f1ed Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Sat, 10 Apr 2021 02:22:30 -0400 Subject: [PATCH 03/13] translations --- res/silentdragonlite_be.ts | 4 ++-- res/silentdragonlite_ru.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/res/silentdragonlite_be.ts b/res/silentdragonlite_be.ts index 2c6c070..5f84530 100644 --- a/res/silentdragonlite_be.ts +++ b/res/silentdragonlite_be.ts @@ -832,8 +832,8 @@ p, li { white-space: pre-wrap; } Ctrl+P - &Hush Discord - &Hush Discord + &Hush Telegram + &Hush Telegram diff --git a/res/silentdragonlite_ru.ts b/res/silentdragonlite_ru.ts index 92fe8d2..46ce90b 100644 --- a/res/silentdragonlite_ru.ts +++ b/res/silentdragonlite_ru.ts @@ -559,8 +559,8 @@ p, li { white-space: pre-wrap; } Повторное сканирование - &Hush Discord - &Hush Discord + &Hush Telegram + &Hush Telegram From 3149f04fc16cfa4c4a065d471beab8bcc3d1500a Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Sat, 10 Apr 2021 02:22:42 -0400 Subject: [PATCH 04/13] . --- build.sh | 2 +- src/connection.cpp | 8 +++--- src/settings.cpp | 66 ++++++++++++++++++++++++++++++++++++---------- src/settings.h | 2 ++ 4 files changed, 58 insertions(+), 20 deletions(-) diff --git a/build.sh b/build.sh index 3476061..9a8211c 100755 --- a/build.sh +++ b/build.sh @@ -4,7 +4,7 @@ UNAME=$(uname) if [ "$UNAME" == "Linux" ] ; then - JOBS=4 + JOBS=2 elif [ "$UNAME" == "FreeBSD" ] ; then JOBS=$(nproc) elif [ "$UNAME" == "Darwin" ] ; then diff --git a/src/connection.cpp b/src/connection.cpp index 94022e0..98f3637 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -32,7 +32,7 @@ ConnectionLoader::ConnectionLoader(MainWindow* main, Controller* rpc) connD->setupUi(d); auto theme = Settings::getInstance()->get_theme_name(); - qDebug() << theme << "theme has loaded"; + qDebug() << theme << "theme " << theme << " has loaded"; auto size = QSize(512,512); if (theme == "Dark" || theme == "Midnight") { @@ -146,8 +146,7 @@ void ConnectionLoader::doAutoConnect() main->logger->write(QObject::tr("Attempting to initialize library with ") + config->server); // Check to see if there's an existing wallet - if (litelib_wallet_exists(Settings::getDefaultChainName().toStdString().c_str())) - { + if (litelib_wallet_exists(Settings::getDefaultChainName().toStdString().c_str())) { main->logger->write(QObject::tr("Using existing wallet.")); char* resp = litelib_initialize_existing( config->dangerous, @@ -155,8 +154,7 @@ void ConnectionLoader::doAutoConnect() ); QString response = litelib_process_response(resp); - if (response.toUpper().trimmed() != "OK") - { + if (response.toUpper().trimmed() != "OK") { showError(response); return; } diff --git a/src/settings.cpp b/src/settings.cpp index a78880b..a97f71e 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -3,6 +3,7 @@ #include "mainwindow.h" #include "settings.h" #include "camount.h" +#include "../lib/silentdragonlitelib.h" Settings* Settings::instance = nullptr; @@ -18,26 +19,41 @@ Settings* Settings::getInstance() { } Config Settings::getSettings() { + qDebug() << __func__; // Load from the QT Settings. QSettings s; // this domain is stolen and malicious! auto malicious = "https://lite.myhush.org"; auto server = s.value("connection/server").toString(); - if(server == malicious) { - server = "https://lite.hush.is"; - qDebug() << "Replacing malicious SDL server with " << server; + bool torOnly = s.value("connectoin/torOnly").toBool(); + + // default behavior is no server listed in conf, and randomly choose from those listed in code + if (server.trimmed().isEmpty()) { + server = Settings::getRandomServer(); + } + + // make sure existing server in conf is alive, otherwise choose random one + char* resp = litelib_initialize_existing(false, server.toStdString().c_str()); + QString response = litelib_process_response(resp); + + // if we see a valid connection, return this server + if (response.toUpper().trimmed() != "OK") { + qDebug() << "Lite server in conf " << server << " is down, getting a random one"; + server = Settings::getRandomServer(); s.setValue("connection/server", server); - s.sync(); - // re-init to load correct settings - init(); } - if (server.trimmed().isEmpty()) { - server = Settings::getDefaultServer(); + // Users that have old configs generated from old SDLs will have this hostname + if(server == malicious) { + qDebug() << "Replacing malicious SDL server with " << server; + s.setValue("connection/server", server); } + s.sync(); + // re-init to load correct settings + init(); - return Config{server}; + return Config{server, torOnly}; } void Settings::saveSettings(const QString& server) { @@ -250,9 +266,7 @@ void Settings::set_theme_name(QString theme_name) { QSettings().setValue("options/theme_name", theme_name); } -//================================= // Static Stuff -//================================= void Settings::saveRestore(QDialog* d) { d->restoreGeometry(QSettings().value(d->objectName() % "geometry").toByteArray()); @@ -271,6 +285,7 @@ void Settings::saveRestoreTableHeader(QTableView* table, QDialog* d, QString tab } QString Settings::getRandomServer() { + qDebug() << __func__; // we don't need cryptographic random-ness, but we want // clients to never get "stuck" with the same server, which // prevents various attacks @@ -278,12 +293,35 @@ QString Settings::getRandomServer() { //TODO: This should be a much larger list which we randomly choose from servers[0] = "https://lite.hush.is"; servers[1] = "https://devo.crabdance.com"; - //servers[2] = "https://hush.leto.net:5420"; - int x = rand() % 2; - return servers[x]; + servers[2] = "https://bies.xyz"; + servers[3] = "https://hush.leto.net"; + servers[4] = "https://milktoast.attackingzcash.com"; + + // start at a random place in the list + int x = rand() % servers.size(); + auto server = servers[x]; + int tries = 0; + + // We try every server,in order, starting from a random place in the list + while (tries <= servers.size() ) { + qDebug() << "Checking if lite server " << server << " is a alive, try=" << tries; + char* resp = litelib_initialize_existing(false, server.toStdString().c_str()); + QString response = litelib_process_response(resp); + + // if we see a valid connection, return this server + if (response.toUpper().trimmed() == "OK") { + qDebug() << "Choosing lite server " << server; + return server; + } + server = servers[++x % servers.size()]; + + tries++; + } + return server; } QString Settings::getDefaultServer() { + qDebug() << __func__; return "https://lite.hush.is"; } diff --git a/src/settings.h b/src/settings.h index e4c8673..2c536f4 100644 --- a/src/settings.h +++ b/src/settings.h @@ -9,7 +9,9 @@ using json = nlohmann::json; struct Config { + // The randomly chosen server we are talking to OR user-specific server QString server; + bool torOnly {false}; }; struct ToFields; From cb843addd87359900fced34fe04ef6432b49943a Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Sat, 10 Apr 2021 09:36:39 -0400 Subject: [PATCH 05/13] Fix halving calc --- src/controller.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/controller.cpp b/src/controller.cpp index 83de33c..76e6e9e 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -298,14 +298,16 @@ void Controller::getInfoThenRefresh(bool force) static bool prevCallSucceeded = false; zrpc->fetchInfo([=] (const json& reply) { - prevCallSucceeded = true; - int curBlock = reply["latest_block_height"].get(); - bool doUpdate = force || (model->getLatestBlock() != curBlock); - int difficulty = reply["difficulty"].get(); - int blocks_until_halving= 340000 - curBlock; - int halving_days = (blocks_until_halving * 150) / (60 * 60 * 24) ; - int longestchain = reply["longestchain"].get(); - int notarized = reply["notarized"].get(); + prevCallSucceeded = true; + int curBlock = reply["latest_block_height"].get(); + bool doUpdate = force || (model->getLatestBlock() != curBlock); + int difficulty = reply["difficulty"].get(); + int num_halvings = 1; // number of halvings that have occured already + int blocks_until_halving = (num_halvings*1680000 + 340000) - curBlock; + int blocktime = 75; + int halving_days = (blocks_until_halving * blocktime) / (60 * 60 * 24) ; + int longestchain = reply["longestchain"].get(); + int notarized = reply["notarized"].get(); model->setLatestBlock(curBlock); if ( @@ -330,9 +332,7 @@ void Controller::getInfoThenRefresh(bool force) (QLocale(QLocale::German).toString(blocks_until_halving)) + " Blocks or , " + (QLocale(QLocale::German).toString(halving_days) + " days" ) ); - } - else - { + } else { ui->blockHeight->setText( "Block: " + QLocale(QLocale::English).toString(curBlock) ); From 68104f22476e0f3ce52ca282899d3bee2b619b6e Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Sun, 11 Apr 2021 00:42:19 -0400 Subject: [PATCH 06/13] Fix stuff and get sticky --- src/settings.cpp | 46 +++++++++++++++++++++++++++------------------- src/settings.h | 3 +++ 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/src/settings.cpp b/src/settings.cpp index a97f71e..0b4f22b 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -24,36 +24,44 @@ Config Settings::getSettings() { QSettings s; // this domain is stolen and malicious! + // More info: https://git.hush.is/hush/fraud/#gilardh auto malicious = "https://lite.myhush.org"; auto server = s.value("connection/server").toString(); - bool torOnly = s.value("connectoin/torOnly").toBool(); + bool sticky = s.value("connection/stickyServer").toBool(); + bool torOnly = s.value("connection/torOnly").toBool(); - // default behavior is no server listed in conf, and randomly choose from those listed in code + // Users that have old configs generated from old SDLs will have this hostname + if(server == malicious) { + qDebug() << "Replacing malicious SDL server with " << server; + server = "https://lite.hush.is"; + s.setValue("connection/server", server); + } + + // default behavior : no server listed in conf, randomly choose from server list, unless sticky if (server.trimmed().isEmpty()) { server = Settings::getRandomServer(); - } - // make sure existing server in conf is alive, otherwise choose random one - char* resp = litelib_initialize_existing(false, server.toStdString().c_str()); - QString response = litelib_process_response(resp); + // make sure existing server in conf is alive, otherwise choose random one + char* resp = litelib_initialize_existing(false, server.toStdString().c_str()); + QString response = litelib_process_response(resp); - // if we see a valid connection, return this server - if (response.toUpper().trimmed() != "OK") { - qDebug() << "Lite server in conf " << server << " is down, getting a random one"; - server = Settings::getRandomServer(); - s.setValue("connection/server", server); + if (response.toUpper().trimmed() != "OK") { + qDebug() << "Lite server in conf " << server << " is down, getting a random one"; + server = Settings::getRandomServer(); + s.setValue("connection/server", server); + } + } else { + if (sticky) { + qDebug() << server << " is sticky"; + } + // if it's down, oh well } - // Users that have old configs generated from old SDLs will have this hostname - if(server == malicious) { - qDebug() << "Replacing malicious SDL server with " << server; - s.setValue("connection/server", server); - } s.sync(); // re-init to load correct settings init(); - return Config{server, torOnly}; + return Config{server, torOnly, sticky}; } void Settings::saveSettings(const QString& server) { @@ -294,8 +302,8 @@ QString Settings::getRandomServer() { servers[0] = "https://lite.hush.is"; servers[1] = "https://devo.crabdance.com"; servers[2] = "https://bies.xyz"; - servers[3] = "https://hush.leto.net"; - servers[4] = "https://milktoast.attackingzcash.com"; + //servers[3] = "https://hush.leto.net"; + //servers[4] = "https://milktoast.attackingzcash.com"; // start at a random place in the list int x = rand() % servers.size(); diff --git a/src/settings.h b/src/settings.h index 2c536f4..d8b5d4b 100644 --- a/src/settings.h +++ b/src/settings.h @@ -11,7 +11,10 @@ using json = nlohmann::json; struct Config { // The randomly chosen server we are talking to OR user-specific server QString server; + // Shouuld we only speak Tor to this server? bool torOnly {false}; + // Should we randomly try other servers if specified server is down? + bool stickyServer {false}; }; struct ToFields; From fa1054acb57fd762f86c8116cb2af89c9c66d5b3 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Sat, 1 May 2021 11:28:13 -0400 Subject: [PATCH 07/13] Allow importing old privkey format --- src/liteinterface.cpp | 2 +- src/mainwindow.cpp | 38 +++++++++++++++++++++----------------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/liteinterface.cpp b/src/liteinterface.cpp index de56956..cca3e13 100644 --- a/src/liteinterface.cpp +++ b/src/liteinterface.cpp @@ -40,7 +40,7 @@ void LiteInterface::importTPrivKey(QString addr,const std::function& if (conn == nullptr) return; - conn->doRPCWithDefaultErrorHandling("timport", addr, cb); + conn->doRPCWithDefaultErrorHandling("timport", addr, cb); } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 6e6ba29..9ce138d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -107,7 +107,7 @@ MainWindow::MainWindow(QWidget *parent) : QObject::connect(ui->actionExit, &QAction::triggered, this, &MainWindow::close); // Set up Feedback action - QObject::connect(ui->actionDonate, &QAction::triggered, this, &MainWindow::donate); + //QObject::connect(ui->actionDonate, &QAction::triggered, this, &MainWindow::donate); QObject::connect(ui->actionTelegram, &QAction::triggered, this, &MainWindow::telegram); @@ -277,7 +277,7 @@ MainWindow::MainWindow(QWidget *parent) : dialog.exec(); }); -// Import Privkey + // Import Privkey QObject::connect(ui->actionImport_Privatkey, &QAction::triggered, this, &MainWindow::importPrivKey); // Address Book QObject::connect(ui->action_Address_Book, &QAction::triggered, this, &MainWindow::addressBook); @@ -909,14 +909,11 @@ void MainWindow::website() { void MainWindow::donate() { - // Set up a donation to me :) - ui->Address1->setText(Settings::getDonationAddr()); ui->Address1->setCursorPosition(0); ui->Amount1->setText("0.00"); ui->MemoTxt1->setText(tr("Some feedback about SilentDragonlite or Hush...")); - - ui->statusBar->showMessage(tr("Send DenioD some private and shielded feedback about") % Settings::getTokenName() % tr(" or SilentDragonLite")); + ui->statusBar->showMessage(tr("Send some private and shielded feedback about") % Settings::getTokenName() % tr(" or SilentDragonLite")); // And switch to the send tab. ui->tabWidget->setCurrentIndex(1); @@ -930,30 +927,37 @@ void MainWindow::donate() { if (keys->isEmpty()) { delete keys; - ui->statusBar->showMessage(tr("Private key import rescan in progress. Your funds will be automaticly shield to a wallet seed zaddr. This will take some time")); + ui->statusBar->showMessage(tr("Private key import rescan in progress. Your funds will be shielded into this wallet and backed up by your seed phrase. This will take some time")); return; } // Pop the first key - QString key = keys->first(); QString key1 = key + QString(" ") + QString("0"); keys->pop_front(); bool rescan = keys->isEmpty(); - - if (key.startsWith("SK") || - key.startsWith("secret")) { - + if (key.startsWith("SK") || key.startsWith("secret")) { rpc->importZPrivKey(key, [=] (auto) { this->doImport(keys); }); - - } else if (key.startsWith("U")) { - + } else if (key.startsWith("U") || key.startsWith("5") || key.startsWith("L") || key.startsWith("K")) { + // 5 = uncompressed, len=51 + // LK= compressed, len=52 + // TODO: verify exact length of (un)compressed + if(key.length() > 52) { + QMessageBox::critical(this, tr("Wrong Private key format"), + tr("That private key is too long. It should be 51 or 52 characters.") + "\n"); + return; + } + + if(key.length() < 51) { + QMessageBox::critical(this, tr("Wrong Private key format"), + tr("That private key is too short. It should be 51 or 52 characters.") + "\n"); + return; + } rpc->importTPrivKey(key, [=] (auto) { this->doImport(keys); }); - }else{ QMessageBox::critical(this, tr("Wrong Privatkey format"), - tr("Privatkey should start with U (for taddr) or secret- (for zaddr)") + "\n"); + tr("Privatkey should start with 5, K, L or U (for taddr) or secret- (for zaddr)") + "\n"); return; } } From e6828434ced1202e8119b2242a97411f44b8133d Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Sat, 1 May 2021 11:56:18 -0400 Subject: [PATCH 08/13] Private Key --- res/silentdragonlite_ar.ts | 2 +- res/silentdragonlite_be.ts | 2 +- res/silentdragonlite_de.ts | 2 +- res/silentdragonlite_es.ts | 2 +- res/silentdragonlite_fa.ts | 2 +- res/silentdragonlite_fr.ts | 2 +- res/silentdragonlite_hr.ts | 2 +- res/silentdragonlite_id.ts | 2 +- res/silentdragonlite_it.ts | 2 +- res/silentdragonlite_pt.ts | 2 +- res/silentdragonlite_ro.ts | 2 +- res/silentdragonlite_ru.ts | 2 +- res/silentdragonlite_sr.ts | 2 +- res/silentdragonlite_tr.ts | 2 +- res/silentdragonlite_ud.ts | 2 +- res/silentdragonlite_zh.ts | 2 +- src/connection.cpp | 4 ++-- src/mainwindow.ui | 2 +- 18 files changed, 19 insertions(+), 19 deletions(-) diff --git a/res/silentdragonlite_ar.ts b/res/silentdragonlite_ar.ts index 118ba73..d161d5c 100644 --- a/res/silentdragonlite_ar.ts +++ b/res/silentdragonlite_ar.ts @@ -550,7 +550,7 @@ p, li { white-space: pre-wrap; } - Import Privatkey + Import Private Key diff --git a/res/silentdragonlite_be.ts b/res/silentdragonlite_be.ts index 5f84530..48e8e64 100644 --- a/res/silentdragonlite_be.ts +++ b/res/silentdragonlite_be.ts @@ -748,7 +748,7 @@ p, li { white-space: pre-wrap; } - Import Privatkey + Import Private Key Імпартаваць Прыватныключ diff --git a/res/silentdragonlite_de.ts b/res/silentdragonlite_de.ts index 3e1eca4..60181c2 100644 --- a/res/silentdragonlite_de.ts +++ b/res/silentdragonlite_de.ts @@ -865,7 +865,7 @@ p, li { white-space: pre-wrap; } - Import Privatkey + Import Private Key diff --git a/res/silentdragonlite_es.ts b/res/silentdragonlite_es.ts index 95b9f62..c18ab3e 100644 --- a/res/silentdragonlite_es.ts +++ b/res/silentdragonlite_es.ts @@ -830,7 +830,7 @@ p, li { white-space: pre-wrap; } - Import Privatkey + Import Private Key diff --git a/res/silentdragonlite_fa.ts b/res/silentdragonlite_fa.ts index dad001c..04fe9c5 100644 --- a/res/silentdragonlite_fa.ts +++ b/res/silentdragonlite_fa.ts @@ -849,7 +849,7 @@ p, li { white-space: pre-wrap; } - Import Privatkey + Import Private Key diff --git a/res/silentdragonlite_fr.ts b/res/silentdragonlite_fr.ts index 989dea0..4ab9d86 100644 --- a/res/silentdragonlite_fr.ts +++ b/res/silentdragonlite_fr.ts @@ -643,7 +643,7 @@ p, li { white-space: pre-wrap; } - Import Privatkey + Import Private Key diff --git a/res/silentdragonlite_hr.ts b/res/silentdragonlite_hr.ts index dcc7b7b..3c520e5 100644 --- a/res/silentdragonlite_hr.ts +++ b/res/silentdragonlite_hr.ts @@ -850,7 +850,7 @@ p, li { white-space: pre-wrap; } - Import Privatkey + Import Private Key diff --git a/res/silentdragonlite_id.ts b/res/silentdragonlite_id.ts index c79670c..c34797d 100644 --- a/res/silentdragonlite_id.ts +++ b/res/silentdragonlite_id.ts @@ -825,7 +825,7 @@ p, li { white-space: pre-wrap; } - Import Privatkey + Import Private Key diff --git a/res/silentdragonlite_it.ts b/res/silentdragonlite_it.ts index 0a3446d..a0246a3 100644 --- a/res/silentdragonlite_it.ts +++ b/res/silentdragonlite_it.ts @@ -511,7 +511,7 @@ p, li { white-space: pre-wrap; } - Import Privatkey + Import Private Key diff --git a/res/silentdragonlite_pt.ts b/res/silentdragonlite_pt.ts index 28e33d0..a38716f 100644 --- a/res/silentdragonlite_pt.ts +++ b/res/silentdragonlite_pt.ts @@ -612,7 +612,7 @@ p, li { white-space: pre-wrap; } - Import Privatkey + Import Private Key diff --git a/res/silentdragonlite_ro.ts b/res/silentdragonlite_ro.ts index ef35c4d..f05651b 100644 --- a/res/silentdragonlite_ro.ts +++ b/res/silentdragonlite_ro.ts @@ -825,7 +825,7 @@ p, li { white-space: pre-wrap; } - Import Privatkey + Import Private Key diff --git a/res/silentdragonlite_ru.ts b/res/silentdragonlite_ru.ts index 46ce90b..ad6a492 100644 --- a/res/silentdragonlite_ru.ts +++ b/res/silentdragonlite_ru.ts @@ -665,7 +665,7 @@ p, li { white-space: pre-wrap; } - Import Privatkey + Import Private Key Импортировать Приватныйключ diff --git a/res/silentdragonlite_sr.ts b/res/silentdragonlite_sr.ts index 6abac12..2d9e5ec 100644 --- a/res/silentdragonlite_sr.ts +++ b/res/silentdragonlite_sr.ts @@ -850,7 +850,7 @@ p, li { white-space: pre-wrap; } - Import Privatkey + Import Private Key diff --git a/res/silentdragonlite_tr.ts b/res/silentdragonlite_tr.ts index 21f59d2..967323b 100644 --- a/res/silentdragonlite_tr.ts +++ b/res/silentdragonlite_tr.ts @@ -507,7 +507,7 @@ p, li { white-space: pre-wrap; } - Import Privatkey + Import Private Key diff --git a/res/silentdragonlite_ud.ts b/res/silentdragonlite_ud.ts index 6547690..f9b731c 100644 --- a/res/silentdragonlite_ud.ts +++ b/res/silentdragonlite_ud.ts @@ -829,7 +829,7 @@ p, li { white-space: pre-wrap; } - Import Privatkey + Import Private Key diff --git a/res/silentdragonlite_zh.ts b/res/silentdragonlite_zh.ts index 144386e..2ccd98f 100644 --- a/res/silentdragonlite_zh.ts +++ b/res/silentdragonlite_zh.ts @@ -565,7 +565,7 @@ p, li { white-space: pre-wrap; } - Import Privatkey + Import Private Key diff --git a/src/connection.cpp b/src/connection.cpp index 98f3637..722f039 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -114,7 +114,7 @@ void ConnectionLoader::ShowProgress() qint64 synced = reply["synced_blocks"].get(); qint64 total = reply["total_blocks"].get(); me->showInformation( - "Synced " + QString::number(synced) + " / " + QString::number(total) + "Syncing... " + QString::number(synced) + " / " + QString::number(total) ); } }, @@ -206,7 +206,7 @@ void ConnectionLoader::doAutoConnect() qint64 synced = reply["synced_blocks"].get(); qint64 total = reply["total_blocks"].get(); me->showInformation( - "Synced " + QString::number(synced) + " / " + QString::number(total) + "Syncing... " + QString::number(synced) + " / " + QString::number(total) ); } }, diff --git a/src/mainwindow.ui b/src/mainwindow.ui index f2cbd32..1b239a9 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -2035,7 +2035,7 @@ - Import Privatkey + Import Private Key From 204fb77d0d121cb77912d30b9f94ea23fb4bfcaa Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Sun, 2 May 2021 21:21:21 -0400 Subject: [PATCH 09/13] Spelling and nomenclature --- src/mainwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 9ce138d..bda0968 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1056,8 +1056,8 @@ void MainWindow::payhushURI(QString uri, QString myAddr) { pui.buttonBox->button(QDialogButtonBox::Save)->setVisible(true); pui.helpLbl->setText(QString() % tr("Please paste your private key(zs-Addr or R-addr) here, one per import") % ".\n" % - tr("Caution: If this key is for Zs-addr it will be NOT inlcude in your Seed. Please send them direct to a Seed zs-addr") % ".\n" % - tr("R-addr keys will be autoshield to a seed zs-addr") + tr("Caution: If this key is for a zaddr it will be NOT included in your Seed. Please send them direct to a Seed zaddr") % ".\n" % + tr("R-addr keys will be automatically sent to a zaddr in your Seed") ); if (d.exec() == QDialog::Accepted && !pui.privKeyTxt->toPlainText().trimmed().isEmpty()) { From 8688baa5b83fb2d7cd681548b460f63ecc5b2523 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Sun, 2 May 2021 21:23:16 -0400 Subject: [PATCH 10/13] Better nomenclature --- src/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index bda0968..023b859 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1057,7 +1057,7 @@ void MainWindow::payhushURI(QString uri, QString myAddr) { pui.helpLbl->setText(QString() % tr("Please paste your private key(zs-Addr or R-addr) here, one per import") % ".\n" % tr("Caution: If this key is for a zaddr it will be NOT included in your Seed. Please send them direct to a Seed zaddr") % ".\n" % - tr("R-addr keys will be automatically sent to a zaddr in your Seed") + tr("Transparent address (R.. or t1..) keys will be automatically sent to a zaddr in your Seed") ); if (d.exec() == QDialog::Accepted && !pui.privKeyTxt->toPlainText().trimmed().isEmpty()) { From aad29abc15f66180b0938a8f7063ad2da0b74551 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Mon, 3 May 2021 12:17:21 -0400 Subject: [PATCH 11/13] . --- src/mainwindow.cpp | 2 +- src/settings.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 023b859..35d9a3c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -840,7 +840,7 @@ void MainWindow::setupSettingsModal() { // List of default servers settings.cmbServer->addItem("https://lite.hush.is"); - settings.cmbServer->addItem("https://bies.xyz"); + settings.cmbServer->addItem("https://lite.hush.community"); settings.cmbServer->addItem("https://devo.crabdance.com"); //settings.cmbServer->addItem("https://hush.leto.net:5420"); //TODO: seperate lists of https/Tor servers, only show user or attempt diff --git a/src/settings.cpp b/src/settings.cpp index 0b4f22b..5702848 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -301,7 +301,7 @@ QString Settings::getRandomServer() { //TODO: This should be a much larger list which we randomly choose from servers[0] = "https://lite.hush.is"; servers[1] = "https://devo.crabdance.com"; - servers[2] = "https://bies.xyz"; + servers[2] = "https://lite.hush.community"; //servers[3] = "https://hush.leto.net"; //servers[4] = "https://milktoast.attackingzcash.com"; From e2770675b5fcaf4e5272d7e76e125ee11a3e668e Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Mon, 3 May 2021 12:50:14 -0400 Subject: [PATCH 12/13] Better GUI error message for down server --- src/connection.cpp | 5 ++++- src/settings.cpp | 5 ----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/connection.cpp b/src/connection.cpp index 722f039..57d9a65 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -155,8 +155,11 @@ void ConnectionLoader::doAutoConnect() QString response = litelib_process_response(resp); if (response.toUpper().trimmed() != "OK") { - showError(response); + QString resp = "Error when connecting to " + config->server + ": " + response; + showError(resp); return; + } else { + qDebug() << __func__ << ": Successfully connected to " << config->server << " !!!"; } } else { diff --git a/src/settings.cpp b/src/settings.cpp index 5702848..644dfd6 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -328,11 +328,6 @@ QString Settings::getRandomServer() { return server; } -QString Settings::getDefaultServer() { - qDebug() << __func__; - return "https://lite.hush.is"; -} - void Settings::openAddressInExplorer(QString address) { QString url = "https://explorer.hush.is/address/" + address; QDesktopServices::openUrl(QUrl(url)); From f601767811ab57b2e574efe5167bcd5b05000386 Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Mon, 3 May 2021 13:36:47 -0400 Subject: [PATCH 13/13] Randomly choose an SDL server and recognize malicious domain without prefix --- src/connection.cpp | 18 +++++++++++++++--- src/controller.cpp | 2 +- src/settings.cpp | 38 +++++++++++++++++++++----------------- 3 files changed, 37 insertions(+), 21 deletions(-) diff --git a/src/connection.cpp b/src/connection.cpp index 57d9a65..c244ee8 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -155,9 +155,21 @@ void ConnectionLoader::doAutoConnect() QString response = litelib_process_response(resp); if (response.toUpper().trimmed() != "OK") { - QString resp = "Error when connecting to " + config->server + ": " + response; - showError(resp); - return; + config->server = Settings::getRandomServer(); + + resp = litelib_initialize_existing( + config->dangerous, + config->server.toStdString().c_str() + ); + response = litelib_process_response(resp); + + if (response.toUpper().trimmed() != "OK") { + QString resp = "Error when connecting to " + config->server + ": " + response; + showError(resp); + return; + } else { + qDebug() << __func__ << ": Successfully connected to random server: " << config->server << " !!!"; + } } else { qDebug() << __func__ << ": Successfully connected to " << config->server << " !!!"; } diff --git a/src/controller.cpp b/src/controller.cpp index 76e6e9e..edb76c5 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -2040,7 +2040,7 @@ void Controller::shutdownhushd() connD.topIcon->setMovie(movie2); movie2->start(); connD.status->setText(QObject::tr("Please wait for SilentDragonLite to exit")); - connD.statusDetail->setText(QObject::tr("Waiting for hushd to exit")); + connD.statusDetail->setText(QObject::tr("Please wait for SilentDragonLite to exit")); } else { QMovie *movie1 = new QMovie(":/img/res/silentdragonlite-animated-startup.gif");; movie1->setScaledSize(size); diff --git a/src/settings.cpp b/src/settings.cpp index 644dfd6..09f9d63 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -25,15 +25,15 @@ Config Settings::getSettings() { // this domain is stolen and malicious! // More info: https://git.hush.is/hush/fraud/#gilardh - auto malicious = "https://lite.myhush.org"; + auto malicious = "lite.myhush.org"; auto server = s.value("connection/server").toString(); bool sticky = s.value("connection/stickyServer").toBool(); bool torOnly = s.value("connection/torOnly").toBool(); // Users that have old configs generated from old SDLs will have this hostname - if(server == malicious) { + if(server == malicious or server == (QString("https://") + malicious)) { qDebug() << "Replacing malicious SDL server with " << server; - server = "https://lite.hush.is"; + server = getRandomServer(); s.setValue("connection/server", server); } @@ -294,24 +294,27 @@ void Settings::saveRestoreTableHeader(QTableView* table, QDialog* d, QString tab QString Settings::getRandomServer() { qDebug() << __func__; + // The more servers from different TLDs, the better + QList servers = { + "https://lite.hush.is", + "https://devo.crabdance.com", + //"https://thisisdown1.example.com", + //"https://thisisdown2.example.com", + //"https://thisisdown3.example.com", + //"https://thisisdown4.example.com", + //"https://thisisdown5.example.com", + "https://lite.hush.community", + }; + // we don't need cryptographic random-ness, but we want // clients to never get "stuck" with the same server, which // prevents various attacks - QList servers; - //TODO: This should be a much larger list which we randomly choose from - servers[0] = "https://lite.hush.is"; - servers[1] = "https://devo.crabdance.com"; - servers[2] = "https://lite.hush.community"; - //servers[3] = "https://hush.leto.net"; - //servers[4] = "https://milktoast.attackingzcash.com"; - - // start at a random place in the list - int x = rand() % servers.size(); + int x = rand() % servers.size(); auto server = servers[x]; - int tries = 0; + int tries = 0; // We try every server,in order, starting from a random place in the list - while (tries <= servers.size() ) { + while (tries < servers.size() ) { qDebug() << "Checking if lite server " << server << " is a alive, try=" << tries; char* resp = litelib_initialize_existing(false, server.toStdString().c_str()); QString response = litelib_process_response(resp); @@ -321,8 +324,9 @@ QString Settings::getRandomServer() { qDebug() << "Choosing lite server " << server; return server; } - server = servers[++x % servers.size()]; - + x++; + x = x % servers.size(); + server = servers[x]; tries++; } return server;