Merge pull request #3033

749c166 main: socks5 proxy support (xiphon)
This commit is contained in:
luigi1111 2020-09-12 15:49:57 -05:00
commit fd956b54b5
No known key found for this signature in database
GPG key ID: F4ACA0183641E010
3 changed files with 70 additions and 3 deletions

View file

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

View file

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