We do it for the zlulz

This commit is contained in:
Duke Leto
2021-01-02 17:50:36 -05:00
parent 47262f5395
commit cc523a0a86
46 changed files with 10438 additions and 7283 deletions

View File

@@ -50,7 +50,7 @@ SilentDragonLite does automatic note and utxo management, which means it doesn't
## Building on Linux ## Building on Linux
``` ```
git clone https://github.com/MyHush/SilenDragonLite.git git clone https://git.hush.is/hush/SilenDragonLite
cd SilentDragonLite cd SilentDragonLite
# the next step will take potentially a long time for slower systems # the next step will take potentially a long time for slower systems
# Be Patient and please report compiler problems! # Be Patient and please report compiler problems!

View File

@@ -1,13 +0,0 @@
This directory contains the hashes and signatures for silentdragon
Verify the hashes by running:
sha256sum -c sha256sum-vX.Y.Z.txt
Verify signatures:
1. First, import the public key (Available on GitHub
at https://github.com/hushFoundation/silentdragon/blob/master/public_key.asc)
gpg --import public_key.asc
2. Verify signature
gpg --verify <filename.sig> <downloaded-filename-to-verify>

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -346,8 +346,8 @@
</message> </message>
<message> <message>
<location filename="../src/mainwindow.ui" line="1131"/> <location filename="../src/mainwindow.ui" line="1131"/>
<source>Check github.com for &amp;updates</source> <source>Check git for &amp;updates</source>
<translation>Consulte las actualizaciones en github.com</translation> <translation>Consulte las actualizaciones en git</translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.ui" line="1136"/> <location filename="../src/mainwindow.ui" line="1136"/>
@@ -1693,7 +1693,7 @@ El saldo es insuficiente para una migración automática.
</message> </message>
<message> <message>
<location filename="../src/settings.ui" line="184"/> <location filename="../src/settings.ui" line="184"/>
<source>Check github for updates at startup</source> <source>Check git for updates at startup</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
@@ -1713,7 +1713,7 @@ El saldo es insuficiente para una migración automática.
</message> </message>
<message> <message>
<location filename="../src/settings.ui" line="266"/> <location filename="../src/settings.ui" line="266"/>
<source>Connect to github on startup to check for updates</source> <source>Connect to git on startup to check for updates</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -478,7 +478,7 @@ Please enter your wallet password</source>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.ui" line="1425"/> <location filename="../src/mainwindow.ui" line="1425"/>
<source>Check github.com for &amp;updates</source> <source>Check git for &amp;updates</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
@@ -1694,12 +1694,12 @@ Would you like to visit the releases page?</source>
</message> </message>
<message> <message>
<location filename="../src/settings.ui" line="142"/> <location filename="../src/settings.ui" line="142"/>
<source>Check github for updates at startup</source> <source>Check git for updates at startup</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/settings.ui" line="155"/> <location filename="../src/settings.ui" line="155"/>
<source>Connect to github on startup to check for updates</source> <source>Connect to git on startup to check for updates</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2020 The Hush developers // Copyright 2019-2021 The Hush developers
// GPLv3 // GPLv3
#include "Chat.h" #include "Chat.h"

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2020 The Hush developers // Copyright 2019-2021 The Hush developers
// GPLv3 // GPLv3
#include "ContactDataStore.h" #include "ContactDataStore.h"

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2020 The Hush developers // Copyright 2019-2021 The Hush developers
// GPLv3 // GPLv3
#ifndef FILESYSTEM_H #ifndef FILESYSTEM_H
#define FILESYSTEM_H #define FILESYSTEM_H

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2020 The Hush developers // Copyright 2019-2021 The Hush developers
// GPLv3 // GPLv3
#include "ContactItem.h" #include "ContactItem.h"
#include "chatmodel.h" #include "chatmodel.h"

View File

@@ -1,4 +1,4 @@
// Copyright 2019-2020 The Hush developers // Copyright 2019-2021 The Hush developers
// GPLv3 // GPLv3
#include "ContactRequest.h" #include "ContactRequest.h"

View File

@@ -35,7 +35,7 @@ QLabel
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>Lorem ipsum dolor sit amet</string> <string>Speak And Transact Freely With Hush</string>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="lblTimestamp"> <widget class="QLabel" name="lblTimestamp">
@@ -48,7 +48,7 @@ QLabel
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>12/03/2020 12:34</string> <string>01/01/2021 12:34</string>
</property> </property>
</widget> </widget>
</widget> </widget>

View File

@@ -76,69 +76,71 @@ void ConnectionLoader::loadProgress()
void ConnectionLoader::ShowProgress() void ConnectionLoader::ShowProgress()
{ {
auto config = std::shared_ptr<ConnectionConfig>(new ConnectionConfig()); auto config = std::shared_ptr<ConnectionConfig>(new ConnectionConfig());
config->dangerous = false; config->dangerous = false;
config->server = Settings::getInstance()->getSettings().server; config->server = Settings::getInstance()->getSettings().server;
auto connection = makeConnection(config); auto connection = makeConnection(config);
auto me = this; auto me = this;
qDebug() << __func__ << ": server=" << config->server
<< " connection=" << connection << " me=" << me;
isSyncing = new QAtomicInteger<bool>(); isSyncing = new QAtomicInteger<bool>();
isSyncing->store(true); isSyncing->store(true);
main->logger->write("isSyncing"); main->logger->write("isSyncing");
// Do a sync after import
syncTimer = new QTimer(main);
main->logger->write("Beginning sync after import wif");
connection->doRPCWithDefaultErrorHandling("sync", "", [=](auto) {
isSyncing->store(false);
// Cancel the timer
syncTimer->deleteLater();
// When sync is done, set the connection
this->doRPCSetConnectionShield(connection);
});
// While it is syncing, we'll show the status updates while it is alive.
QObject::connect(syncTimer, &QTimer::timeout, [=]() {
// Check the sync status
if (isSyncing != nullptr && isSyncing->load()) {
// Get the sync status
try {
connection->doRPC("syncstatus", "", [=](json reply) {
if (isSyncing != nullptr && reply.find("synced_blocks") != reply.end())
{
qint64 synced = reply["synced_blocks"].get<json::number_unsigned_t>();
qint64 total = reply["total_blocks"].get<json::number_unsigned_t>();
me->showInformation(
"Synced " + QString::number(synced) + " / " + QString::number(total)
);
}
},
[=](QString err) {
qDebug() << "Sync error" << err;
});
}catch (...)
{
main->logger->write("catch sync progress reply");
}
}
});
// Do a sync after import syncTimer->setInterval(1* 1000);
syncTimer = new QTimer(main); syncTimer->start();
main->logger->write("Beginning sync after import wif"); main->logger->write("Start sync timer");
connection->doRPCWithDefaultErrorHandling("sync", "", [=](auto) {
isSyncing->store(false);
// Cancel the timer
syncTimer->deleteLater();
// When sync is done, set the connection
this->doRPCSetConnectionShield(connection);
});
// While it is syncing, we'll show the status updates while it is alive.
QObject::connect(syncTimer, &QTimer::timeout, [=]() {
// Check the sync status
if (isSyncing != nullptr && isSyncing->load()) {
// Get the sync status
try {
connection->doRPC("syncstatus", "", [=](json reply) {
if (isSyncing != nullptr && reply.find("synced_blocks") != reply.end())
{
qint64 synced = reply["synced_blocks"].get<json::number_unsigned_t>();
qint64 total = reply["total_blocks"].get<json::number_unsigned_t>();
me->showInformation(
"Synced " + QString::number(synced) + " / " + QString::number(total)
);
}
},
[=](QString err) {
qDebug() << "Sync error" << err;
});
}catch (...)
{
main->logger->write("catch sync progress reply");
}
}
});
syncTimer->setInterval(1* 1000);
syncTimer->start();
main->logger->write("Start sync timer");
} }
void ConnectionLoader::doAutoConnect() void ConnectionLoader::doAutoConnect()
{ {
qDebug() << "Doing autoconnect";
auto config = std::shared_ptr<ConnectionConfig>(new ConnectionConfig()); auto config = std::shared_ptr<ConnectionConfig>(new ConnectionConfig());
config->dangerous = false; config->dangerous = false;
config->server = Settings::getInstance()->getSettings().server; config->server = Settings::getInstance()->getSettings().server;
qDebug() << __func__ << " server=" << config->server;
// Initialize the library // Initialize the library
main->logger->write(QObject::tr("Attempting to initialize library with ") + config->server); main->logger->write(QObject::tr("Attempting to initialize library with ") + config->server);
@@ -159,9 +161,7 @@ void ConnectionLoader::doAutoConnect()
return; return;
} }
} } else {
else
{
main->logger->write(QObject::tr("Create/restore wallet.")); main->logger->write(QObject::tr("Create/restore wallet."));
createOrRestore(config->dangerous, config->server); createOrRestore(config->dangerous, config->server);
d->show(); d->show();
@@ -169,6 +169,9 @@ void ConnectionLoader::doAutoConnect()
auto connection = makeConnection(config); auto connection = makeConnection(config);
auto me = this; auto me = this;
qDebug() << __func__ << ": server=" << config->server
<< " connection=" << connection << " me=" << me << endl;
// After the lib is initialized, try to do get info // After the lib is initialized, try to do get info
connection->doRPC("info", "", [=](auto reply) { connection->doRPC("info", "", [=](auto reply) {
@@ -248,19 +251,14 @@ void ConnectionLoader::doRPCSetConnection(Connection* conn)
d->accept(); d->accept();
QTimer::singleShot(1, [=]() { delete this; }); QTimer::singleShot(1, [=]() { delete this; });
try try {
{ QFile plaintextWallet(dirwalletconnection);
main->logger->write("Path to Wallet.dat : " );
QFile plaintextWallet(dirwalletconnection); plaintextWallet.remove();
main->logger->write("Path to Wallet.dat : " );
plaintextWallet.remove(); } catch (...) {
main->logger->write("no Plaintext wallet.dat");
}catch (...) }
{
main->logger->write("no Plaintext wallet.dat");
}
} }
@@ -272,24 +270,18 @@ void ConnectionLoader::doRPCSetConnectionShield(Connection* conn)
main->getRPC()->shield([=] (auto) {}); main->getRPC()->shield([=] (auto) {});
QTimer::singleShot(1, [=]() { delete this; }); QTimer::singleShot(1, [=]() { delete this; });
try try {
{ QFile plaintextWallet(dirwalletconnection);
main->logger->write("Path to Wallet.dat : " );
QFile plaintextWallet(dirwalletconnection); plaintextWallet.remove();
main->logger->write("Path to Wallet.dat : " ); } catch (...) {
plaintextWallet.remove(); main->logger->write("no Plaintext wallet.dat");
}
}catch (...)
{
main->logger->write("no Plaintext wallet.dat");
}
} }
Connection* ConnectionLoader::makeConnection(std::shared_ptr<ConnectionConfig> config) Connection* ConnectionLoader::makeConnection(std::shared_ptr<ConnectionConfig> config)
{ {
qDebug() << __func__;
return new Connection(main, config); return new Connection(main, config);
} }
@@ -317,6 +309,8 @@ void ConnectionLoader::showError(QString explanation)
QString litelib_process_response(char* resp) QString litelib_process_response(char* resp)
{ {
qDebug() << __func__ << ": " << resp;
char* resp_copy = new char[strlen(resp) + 1]; char* resp_copy = new char[strlen(resp) + 1];
//a safer version of strcpy //a safer version of strcpy
strncpy(resp_copy, resp, strlen(resp)+1); strncpy(resp_copy, resp, strlen(resp)+1);
@@ -365,6 +359,7 @@ Connection::Connection(MainWindow* m, std::shared_ptr<ConnectionConfig> conf)
{ {
this->config = conf; this->config = conf;
this->main = m; this->main = m;
qDebug() << __func__;
// Register the JSON type as a type that can be passed between signals and slots. // Register the JSON type as a type that can be passed between signals and slots.
qRegisterMetaType<json>("json"); qRegisterMetaType<json>("json");
} }
@@ -375,10 +370,7 @@ void Connection::doRPC(const QString cmd, const QString args, const std::functio
// Ignoring RPC because shutdown in progress // Ignoring RPC because shutdown in progress
return; return;
// qDebug() << "Doing RPC: " << cmd; qDebug() << __func__ << ": " << cmd;
// Create a runner. // Create a runner.
auto runner = new Executor(cmd, args); auto runner = new Executor(cmd, args);
@@ -393,6 +385,7 @@ void Connection::doRPC(const QString cmd, const QString args, const std::functio
void Connection::doRPCWithDefaultErrorHandling(const QString cmd, const QString args, const std::function<void(json)>& cb) void Connection::doRPCWithDefaultErrorHandling(const QString cmd, const QString args, const std::function<void(json)>& cb)
{ {
qDebug() << __func__ << ": " << cmd;
doRPC(cmd, args, cb, [=] (QString err) { doRPC(cmd, args, cb, [=] (QString err) {
this->showTxError(err); this->showTxError(err);
}); });
@@ -400,6 +393,7 @@ void Connection::doRPCWithDefaultErrorHandling(const QString cmd, const QString
void Connection::doRPCIgnoreError(const QString cmd, const QString args, const std::function<void(json)>& cb) void Connection::doRPCIgnoreError(const QString cmd, const QString args, const std::function<void(json)>& cb)
{ {
qDebug() << __func__ << ": " << cmd;
doRPC(cmd, args, cb, [=] (auto) { doRPC(cmd, args, cb, [=] (auto) {
// Ignored error handling // Ignored error handling
}); });
@@ -407,6 +401,7 @@ void Connection::doRPCIgnoreError(const QString cmd, const QString args, const s
void Connection::showTxError(const QString& error) void Connection::showTxError(const QString& error)
{ {
qDebug() << __func__ << ": " << error;
if (error.isNull()) if (error.isNull())
return; return;

View File

@@ -17,14 +17,16 @@ ContactModel *contactModel = new ContactModel();
using json = nlohmann::json; using json = nlohmann::json;
Controller::Controller(MainWindow* main) Controller::Controller(MainWindow* main)
{ {
auto cl = new ConnectionLoader(main, this); auto cl = new ConnectionLoader(main, this);
qDebug() << __func__ << ": cl=" << cl << endl;
// Execute the load connection async, so we can set up the rest of RPC properly. // Execute the load connection async, so we can set up the rest of RPC properly.
QTimer::singleShot(1, [=]() { cl->loadConnection(); }); QTimer::singleShot(1, [=]() { cl->loadConnection(); });
qDebug() << __func__ << "after loadConnection" << endl;
this->main = main; this->main = main;
this->ui = main->ui; this->ui = main->ui;
@@ -32,9 +34,6 @@ Controller::Controller(MainWindow* main)
balancesTableModel = new BalancesTableModel(main->ui->balancesTable); balancesTableModel = new BalancesTableModel(main->ui->balancesTable);
main->ui->balancesTable->setModel(balancesTableModel); main->ui->balancesTable->setModel(balancesTableModel);
// Call the supply once
// supplyUpdate();
// Setup transactions table model // Setup transactions table model
transactionsTableModel = new TxTableModel(ui->transactionsTable); transactionsTableModel = new TxTableModel(ui->transactionsTable);
main->ui->transactionsTable->setModel(transactionsTableModel); main->ui->transactionsTable->setModel(transactionsTableModel);
@@ -755,7 +754,7 @@ void Controller::updateUIBalances()
CAmount balAvailable = balT + balVerified; CAmount balAvailable = balT + balVerified;
if (balZ < 0) if (balZ < 0)
balZ = CAmount::fromqint64(0); balZ = CAmount::fromqint64(0);
double price = (Settings::getInstance()->getBTCPrice() / 1000); // double price = (Settings::getInstance()->getBTCPrice() / 1000);
// ui->PriceMemo->setText(" The price of \n one HushChat \n Message is :\n BTC " + (QLocale(QLocale::English).toString(price, 'f',8)) // ui->PriceMemo->setText(" The price of \n one HushChat \n Message is :\n BTC " + (QLocale(QLocale::English).toString(price, 'f',8))
//+ " Messages left :" + ((balTotal.toDecimalhushString()) /0.0001) ); //+ " Messages left :" + ((balTotal.toDecimalhushString()) /0.0001) );
// Balances table // Balances table
@@ -1361,7 +1360,7 @@ void Controller::refreshTransactions() {
const unsigned char *header = reinterpret_cast<const unsigned char *>(ba1.constData()); const unsigned char *header = reinterpret_cast<const unsigned char *>(ba1.constData());
int encryptedMemoSize1 = ba.length(); int encryptedMemoSize1 = ba.length();
int headersize = ba1.length(); //int headersize = ba1.length();
//////unsigned char* as message from QString //////unsigned char* as message from QString
#define MESSAGE2 (const unsigned char *) encryptedMemo #define MESSAGE2 (const unsigned char *) encryptedMemo
@@ -1604,10 +1603,12 @@ void Controller::executeTransaction(Tx tx,
void Controller::checkForUpdate(bool silent) void Controller::checkForUpdate(bool silent)
{ {
// No checking for updates, needs testing with Gitea
return;
if (!zrpc->haveConnection()) if (!zrpc->haveConnection())
return noConnection(); return noConnection();
QUrl cmcURL("https://api.github.com/repos/MyHush/SilentDragonLite/releases"); QUrl cmcURL("https://git.hush.is/repos/MyHush/SilentDragonLite/releases");
QNetworkRequest req; QNetworkRequest req;
req.setUrl(cmcURL); req.setUrl(cmcURL);
@@ -1661,7 +1662,7 @@ void Controller::checkForUpdate(bool silent)
QMessageBox::Yes, QMessageBox::Cancel); QMessageBox::Yes, QMessageBox::Cancel);
if (ans == QMessageBox::Yes) if (ans == QMessageBox::Yes)
{ {
QDesktopServices::openUrl(QUrl("https://github.com/MyHush/SilentDragonLite/releases")); QDesktopServices::openUrl(QUrl("https://git.hush.is/hush/SilentDragonLite/releases"));
} }
else else
{ {

View File

@@ -5,7 +5,6 @@
#define RPCCLIENT_H #define RPCCLIENT_H
#include "precompiled.h" #include "precompiled.h"
#include "camount.h" #include "camount.h"
#include "datamodel.h" #include "datamodel.h"
#include "balancestablemodel.h" #include "balancestablemodel.h"

View File

@@ -42,7 +42,6 @@
using json = nlohmann::json; using json = nlohmann::json;
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
auto dirwallet = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite/silentdragonlite-wallet.dat"); auto dirwallet = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite/silentdragonlite-wallet.dat");
auto dirwalletenc = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite/silentdragonlite-wallet-enc.dat"); auto dirwalletenc = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite/silentdragonlite-wallet-enc.dat");
@@ -63,6 +62,7 @@ MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent), QMainWindow(parent),
ui(new Ui::MainWindow) ui(new Ui::MainWindow)
{ {
qDebug() << __func__ << endl;
// Include css // Include css
QString theme_name; QString theme_name;
@@ -86,9 +86,7 @@ MainWindow::MainWindow(QWidget *parent) :
}else{} }else{}
logger = new Logger(this, QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite-wallet.log")); logger = new Logger(this, QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite-wallet.log"));
// Check for encryption // Check for encryption
if(fileExists(dirwalletenc)) if(fileExists(dirwalletenc))
{ {
@@ -117,7 +115,7 @@ MainWindow::MainWindow(QWidget *parent) :
// File a bug // File a bug
QObject::connect(ui->actionFile_a_bug, &QAction::triggered, [=]() { QObject::connect(ui->actionFile_a_bug, &QAction::triggered, [=]() {
QDesktopServices::openUrl(QUrl("https://github.com/MyHush/SilentDragonLite/issues/new")); QDesktopServices::openUrl(QUrl("https://git.hush.is/hush/SilentDragonLite/issues/new"));
}); });
// Set up check for updates action // Set up check for updates action
@@ -300,11 +298,6 @@ MainWindow::MainWindow(QWidget *parent) :
// Initialize to the balances tab // Initialize to the balances tab
ui->tabWidget->setCurrentIndex(0); ui->tabWidget->setCurrentIndex(0);
// The hushd tab is hidden by default, and only later added in if the embedded hushd is started
//hushdtab = ui->tabWidget->widget(4);
//ui->tabWidget->removeTab(4);
setupSendTab(); setupSendTab();
setupTransactionsTab(); setupTransactionsTab();
setupReceiveTab(); setupReceiveTab();
@@ -317,6 +310,7 @@ MainWindow::MainWindow(QWidget *parent) :
restoreSavedStates(); restoreSavedStates();
if (AppDataServer::getInstance()->isAppConnected()) { if (AppDataServer::getInstance()->isAppConnected()) {
qDebug() << __func__ << ": app is connected to wormhole";
auto ads = AppDataServer::getInstance(); auto ads = AppDataServer::getInstance();
QString wormholecode = ""; QString wormholecode = "";
@@ -399,15 +393,12 @@ void MainWindow::closeEvent(QCloseEvent* event) {
s.sync(); s.sync();
// Let the RPC know to shut down any running service. // Let the RPC know to shut down any running service.
rpc->shutdownhushd(); rpc->shutdownhushd();
int passphraselenght = DataStore::getChatDataStore()->getPassword().length(); int passphraselenght = DataStore::getChatDataStore()->getPassword().length();
// Check is encryption is ON for SDl // Check is encryption is ON for SDl
if(passphraselenght > 0) if(passphraselenght > 0) {
{
// delete old file before // delete old file before
//auto dirHome = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)); //auto dirHome = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
@@ -449,14 +440,10 @@ void MainWindow::closeEvent(QCloseEvent* event) {
} }
void MainWindow::closeEventpw(QCloseEvent* event) { void MainWindow::closeEventpw(QCloseEvent* event) {
// Let the RPC know to shut down any running service. // Let the RPC know to shut down any running service.
rpc->shutdownhushd(); rpc->shutdownhushd();
} }
void MainWindow::encryptWallet() { void MainWindow::encryptWallet() {
QDialog d(this); QDialog d(this);
@@ -465,7 +452,6 @@ void MainWindow::encryptWallet() {
// Handle edits on the password box // Handle edits on the password box
auto fnPasswordEdited = [=](const QString&) { auto fnPasswordEdited = [=](const QString&) {
// Enable the OK button if the passwords match. // Enable the OK button if the passwords match.
QString password = ed.txtPassword->text(); QString password = ed.txtPassword->text();
@@ -755,6 +741,7 @@ void MainWindow::setMoneyMemo(QString moneymemo)
} }
void MainWindow::setupStatusBar() { void MainWindow::setupStatusBar() {
qDebug() << __func__ << endl;
// Status Bar // Status Bar
loadingLabel = new QLabel(); loadingLabel = new QLabel();
loadingMovie = new QMovie(":/icons/res/loading.gif"); loadingMovie = new QMovie(":/icons/res/loading.gif");
@@ -853,8 +840,11 @@ void MainWindow::setupSettingsModal() {
// List of default servers // List of default servers
settings.cmbServer->addItem("https://lite.hush.is"); settings.cmbServer->addItem("https://lite.hush.is");
settings.cmbServer->addItem("6onaaujm4ozaokzu.onion:80"); settings.cmbServer->addItem("https://miodrag.zone:9876");
settings.cmbServer->addItem("https://hush.leto.net:5420");
//TODO: seperate lists of https/Tor servers, only show user or attempt
// connection to .onion if user has it enabled
//settings.cmbServer->addItem("6onaaujm4ozaokzu.onion:80");
// Load current values into the dialog // Load current values into the dialog
auto conf = Settings::getInstance()->getSettings(); auto conf = Settings::getInstance()->getSettings();

View File

@@ -1964,7 +1964,7 @@
</action> </action>
<action name="actionCheck_for_Updates"> <action name="actionCheck_for_Updates">
<property name="text"> <property name="text">
<string>Check github.com for &amp;updates</string> <string>Check git for &amp;updates</string>
</property> </property>
</action> </action>
<action name="actionExport_All_Private_Keys"> <action name="actionExport_All_Private_Keys">

View File

@@ -21,7 +21,18 @@ Config Settings::getSettings() {
// Load from the QT Settings. // Load from the QT Settings.
QSettings s; QSettings s;
// this domain is stolen and malicious!
auto malicious = "https://lite.myhush.org";
auto server = s.value("connection/server").toString(); auto server = s.value("connection/server").toString();
if(server == malicious) {
server = "https://lite.hush.is";
qDebug() << "Replacing malicious SDL server with " << server;
s.setValue("connection/server", server);
s.sync();
// re-init to load correct settings
init();
}
if (server.trimmed().isEmpty()) { if (server.trimmed().isEmpty()) {
server = Settings::getDefaultServer(); server = Settings::getDefaultServer();
} }
@@ -239,10 +250,6 @@ void Settings::set_theme_name(QString theme_name) {
QSettings().setValue("options/theme_name", theme_name); QSettings().setValue("options/theme_name", theme_name);
} }
//================================= //=================================
// Static Stuff // Static Stuff
//================================= //=================================
@@ -263,8 +270,21 @@ void Settings::saveRestoreTableHeader(QTableView* table, QDialog* d, QString tab
}); });
} }
QString Settings::getRandomServer() {
// we don't need cryptographic random-ness, but we want
// clients to never get "stuck" with the same server, which
// prevents various attacks
QList<QString> servers;
//TODO: This should be a much larger list which we randomly choose from
servers[0] = "https://lite.hush.is";
servers[1] = "https://miodrag.zone:9876";
servers[2] = "https://hush.leto.net:5420";
int x = rand() % 3;
return servers[1];
}
QString Settings::getDefaultServer() { QString Settings::getDefaultServer() {
return "https://lite.hush.is"; return "https://miodrag.zone:9876";
} }
void Settings::openAddressInExplorer(QString address) { void Settings::openAddressInExplorer(QString address) {
@@ -278,7 +298,6 @@ void Settings::openTxInExplorer(QString txid) {
} }
const QString Settings::txidStatusMessage = QString(QObject::tr("Tx submitted (right click to copy) txid:")); const QString Settings::txidStatusMessage = QString(QObject::tr("Tx submitted (right click to copy) txid:"));
QString Settings::getTokenName() { QString Settings::getTokenName() {

View File

@@ -158,6 +158,7 @@ public:
static QString getDonationAddr(); static QString getDonationAddr();
static QString getDefaultServer(); static QString getDefaultServer();
static QString getRandomServer();
static CAmount getMinerFee(); static CAmount getMinerFee();
static int getMaxMobileAppTxns() { return 30; } static int getMaxMobileAppTxns() { return 30; }
@@ -171,8 +172,8 @@ public:
static const QString labelRegExp; static const QString labelRegExp;
static const int updateSpeed = 30 * 1000; // 30 sec static const int updateSpeed = 30 * 1000; // 30 sec
static const int quickUpdateSpeed = 5 * 1000; // 3 sec static const int quickUpdateSpeed = 5 * 1000; // 5 sec
static const int priceRefreshSpeed = 5 * 60 * 1000; // 15 min static const int priceRefreshSpeed = 5 * 60 * 1000; // 5 min
private: private:
// This class can only be accessed through Settings::getInstance() // This class can only be accessed through Settings::getInstance()

View File

@@ -167,7 +167,7 @@
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>Check github for updates at startup</string> <string>Check git for updates at startup</string>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="label_8"> <widget class="QLabel" name="label_8">
@@ -180,7 +180,7 @@
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>Connect to github on startup to check for updates</string> <string>Connect to git on startup to check for updates</string>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="label_20"> <widget class="QLabel" name="label_20">