mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 15:39:27 -05:00
only load hidden nodes in retro-only mode
This commit is contained in:
parent
5b5a2bef81
commit
f5ce711ad6
@ -10,6 +10,9 @@ DESTDIR = lib
|
|||||||
|
|
||||||
#CONFIG += dsdv
|
#CONFIG += dsdv
|
||||||
|
|
||||||
|
retrotor {
|
||||||
|
DEFINES *= RETROTOR
|
||||||
|
}
|
||||||
# the dht stunner is used to obtain RS' external ip addr. when it is natted
|
# the dht stunner is used to obtain RS' external ip addr. when it is natted
|
||||||
# this system is unreliable and rs supports a newer and better one (asking connected peers)
|
# this system is unreliable and rs supports a newer and better one (asking connected peers)
|
||||||
# CONFIG += useDhtStunner
|
# CONFIG += useDhtStunner
|
||||||
|
@ -71,8 +71,11 @@ RsAccountsDetail::RsAccountsDetail() : mAccountsLocked(false), mPreferredId("")
|
|||||||
bool RsAccountsDetail::loadAccounts()
|
bool RsAccountsDetail::loadAccounts()
|
||||||
{
|
{
|
||||||
int failing_accounts ;
|
int failing_accounts ;
|
||||||
|
#ifdef RETROTOR
|
||||||
getAvailableAccounts(mAccounts,failing_accounts,mUnsupportedKeys);
|
getAvailableAccounts(mAccounts,failing_accounts,mUnsupportedKeys,true);
|
||||||
|
#else
|
||||||
|
getAvailableAccounts(mAccounts,failing_accounts,mUnsupportedKeys,false);
|
||||||
|
#endif
|
||||||
|
|
||||||
loadPreferredAccount();
|
loadPreferredAccount();
|
||||||
checkPreferredId();
|
checkPreferredId();
|
||||||
@ -512,7 +515,7 @@ bool RsAccountsDetail::getAccountOptions(bool &ishidden, bool &isFirstTimeRun)
|
|||||||
|
|
||||||
|
|
||||||
/* directories with valid certificates in the expected location */
|
/* directories with valid certificates in the expected location */
|
||||||
bool RsAccountsDetail::getAvailableAccounts(std::map<RsPeerId, AccountDetails> &accounts,int& failing_accounts,std::map<std::string,std::vector<std::string> >& unsupported_keys)
|
bool RsAccountsDetail::getAvailableAccounts(std::map<RsPeerId, AccountDetails> &accounts,int& failing_accounts,std::map<std::string,std::vector<std::string> >& unsupported_keys,bool hidden_only)
|
||||||
{
|
{
|
||||||
failing_accounts = 0 ;
|
failing_accounts = 0 ;
|
||||||
/* get the directories */
|
/* get the directories */
|
||||||
@ -615,6 +618,9 @@ bool RsAccountsDetail::getAvailableAccounts(std::map<RsPeerId, AccountDetails> &
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(hidden_only && !hidden_location)
|
||||||
|
continue ;
|
||||||
|
|
||||||
if(valid_prefix && isHexaString(lochex) && (lochex).length() == 32)
|
if(valid_prefix && isHexaString(lochex) && (lochex).length() == 32)
|
||||||
{
|
{
|
||||||
std::string accountdir = mBaseDirectory + "/" + *it;
|
std::string accountdir = mBaseDirectory + "/" + *it;
|
||||||
|
@ -142,9 +142,9 @@ class RsAccountsDetail
|
|||||||
|
|
||||||
static bool defaultBaseDirectory();
|
static bool defaultBaseDirectory();
|
||||||
|
|
||||||
bool getAvailableAccounts(std::map<RsPeerId, AccountDetails> &accounts,
|
bool getAvailableAccounts(std::map<RsPeerId, AccountDetails> &accounts,
|
||||||
int& failing_accounts,
|
int& failing_accounts,
|
||||||
std::map<std::string,std::vector<std::string> >& unsupported_keys);
|
std::map<std::string,std::vector<std::string> >& unsupported_keys, bool hidden_only=false);
|
||||||
|
|
||||||
bool setupAccount(const std::string& accountdir);
|
bool setupAccount(const std::string& accountdir);
|
||||||
|
|
||||||
|
@ -118,6 +118,7 @@ QString TorManager::dataDirectory() const
|
|||||||
void TorManager::setDataDirectory(const QString &path)
|
void TorManager::setDataDirectory(const QString &path)
|
||||||
{
|
{
|
||||||
d->dataDir = QDir::fromNativeSeparators(path);
|
d->dataDir = QDir::fromNativeSeparators(path);
|
||||||
|
|
||||||
if (!d->dataDir.isEmpty() && !d->dataDir.endsWith(QLatin1Char('/')))
|
if (!d->dataDir.isEmpty() && !d->dataDir.endsWith(QLatin1Char('/')))
|
||||||
d->dataDir.append(QLatin1Char('/'));
|
d->dataDir.append(QLatin1Char('/'));
|
||||||
}
|
}
|
||||||
|
@ -289,21 +289,25 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
|||||||
torManager->setDataDirectory(Rshare::dataDirectory() + QString("/tor/"));
|
torManager->setDataDirectory(Rshare::dataDirectory() + QString("/tor/"));
|
||||||
torManager->start();
|
torManager->start();
|
||||||
|
|
||||||
TorControlDialog tcd(torManager) ;
|
// We do not need to show this dialog. If too much of a pain, we may hide it and only show when it reports an error.
|
||||||
tcd.show();
|
|
||||||
|
|
||||||
while(tcd.checkForTor() == TorControlDialog::TOR_STATUS_UNKNOWN) // runs until some status is reached: either tor works, or it fails.
|
|
||||||
{
|
{
|
||||||
QCoreApplication::processEvents();
|
TorControlDialog tcd(torManager) ;
|
||||||
usleep(1000) ;
|
tcd.show();
|
||||||
}
|
|
||||||
|
|
||||||
tcd.hide();
|
while(tcd.checkForTor() == TorControlDialog::TOR_STATUS_UNKNOWN) // runs until some status is reached: either tor works, or it fails.
|
||||||
|
{
|
||||||
|
QCoreApplication::processEvents();
|
||||||
|
usleep(1000) ;
|
||||||
|
}
|
||||||
|
|
||||||
if(tcd.checkForTor() != TorControlDialog::TOR_STATUS_OK)
|
tcd.hide();
|
||||||
{
|
|
||||||
QMessageBox::critical(NULL,QObject::tr("Tor not found!"),QObject::tr("Tor wasn't found on your system. Please install it and re-start Retroshare.")) ;
|
if(tcd.checkForTor() != TorControlDialog::TOR_STATUS_OK)
|
||||||
return 1 ;
|
{
|
||||||
|
QMessageBox::critical(NULL,QObject::tr("Tor not found!"),QObject::tr("Tor wasn't found on your system. Please install it and re-start Retroshare.")) ;
|
||||||
|
return 1 ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -374,22 +378,25 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
|||||||
#ifdef RETROTOR
|
#ifdef RETROTOR
|
||||||
// Now that we know the Tor service running, and we know the SSL id, we can make sure it provides a viable hidden service
|
// Now that we know the Tor service running, and we know the SSL id, we can make sure it provides a viable hidden service
|
||||||
|
|
||||||
/* Tor control manager */
|
|
||||||
|
|
||||||
tcd.show();
|
|
||||||
|
|
||||||
while(tcd.checkForHiddenService() == TorControlDialog::HIDDEN_SERVICE_STATUS_UNKNOWN) // runs until some status is reached: either tor works, or it fails.
|
|
||||||
{
|
{
|
||||||
QCoreApplication::processEvents();
|
torManager->setDataDirectory(Rshare::dataDirectory() + QString("/tor/")); // re-set it, because now it's changed to the specific location that is run
|
||||||
usleep(1000) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
tcd.hide();
|
TorControlDialog tcd(torManager) ;
|
||||||
|
tcd.show();
|
||||||
|
|
||||||
if(tcd.checkForHiddenService() != TorControlDialog::HIDDEN_SERVICE_STATUS_OK)
|
while(tcd.checkForHiddenService() == TorControlDialog::HIDDEN_SERVICE_STATUS_UNKNOWN) // runs until some status is reached: either tor works, or it fails.
|
||||||
{
|
{
|
||||||
QMessageBox::critical(NULL,QObject::tr("Cannot start a hidden tor service!"),QObject::tr("It was not possible to start a hidden service.")) ;
|
QCoreApplication::processEvents();
|
||||||
return 1 ;
|
usleep(1000) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
tcd.hide();
|
||||||
|
|
||||||
|
if(tcd.checkForHiddenService() != TorControlDialog::HIDDEN_SERVICE_STATUS_OK)
|
||||||
|
{
|
||||||
|
QMessageBox::critical(NULL,QObject::tr("Cannot start a hidden tor service!"),QObject::tr("It was not possible to start a hidden service.")) ;
|
||||||
|
return 1 ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user