Browse Source

Allow setting IP for tor proxy

custom_themes
fekt 9 months ago
parent
commit
d06cc5af81
  1. 4
      src/connection.cpp
  2. 237
      src/createhushconfdialog.ui
  3. 53
      src/mainwindow.cpp
  4. 1
      src/mainwindow.h
  5. 283
      src/settings.ui

4
src/connection.cpp

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

237
src/createhushconfdialog.ui

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>508</width>
<height>352</height>
<height>369</height>
</rect>
</property>
<property name="windowTitle">
@ -95,93 +95,154 @@
<property name="title">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QCheckBox" name="chkCustomDatadir">
<property name="text">
<string>Use custom datadir</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Please choose a directory to store your wallet.dat and blockchain</string>
</property>
</widget>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="btnPickDir">
<property name="text">
<string>Choose directory</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblDirName">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="chkUseTor">
<property name="text">
<string>Connect over Tor</string>
</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</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 class="QCheckBox" name="chkCustomDatadir">
<property name="geometry">
<rect>
<x>8</x>
<y>8</y>
<width>148</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Use custom datadir</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>8</x>
<y>36</y>
<width>395</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string>Please choose a directory to store your wallet.dat and blockchain</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>8</x>
<y>102</y>
<width>16</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string notr="true"/>
</property>
</widget>
<widget class="QCheckBox" name="chkUseTor">
<property name="geometry">
<rect>
<x>8</x>
<y>126</y>
<width>133</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Connect over Tor</string>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>8</x>
<y>154</y>
<width>415</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string>Please note that you'll need to already have a Tor service configured</string>
</property>
</widget>
<widget class="QLabel" name="label_tor_port">
<property name="geometry">
<rect>
<x>178</x>
<y>178</y>
<width>49</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string>Tor Port</string>
</property>
</widget>
<widget class="QLineEdit" name="torPort">
<property name="geometry">
<rect>
<x>230</x>
<y>178</y>
<width>59</width>
<height>32</height>
</rect>
</property>
<property name="text">
<string notr="true">9050</string>
</property>
</widget>
<widget class="QLineEdit" name="torProxy">
<property name="geometry">
<rect>
<x>62</x>
<y>180</y>
<width>111</width>
<height>32</height>
</rect>
</property>
<property name="text">
<string notr="true">127.0.0.1</string>
</property>
</widget>
<widget class="QLabel" name="label_tor_proxy">
<property name="geometry">
<rect>
<x>10</x>
<y>180</y>
<width>49</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string>Proxy IP</string>
</property>
</widget>
<widget class="QWidget" name="">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="btnPickDir">
<property name="text">
<string>Choose directory</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblDirName">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>

53
src/mainwindow.cpp

