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
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();

23
src/createhushconfdialog.ui

@ -40,7 +40,7 @@
</property>
</widget>
</item>
<item row="6" column="1">
<item row="7" column="1">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -148,6 +148,7 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="chkUseTor">
<property name="text">
@ -155,13 +156,31 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_5">
<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>
</widget>
</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>
</widget>
</item>

6
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."),

33
src/settings.ui

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

Loading…
Cancel
Save