Browse Source

Allow custom tor port

custom_themes
Duke 1 year ago
parent
commit
f591fe332b
  1. 5
      src/connection.cpp
  2. 23
      src/createhushconfdialog.ui
  3. 6
      src/mainwindow.cpp
  4. 33
      src/settings.ui

5
src/connection.cpp

@ -211,9 +211,12 @@ void ConnectionLoader::createHushConf() {
// Show the dialog // Show the dialog
QString datadir = ""; QString datadir = "";
bool useTor = false; bool useTor = false;
QString torPort = "9050";
if (d.exec() == QDialog::Accepted) { if (d.exec() == QDialog::Accepted) {
datadir = ui.lblDirName->text(); datadir = ui.lblDirName->text();
useTor = ui.chkUseTor->isChecked(); useTor = ui.chkUseTor->isChecked();
torPort = ui.torPort->text();
} }
main->logger->write("Creating file " + confLocation); main->logger->write("Creating file " + confLocation);
@ -263,7 +266,7 @@ void ConnectionLoader::createHushConf() {
out << "datadir=" % datadir % "\n"; out << "datadir=" % datadir % "\n";
} }
if (useTor) { if (useTor) {
out << "proxy=127.0.0.1:9050\n"; out << "proxy=127.0.0.1:" << torPort << "\n";
} }
file.close(); file.close();

23
src/createhushconfdialog.ui

@ -40,7 +40,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="1"> <item row="7" column="1">
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -148,6 +148,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="4" column="0">
<widget class="QCheckBox" name="chkUseTor"> <widget class="QCheckBox" name="chkUseTor">
<property name="text"> <property name="text">
@ -155,13 +156,31 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0"> <item row="5" column="0">
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="label_5">
<property name="text"> <property name="text">
<string>Please note that you'll need to already have a Tor service configured on port 9050</string> <string>Please note that you'll need to already have a Tor service configured</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="0">
<widget class="QLabel" name="label_tor_port">
<property name="text">
<string>Tor Port</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="torPort">
<property name="text">
<string notr="true">9050</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

6
src/mainwindow.cpp

@ -676,8 +676,10 @@ void MainWindow::setupSettingsModal() {
if (!isUsingTor && settings.chkTor->isChecked()) { if (!isUsingTor && settings.chkTor->isChecked()) {
// If "use tor" was previously unchecked and now checked // If "use tor" was previously unchecked and now checked
Settings::addToHushConf(hushConfLocation, "proxy=127.0.0.1:9050"); QString torPort = settings.torPort->text();
rpc->getConnection()->config->proxy = "proxy=127.0.0.1:9050"; QString proxyConfig = "proxy=127.0.0.1:" % torPort;
Settings::addToHushConf(hushConfLocation, proxyConfig);
rpc->getConnection()->config->proxy = proxyConfig;
QMessageBox::information(this, tr("Enable Tor"), QMessageBox::information(this, tr("Enable Tor"),
tr("Connection over Tor has been enabled. To use this feature, you need to restart SilentDragon."), tr("Connection over Tor has been enabled. To use this feature, you need to restart SilentDragon."),

33
src/settings.ui

@ -226,7 +226,7 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="17" column="1"> <item row="18" column="1">
<widget class="QComboBox" name="comboBoxLanguage"> <widget class="QComboBox" name="comboBoxLanguage">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
@ -236,16 +236,35 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="0" colspan="2"> <item row="8" column="0" colspan="2">
<widget class="QLabel" name="lblTor"> <widget class="QLabel" name="lblTor">
<property name="text"> <property name="text">
<string>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.</string> <string>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.</string>
</property> </property>
<property name="wordWrap"> <property name="wordWrap">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="0">
<widget class="QLabel" name="label_tor_port">
<property name="text">
<string>Tor Port</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QLineEdit" name="torPort">
<property name="text">
<string notr="true">9050</string>
</property>
</widget>
</item>
<item row="2" column="0"> <item row="2" column="0">
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">
@ -285,21 +304,21 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="0" colspan="2"> <item row="10" column="0" colspan="2">
<widget class="QCheckBox" name="chkCheckUpdates"> <widget class="QCheckBox" name="chkCheckUpdates">
<property name="text"> <property name="text">
<string>Check git.hush.is for updates at startup</string> <string>Check git.hush.is for updates at startup</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="11" column="0" colspan="2"> <item row="12" column="0" colspan="2">
<widget class="QCheckBox" name="chkFetchPrices"> <widget class="QCheckBox" name="chkFetchPrices">
<property name="text"> <property name="text">
<string>Fetch prices</string> <string>Fetch prices</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="10" column="0" colspan="2"> <item row="11" column="0" colspan="2">
<widget class="QLabel" name="label_8"> <widget class="QLabel" name="label_8">
<property name="text"> <property name="text">
<string>Connect to git.hush.is on startup to check for updates</string> <string>Connect to git.hush.is on startup to check for updates</string>
@ -346,14 +365,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="13" column="0" colspan="2"> <item row="15" column="0" colspan="2">
<widget class="Line" name="line_2"> <widget class="Line" name="line_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item row="17" column="0"> <item row="18" column="0">
<widget class="QLabel" name="langlabel"> <widget class="QLabel" name="langlabel">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">

Loading…
Cancel
Save