From f591fe332bf9d7e28d3ddf20cadba5c7a6fc0114 Mon Sep 17 00:00:00 2001 From: Duke Date: Fri, 17 Feb 2023 16:20:33 -0500 Subject: [PATCH] Allow custom tor port --- src/connection.cpp | 5 ++++- src/createhushconfdialog.ui | 23 +++++++++++++++++++++-- src/mainwindow.cpp | 6 ++++-- src/settings.ui | 33 ++++++++++++++++++++++++++------- 4 files changed, 55 insertions(+), 12 deletions(-) diff --git a/src/connection.cpp b/src/connection.cpp index c5ec30e..4e2c474 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -211,9 +211,12 @@ void ConnectionLoader::createHushConf() { // Show the dialog QString datadir = ""; bool useTor = false; + QString torPort = "9050"; + if (d.exec() == QDialog::Accepted) { datadir = ui.lblDirName->text(); useTor = ui.chkUseTor->isChecked(); + torPort = ui.torPort->text(); } main->logger->write("Creating file " + confLocation); @@ -263,7 +266,7 @@ void ConnectionLoader::createHushConf() { out << "datadir=" % datadir % "\n"; } if (useTor) { - out << "proxy=127.0.0.1:9050\n"; + out << "proxy=127.0.0.1:" << torPort << "\n"; } file.close(); diff --git a/src/createhushconfdialog.ui b/src/createhushconfdialog.ui index 07ff088..b150990 100644 --- a/src/createhushconfdialog.ui +++ b/src/createhushconfdialog.ui @@ -40,7 +40,7 @@ - + Qt::Horizontal @@ -148,6 +148,7 @@ + @@ -155,13 +156,31 @@ + - Please note that you'll need to already have a Tor service configured on port 9050 + Please note that you'll need to already have a Tor service configured + + + + + Tor Port + + + + + + + + 9050 + + + + diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 973cf57..0a14108 100755 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -676,8 +676,10 @@ void MainWindow::setupSettingsModal() { if (!isUsingTor && settings.chkTor->isChecked()) { // If "use tor" was previously unchecked and now checked - Settings::addToHushConf(hushConfLocation, "proxy=127.0.0.1:9050"); - rpc->getConnection()->config->proxy = "proxy=127.0.0.1:9050"; + QString torPort = settings.torPort->text(); + QString proxyConfig = "proxy=127.0.0.1:" % torPort; + Settings::addToHushConf(hushConfLocation, proxyConfig); + rpc->getConnection()->config->proxy = proxyConfig; QMessageBox::information(this, tr("Enable Tor"), tr("Connection over Tor has been enabled. To use this feature, you need to restart SilentDragon."), diff --git a/src/settings.ui b/src/settings.ui index 0600d62..34e2ebd 100644 --- a/src/settings.ui +++ b/src/settings.ui @@ -226,7 +226,7 @@ - + @@ -236,16 +236,35 @@ + - Connect to the Tor network via SOCKS proxy running on 127.0.0.1:9050. Please note that you'll have to install and run the Tor service externally. + Connect to the Tor network via SOCKS proxy, which runs on 127.0.0.1:9050 by default or 127.0.0.1:9150 for Tor Browser. Please note that you'll have to install and run the Tor service externally. true + + + + + Tor Port + + + + + + + + 9050 + + + + + @@ -285,21 +304,21 @@ - + Check git.hush.is for updates at startup - + Fetch prices - + Connect to git.hush.is on startup to check for updates @@ -346,14 +365,14 @@ - + Qt::Horizontal - +