Merge pull request #2655 from RetroPooh/tor-status-fix

tor status fix for unconfigured, add update on settings change; fix i2p out led status
This commit is contained in:
csoler 2023-03-04 17:18:02 +01:00 committed by GitHub
commit b3dba19b72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 41 additions and 12 deletions

View File

@ -1628,6 +1628,10 @@ NATStatus *MainWindow::natstatusInstance()
return natstatus;
}
void MainWindow::torstatusReset()
{
torstatus->reset();
}
DHTStatus *MainWindow::dhtstatusInstance()
{
return dhtstatus;

View File

@ -187,6 +187,7 @@ public:
RSComboBox *statusComboBoxInstance();
PeerStatus *peerstatusInstance();
NATStatus *natstatusInstance();
void torstatusReset();
DHTStatus *dhtstatusInstance();
HashingStatus *hashingstatusInstance();
DiscStatus *discstatusInstance();

View File

@ -21,6 +21,7 @@
#include "ServerPage.h"
#include <gui/notifyqt.h>
#include "gui/MainWindow.h"
#include "rshare.h"
#include "rsharesettings.h"
#include "util/i2pcommon.h"
@ -1366,6 +1367,7 @@ void ServerPage::saveAddressesHiddenNode()
void ServerPage::updateOutProxyIndicator()
{
MainWindow::getInstance()->torstatusReset();
QTcpSocket socket ;
// Tor
@ -1382,6 +1384,8 @@ void ServerPage::updateOutProxyIndicator()
ui.iconlabel_tor_outgoing->setToolTip(tr("Tor proxy is not enabled")) ;
}
if (mHiddenType == RS_HIDDEN_TYPE_I2P && mSamSettings.enable)
{
// I2P - SAM
// Note: there is only "the SAM port", there is no additional proxy port!
samStatus ss;
@ -1397,7 +1401,22 @@ void ServerPage::updateOutProxyIndicator()
ui.iconlabel_i2p_outgoing->setPixmap(FilesDefs::getPixmapFromQtResourcePath(ICON_STATUS_UNKNOWN)) ;
ui.iconlabel_i2p_outgoing->setToolTip(tr("I2P proxy is not enabled")) ;
}
}
else
{
socket.connectToHost(ui.hiddenpage_proxyAddress_i2p->text(),ui.hiddenpage_proxyPort_i2p->text().toInt());
if(socket.waitForConnected(500))
{
socket.disconnectFromHost();
ui.iconlabel_i2p_outgoing->setPixmap(FilesDefs::getPixmapFromQtResourcePath(ICON_STATUS_OK)) ;
ui.iconlabel_i2p_outgoing->setToolTip(tr("Proxy seems to work.")) ;
}
else
{
ui.iconlabel_i2p_outgoing->setPixmap(FilesDefs::getPixmapFromQtResourcePath(ICON_STATUS_UNKNOWN)) ;
ui.iconlabel_i2p_outgoing->setToolTip(tr("I2P proxy is not enabled")) ;
}
}
socket.connectToHost(ui.hiddenpage_proxyAddress_i2p_2->text(), 7656);
if(true == (mSamAccessible = socket.waitForConnected(1000)))
{

View File

@ -168,7 +168,7 @@ void TorStatus::getTorStatus()
torstatusLabel->setToolTip( text + tr("Tor proxy is not available"));
}
}
if(hiddentype == RS_HIDDEN_TYPE_I2P)
else if(hiddentype == RS_HIDDEN_TYPE_I2P)
{
statusTor->setText("<strong>" + tr("I2P") + ":</strong>");
rsPeers->getProxyServer(RS_HIDDEN_TYPE_I2P, proxyaddr, proxyport, status);
@ -185,6 +185,11 @@ void TorStatus::getTorStatus()
torstatusLabel->setToolTip( text + tr("i2p proxy is not available"));
}
}
else
{
torstatusLabel->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":/icons/tile_inactive_48.png").scaledToHeight(S,Qt::SmoothTransformation));
torstatusLabel->setToolTip(tr("No tor configuration"));
}
_updated = true;
}
}