main: socks5 proxy support

This commit is contained in:
xiphon 2020-07-30 21:26:40 +00:00
parent a563582d95
commit 749c166b10
3 changed files with 70 additions and 3 deletions

View file

@ -199,5 +199,6 @@ Popup {
Downloader {
id: downloader
proxyAddress: persistentSettings.getProxyAddress()
}
}

View file

@ -365,6 +365,7 @@ ApplicationWindow {
currentWallet.deviceButtonPressed.connect(onDeviceButtonPressed);
currentWallet.walletPassphraseNeeded.connect(onWalletPassphraseNeededWallet);
currentWallet.transactionCommitted.connect(onTransactionCommitted);
currentWallet.proxyAddress = Qt.binding(persistentSettings.getWalletProxyAddress);
middlePanel.paymentClicked.connect(handlePayment);
middlePanel.sweepUnmixableClicked.connect(handleSweepUnmixable);
middlePanel.getProofClicked.connect(handleGetProof);
@ -389,7 +390,9 @@ ApplicationWindow {
0,
persistentSettings.is_recovering,
persistentSettings.is_recovering_from_device,
persistentSettings.restore_height);
persistentSettings.restore_height,
persistentSettings.getWalletProxyAddress());
// save wallet keys in case wallet settings have been changed in the init
currentWallet.setPassword(walletPassword);
}
@ -607,7 +610,14 @@ ApplicationWindow {
const callback = function() {
persistentSettings.useRemoteNode = true;
currentDaemonAddress = persistentSettings.remoteNodeAddress;
currentWallet.initAsync(currentDaemonAddress, isTrustedDaemon());
currentWallet.initAsync(
currentDaemonAddress,
isTrustedDaemon(),
0,
false,
false,
0,
persistentSettings.getWalletProxyAddress());
walletManager.setDaemonAddressAsync(currentDaemonAddress);
};
@ -625,7 +635,14 @@ ApplicationWindow {
console.log("disconnecting remote node");
persistentSettings.useRemoteNode = false;
currentDaemonAddress = localDaemonAddress
currentWallet.initAsync(currentDaemonAddress, isTrustedDaemon());
currentWallet.initAsync(
currentDaemonAddress,
isTrustedDaemon(),
0,
false,
false,
0,
persistentSettings.getWalletProxyAddress());
walletManager.setDaemonAddressAsync(currentDaemonAddress);
firstBlockSeen = 0;
}
@ -1403,6 +1420,24 @@ ApplicationWindow {
property string fiatPriceProvider: "kraken"
property string fiatPriceCurrency: "xmrusd"
property string proxyAddress: "127.0.0.1:9050"
property bool proxyEnabled: false
function getProxyAddress() {
if (!proxyEnabled) {
return "";
}
if (proxyAddress == "") {
return "127.0.0.1:0";
}
return proxyAddress;
}
function getWalletProxyAddress() {
if (!useRemoteNode) {
return "";
}
return getProxyAddress();
}
Component.onCompleted: {
MoneroComponents.Style.blackTheme = persistentSettings.blackTheme
}
@ -2240,9 +2275,11 @@ ApplicationWindow {
Network {
id: network
proxyAddress: persistentSettings.getProxyAddress()
}
WalletManager {
id: walletManager
proxyAddress: persistentSettings.getProxyAddress()
}
}

View file

@ -251,6 +251,35 @@ Rectangle {
}
}
MoneroComponents.CheckBox {
id: proxyCheckbox
Layout.topMargin: 6
checked: persistentSettings.proxyEnabled
onClicked: {
persistentSettings.proxyEnabled = !persistentSettings.proxyEnabled;
}
text: qsTr("Socks5 proxy (%1%2)")
.arg(appWindow.walletMode >= 2 ? qsTr("remote node connections, ") : "")
.arg(qsTr("updates downloading, fetching price sources")) + translationManager.emptyString
}
MoneroComponents.RemoteNodeEdit {
id: proxyEdit
Layout.leftMargin: 36
Layout.topMargin: 6
Layout.minimumWidth: 100
placeholderFontSize: 15
visible: persistentSettings.proxyEnabled
daemonAddrLabelText: qsTr("IP address") + translationManager.emptyString
daemonPortLabelText: qsTr("Port") + translationManager.emptyString
initialAddress: persistentSettings.proxyAddress
onEditingFinished: {
persistentSettings.proxyAddress = proxyEdit.getAddress();
}
}
MoneroComponents.StandardButton {
visible: !persistentSettings.customDecorations
Layout.topMargin: 10