@ -95,6 +95,9 @@ MainWindow::MainWindow(QWidget *parent) :
// Validate Address
QObject::connect(ui->actionValidate_Address, &QAction::triggered, this, &MainWindow::validateAddress);
// Get Block
//QObject::connect(ui->actionGet_Block, &QAction::triggered, this, &MainWindow::getBlock);
// Address Book
QObject::connect(ui->action_Address_Book, &QAction::triggered, this, &MainWindow::addressBook);
@ -700,8 +703,9 @@ void MainWindow::setupSettingsModal() {
if (!isUsingTor && settings.chkTor->isChecked()) {
// If "use tor" was previously unchecked and now checked
QString torProxy= settings.torProxy->text();
QString torPort = settings.torPort->text();
QString proxyConfig = "proxy=127.0.0.1:" % torPort;
QString proxyConfig = "proxy="%torProxy%":"%torPort;
Settings::addToHushConf(hushConfLocation, proxyConfig);
rpc->getConnection()->config->proxy = proxyConfig;
@ -896,8 +900,55 @@ void MainWindow::validateAddress() {
d.exec();
});
}
// Get block info
/*
void MainWindow::getBlock() {
// Make sure everything is up and running
if (!getRPC() || !getRPC()->getConnection())
return;
// First thing is ask the user for a blocj height
bool ok;
auto blockheight = QInputDialog::getText(this, tr("Enter Block Height"), QLineEdit::Normal, "", &ok);
if (!ok)
return;
getRPC()->validateAddress(address, [=] (QJsonValue props) {
QDialog d(this);
Ui_ValidateAddress va;
va.setupUi(&d);
Settings::saveRestore(&d);
Settings::saveRestoreTableHeader(va.tblProps, &d, "validateaddressprops");
va.tblProps->horizontalHeader()->setStretchLastSection(true);
va.lblAddress->setText(address);
QList<QPair<QString, QString>> propsList;
for (QString property_name: props.toObject().keys()) {
QString property_value;
if (props.toObject()[property_name].isString())
property_value = props.toObject()[property_name].toString();
else
property_value = props.toObject()[property_name].toBool() ? "true" : "false" ;
propsList.append(
QPair<QString, QString>( property_name,
property_value )
);
}
ValidateAddressesModel model(va.tblProps, propsList);
va.tblProps->setModel(&model);
d.exec();
});
}
*/
void MainWindow::doImport(QList<QString>* keys) {
if (rpc->getConnection() == nullptr) {

1
src/mainwindow.h

@ -52,6 +52,7 @@ public:
void payHushURI(QString uri = "", QString myAddr = "");
void validateAddress();
void getBlock();
void updateLabels();
void updateTAddrCombo(bool checked);

283
src/settings.ui

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>623</width>
<height>653</height>
<height>622</height>
</rect>
</property>
<property name="minimumSize">
@ -145,228 +145,165 @@
<string>Options</string>
</attribute>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<item row="0" column="0" colspan="3">
<widget class="QCheckBox" name="chkSaveTxs">
<property name="text">
<string>Remember shielded transactions</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="chkAutoShield">
<item row="1" column="0" colspan="5">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Shield change from t-Addresses to your sapling address</string>
<string>Shielded transactions are saved locally and shown in the transactions tab. If you uncheck this, shielded transactions will not appear in the transactions tab.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="1" column="5">
<widget class="QPushButton" name="btnClearSaved">
<property name="text">
<string>Clear History</string>
</property>
</widget>
</item>
<item row="12" column="0" colspan="2">
<widget class="QLabel" name="label_10">
<item row="2" column="0" colspan="3">
<widget class="QCheckBox" name="chkCustomFees">
<property name="text">
<string>Connect to the internet to fetch prices</string>
<string>Allow custom fees</string>
</property>
</widget>
</item>
<item row="14" column="0" colspan="2">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
<item row="3" column="0" colspan="6">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Allow overriding the default fees when sending transactions. Enabling this option may compromise your privacy since fees are transparent. </string>
</property>
</spacer>
</item>
<item row="15" column="1">
<widget class="QComboBox" name="comboBoxTheme">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<property name="wordWrap">
<bool>true</bool>
</property>
<item>
<property name="text">
<string notr="true">default</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">blue</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">light</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">dark</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">midnight</string>
</property>
</item>
<item>
<property name="text">
<string>dragonx</string>
</property>
</item>
</widget>
</item>
<item row="18" column="1">
<widget class="QComboBox" name="comboBoxLanguage">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<item row="4" column="0" colspan="5">
<widget class="QCheckBox" name="chkAutoShield">
<property name="text">
<string>Shield change from t-Addresses to your sapling address</string>
</property>
</widget>
</item>
<item row="8" column="0" colspan="2">
<widget class="QLabel" name="lblTor">
<item row="5" column="0" colspan="6">
<widget class="QLabel" name="label_7">
<property name="text">
<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>
<string>Normally, change from t-Addresses goes to another t-Address. Checking this option will send the change to your shielded sapling address instead. Check this option to increase your privacy.</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">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="15" column="0">
<widget class="QLabel" name="label_20">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item row="6" column="0" colspan="3">
<widget class="QCheckBox" name="chkTor">
<property name="text">
<string>Theme</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<string>Connect via Tor</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QLabel" name="label_6">
<item row="7" column="0" colspan="6">
<widget class="QLabel" name="lblTor">
<property name="text">
<string>Allow overriding the default fees when sending transactions. Enabling this option may compromise your privacy since fees are transparent. </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="10" column="0" colspan="2">
<widget class="QCheckBox" name="chkCheckUpdates">
<item row="8" column="0">
<widget class="QLabel" name="label_tor_proxy">
<property name="text">
<string>Check git.hush.is for updates at startup</string>
<string>Proxy IP</string>
</property>
</widget>
</item>
<item row="12" column="0" colspan="2">
<widget class="QCheckBox" name="chkFetchPrices">
<item row="8" column="1" colspan="2">
<widget class="QLineEdit" name="torProxy">
<property name="text">
<string>Fetch prices</string>
<string notr="true">127.0.0.1</string>
</property>
</widget>
</item>
<item row="11" column="0" colspan="2">
<widget class="QLabel" name="label_8">
<item row="8" column="3">
<widget class="QLabel" name="label_tor_port">
<property name="text">
<string>Connect to git.hush.is on startup to check for updates</string>
<string>Tor Port</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="chkCustomFees">
<item row="8" column="4">
<widget class="QLineEdit" name="torPort">
<property name="text">
<string>Allow custom fees</string>
<string notr="true">9050</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="label_5">
<item row="9" column="0" colspan="6">
<widget class="QCheckBox" name="chkCheckUpdates">
<property name="text">
<string>Shielded transactions are saved locally and shown in the transactions tab. If you uncheck this, shielded transactions will not appear in the transactions tab.</string>
<string>Connect to git.hush.is on startup to check for updates</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</widget>
</item>
<item row="10" column="0" colspan="6">
<widget class="QCheckBox" name="chkFetchPrices">
<property name="text">
<string>Connect to the internet to fetch prices</string>
</property>
</widget>
</item>
<item row="16" column="0">
<widget class="QLabel" name="label_201">
<item row="11" column="2">
<widget class="QComboBox" name="comboBoxTheme">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Local Currency</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QCheckBox" name="chkTor">
<property name="text">
<string>Connect via Tor</string>
</property>
<item>
<property name="text">
<string notr="true">default</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">blue</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">light</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">dark</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">midnight</string>
</property>
</item>
<item>
<property name="text">
<string>dragonx</string>
</property>
</item>
</widget>
</item>
<item row="18" column="0">
<widget class="QLabel" name="langlabel">
<item row="12" column="0" colspan="2">
<widget class="QLabel" name="label_201">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
@ -374,14 +311,14 @@
</sizepolicy>
</property>
<property name="text">
<string>Language</string>
<string>Local Currency</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="16" column="1">
<item row="12" column="2">
<widget class="QComboBox" name="comboBoxCurrency">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
@ -606,13 +543,45 @@
</item>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QLabel" name="label_7">
<item row="13" column="0" colspan="2">
<widget class="QLabel" name="langlabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Normally, change from t-Addresses goes to another t-Address. Checking this option will send the change to your shielded sapling address instead. Check this option to increase your privacy.</string>
<string>Language</string>
</property>
<property name="wordWrap">
<bool>true</bool>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="13" column="2">
<widget class="QComboBox" name="comboBoxLanguage">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="11" column="0" colspan="2">
<widget class="QLabel" name="label_20">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Theme</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>

Loading…
Cancel
Save