From 3912c6562eb2c328b7421fcb163f810f7e190c9d Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 6 Oct 2020 23:02:00 +0200 Subject: [PATCH] fixed bugs causing short invites to not generate/parse hidden nodes with correct options to keep hidden address --- libretroshare/src/rsserver/p3peers.cc | 4 ++-- retroshare-gui/src/gui/HomePage.cpp | 7 +++---- retroshare-gui/src/gui/HomePage.ui | 7 +++++-- retroshare-gui/src/gui/connect/ConfCertDialog.cpp | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/libretroshare/src/rsserver/p3peers.cc b/libretroshare/src/rsserver/p3peers.cc index 35be7e728..0e2a04df4 100644 --- a/libretroshare/src/rsserver/p3peers.cc +++ b/libretroshare/src/rsserver/p3peers.cc @@ -1392,7 +1392,7 @@ bool p3Peers::parseShortInvite(const std::string& inviteStrUrl, RsPeerDetails& d case RsShortInviteFieldType::HIDDEN_LOCATOR: details.hiddenType = (((uint32_t)buf[0]) << 24)+(((uint32_t)buf[1])<<16)+(((uint32_t)buf[2])<<8) + (uint32_t)buf[3]; details.hiddenNodePort = (((uint32_t)buf[4]) << 8)+ (uint32_t)buf[5]; - + details.isHiddenNode = true; details.hiddenNodeAddress = std::string((char*)&buf[6],s-6); break; @@ -1538,7 +1538,7 @@ std::string p3Peers::GetRetroshareInvite( if (getPeerDetails(ssl_id, detail)) { - if(!includeExtraLocators) detail.ipAddressList.clear(); + if(!includeExtraLocators && !detail.isHiddenNode) detail.ipAddressList.clear(); unsigned char *mem_block = nullptr; size_t mem_block_size = 0; diff --git a/retroshare-gui/src/gui/HomePage.cpp b/retroshare-gui/src/gui/HomePage.cpp index 0cfacb041..1b5861dc6 100644 --- a/retroshare-gui/src/gui/HomePage.cpp +++ b/retroshare-gui/src/gui/HomePage.cpp @@ -189,8 +189,6 @@ void HomePage::updateOwnCert() void HomePage::updateOwnId() { - bool include_extra_locators = mIncludeAllIPs; - RsPeerDetails detail; if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail)) @@ -199,9 +197,10 @@ void HomePage::updateOwnId() return ; } - std::string invite ; + bool include_extra_locators = mIncludeAllIPs || detail.isHiddenNode; + std::string invite ; - rsPeers->getShortInvite(invite,rsPeers->getOwnId(),true,!mIncludeAllIPs); + rsPeers->getShortInvite(invite,rsPeers->getOwnId(),true,!include_extra_locators); ui->retroshareid->setText(QString::fromUtf8(invite.c_str())); } diff --git a/retroshare-gui/src/gui/HomePage.ui b/retroshare-gui/src/gui/HomePage.ui index 3e303b4e9..be4bf8fe1 100644 --- a/retroshare-gui/src/gui/HomePage.ui +++ b/retroshare-gui/src/gui/HomePage.ui @@ -174,7 +174,7 @@ private and secure decentralized communication platform. ... - + :/icons/help_64.png:/icons/help_64.png @@ -232,6 +232,9 @@ private and secure decentralized communication platform. + + false + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse @@ -338,8 +341,8 @@ private and secure decentralized communication platform. - + diff --git a/retroshare-gui/src/gui/connect/ConfCertDialog.cpp b/retroshare-gui/src/gui/connect/ConfCertDialog.cpp index 92ab22142..cfbd839c1 100644 --- a/retroshare-gui/src/gui/connect/ConfCertDialog.cpp +++ b/retroshare-gui/src/gui/connect/ConfCertDialog.cpp @@ -277,7 +277,7 @@ void ConfCertDialog::loadInvitePage() if(ui._shortFormat_CB->isChecked()) { - rsPeers->getShortInvite(invite,detail.id,true,!ui._includeIPHistory_CB->isChecked() ); + rsPeers->getShortInvite(invite,detail.id,true,!(ui._includeIPHistory_CB->isChecked()|| detail.isHiddenNode) ); ui.stabWidget->setTabText(1, tr("Retroshare ID")); } else