mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
- Switched to new RsAccounts interface.
- Reworked ServerPage to support HiddenNode configuration. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-initdev@7028 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
39db508ce7
commit
bbe3ee8d2f
@ -72,12 +72,12 @@ void GenCertDialog::init()
|
||||
std::list<std::string>::iterator it;
|
||||
bool foundGPGKeys = false;
|
||||
if (!mOnlyGenerateIdentity) {
|
||||
if (RsInit::GetPGPLogins(pgpIds)) {
|
||||
if (RsAccounts::GetPGPLogins(pgpIds)) {
|
||||
for(it = pgpIds.begin(); it != pgpIds.end(); it++)
|
||||
{
|
||||
QVariant userData(QString::fromStdString(*it));
|
||||
std::string name, email;
|
||||
RsInit::GetPGPLoginDetails(*it, name, email);
|
||||
RsAccounts::GetPGPLoginDetails(*it, name, email);
|
||||
std::cerr << "Adding PGPUser: " << name << " id: " << *it << std::endl;
|
||||
QString gid = QString::fromStdString(*it).right(8) ;
|
||||
ui.genPGPuser->addItem(QString::fromUtf8(name.c_str()) + " <" + QString::fromUtf8(email.c_str()) + "> (" + gid + ")", userData);
|
||||
@ -187,7 +187,7 @@ void GenCertDialog::exportIdentity()
|
||||
QVariant data = ui.genPGPuser->itemData(ui.genPGPuser->currentIndex());
|
||||
std::string gpg_id = data.toString().toStdString() ;
|
||||
|
||||
if(RsInit::exportIdentity(fname.toStdString(),gpg_id))
|
||||
if(RsAccounts::ExportIdentity(fname.toStdString(),gpg_id))
|
||||
QMessageBox::information(this,tr("Identity saved"),tr("Your identity was successfully saved\nIt is encrypted\n\nYou can now copy it to another computer\nand use the import button to load it")) ;
|
||||
else
|
||||
QMessageBox::information(this,tr("Identity not saved"),tr("Your identity was not saved. An error occurred.")) ;
|
||||
@ -203,7 +203,7 @@ void GenCertDialog::importIdentity()
|
||||
std::string gpg_id ;
|
||||
std::string err_string ;
|
||||
|
||||
if(!RsInit::importIdentity(fname.toStdString(),gpg_id,err_string))
|
||||
if(!RsAccounts::ImportIdentity(fname.toStdString(),gpg_id,err_string))
|
||||
{
|
||||
QMessageBox::information(this,tr("Identity not loaded"),tr("Your identity was not loaded properly:")+" \n "+QString::fromStdString(err_string)) ;
|
||||
return ;
|
||||
@ -212,7 +212,7 @@ void GenCertDialog::importIdentity()
|
||||
{
|
||||
std::string name,email ;
|
||||
|
||||
RsInit::GetPGPLoginDetails(gpg_id, name, email);
|
||||
RsAccounts::GetPGPLoginDetails(gpg_id, name, email);
|
||||
std::cerr << "Adding PGPUser: " << name << " id: " << gpg_id << std::endl;
|
||||
|
||||
QMessageBox::information(this,tr("New identity imported"),tr("Your identity was imported successfully:")+" \n"+"\nName :"+QString::fromStdString(name)+"\nemail: " + QString::fromStdString(email)+"\nKey ID: "+QString::fromStdString(gpg_id)+"\n\n"+tr("You can use it now to create a new location.")) ;
|
||||
@ -226,6 +226,7 @@ void GenCertDialog::genPerson()
|
||||
/* Check the data from the GUI. */
|
||||
std::string genLoc = ui.location_input->text().toUtf8().constData();
|
||||
std::string PGPId;
|
||||
bool isHiddenLoc = false;
|
||||
|
||||
if (ui.hidden_checkbox->isChecked())
|
||||
{
|
||||
@ -240,6 +241,7 @@ void GenCertDialog::genPerson()
|
||||
QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
isHiddenLoc = true;
|
||||
}
|
||||
|
||||
if (!genNewGPGKey) {
|
||||
@ -297,7 +299,7 @@ void GenCertDialog::genPerson()
|
||||
while(QAbstractEventDispatcher::instance()->processEvents(QEventLoop::AllEvents)) ;
|
||||
|
||||
std::string email_str = "" ;
|
||||
RsInit::GeneratePGPCertificate(ui.name_input->text().toUtf8().constData(), email_str.c_str(), ui.password_input->text().toUtf8().constData(), PGPId, err_string);
|
||||
RsAccounts::GeneratePGPCertificate(ui.name_input->text().toUtf8().constData(), email_str.c_str(), ui.password_input->text().toUtf8().constData(), PGPId, err_string);
|
||||
|
||||
setCursor(Qt::ArrowCursor) ;
|
||||
}
|
||||
@ -305,19 +307,19 @@ void GenCertDialog::genPerson()
|
||||
//generate a random ssl password
|
||||
std::string sslPasswd = RSRandom::random_alphaNumericString(RsInit::getSslPwdLen()) ;
|
||||
|
||||
/* Initialise the PGP user first */
|
||||
RsInit::SelectGPGAccount(PGPId);
|
||||
/* GenerateSSLCertificate - selects the PGP Account */
|
||||
//RsInit::SelectGPGAccount(PGPId);
|
||||
|
||||
std::string sslId;
|
||||
std::cerr << "GenCertDialog::genPerson() Generating SSL cert with gpg id : " << PGPId << std::endl;
|
||||
std::string err;
|
||||
bool okGen = RsInit::GenerateSSLCertificate(PGPId, "", genLoc, "", sslPasswd, sslId, err);
|
||||
bool okGen = RsAccounts::GenerateSSLCertificate(PGPId, "", genLoc, "", isHiddenLoc, sslPasswd, sslId, err);
|
||||
|
||||
if (okGen)
|
||||
{
|
||||
/* complete the process */
|
||||
RsInit::LoadPassword(sslId, sslPasswd);
|
||||
if (Rshare::loadCertificate(sslId, false, PGPId)) {
|
||||
RsInit::LoadPassword(sslPasswd);
|
||||
if (Rshare::loadCertificate(sslId, false)) {
|
||||
accept();
|
||||
}
|
||||
}
|
||||
|
@ -48,17 +48,17 @@ StartDialog::StartDialog(QWidget *parent)
|
||||
std::list<std::string> accountIds;
|
||||
std::list<std::string>::iterator it;
|
||||
std::string preferedId;
|
||||
RsInit::getPreferedAccountId(preferedId);
|
||||
RsAccounts::GetPreferredAccountId(preferedId);
|
||||
int pidx = -1;
|
||||
int i;
|
||||
|
||||
if (RsInit::getAccountIds(accountIds))
|
||||
if (RsAccounts::GetAccountIds(accountIds))
|
||||
{
|
||||
for(it = accountIds.begin(), i = 0; it != accountIds.end(); it++, i++)
|
||||
{
|
||||
const QVariant & userData = QVariant(QString::fromStdString(*it));
|
||||
std::string gpgid, name, email, location;
|
||||
RsInit::getAccountDetails(*it, gpgid, name, email, location);
|
||||
RsAccounts::GetAccountDetails(*it, gpgid, name, email, location);
|
||||
QString accountName = QString::fromUtf8(name.c_str()) + " (" + QString::fromStdString(gpgid).right(8) + ") - " + QString::fromUtf8(location.c_str());
|
||||
ui.loadName->addItem(accountName, userData);
|
||||
|
||||
@ -97,8 +97,6 @@ void StartDialog::loadPerson()
|
||||
QVariant data = ui.loadName->itemData(pgpidx);
|
||||
accountId = (data.toString()).toStdString();
|
||||
|
||||
RsInit::LoadPassword(accountId, "");
|
||||
|
||||
if (Rshare::loadCertificate(accountId, ui.autologin_checkbox->isChecked())) {
|
||||
accept();
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ void ChatStyle::styleChanged(int styleType)
|
||||
static QString getBaseDir()
|
||||
{
|
||||
// application path
|
||||
QString baseDir = QString::fromUtf8(RsInit::RsConfigDirectory().c_str());
|
||||
QString baseDir = QString::fromUtf8(RsAccounts::ConfigDirectory().c_str());
|
||||
|
||||
#ifdef WIN32
|
||||
if (RsInit::isPortable ()) {
|
||||
|
@ -99,10 +99,10 @@ void ProfileManager::fillIdentities()
|
||||
std::list<std::string> pgpIds;
|
||||
std::list<std::string>::iterator it;
|
||||
|
||||
if (RsInit::GetPGPLogins(pgpIds)) {
|
||||
if (RsAccounts::GetPGPLogins(pgpIds)) {
|
||||
for (it = pgpIds.begin(); it != pgpIds.end(); it++) {
|
||||
std::string name, email;
|
||||
RsInit::GetPGPLoginDetails(*it, name, email);
|
||||
RsAccounts::GetPGPLoginDetails(*it, name, email);
|
||||
std::cerr << "Adding PGPUser: " << name << " id: " << *it << std::endl;
|
||||
QString gid = QString::fromStdString(*it);
|
||||
|
||||
@ -138,7 +138,7 @@ void ProfileManager::exportIdentity()
|
||||
fname += ".asc";
|
||||
}
|
||||
|
||||
if (RsInit::exportIdentity(fname.toUtf8().constData(), gpgId))
|
||||
if (RsAccounts::ExportIdentity(fname.toUtf8().constData(), gpgId))
|
||||
QMessageBox::information(this, tr("Identity saved"), tr("Your identity was successfully saved\nIt is encrypted\n\nYou can now copy it to another computer\nand use the import button to load it"));
|
||||
else
|
||||
QMessageBox::information(this, tr("Identity not saved"), tr("Your identity was not saved. An error occurred."));
|
||||
@ -154,7 +154,7 @@ void ProfileManager::importIdentity()
|
||||
std::string gpg_id ;
|
||||
std::string err_string ;
|
||||
|
||||
if(!RsInit::importIdentity(fname.toUtf8().constData(),gpg_id,err_string))
|
||||
if(!RsAccounts::ImportIdentity(fname.toUtf8().constData(),gpg_id,err_string))
|
||||
{
|
||||
QMessageBox::information(this,tr("Identity not loaded"),tr("Your identity was not loaded properly:")+" \n "+QString::fromStdString(err_string)) ;
|
||||
return ;
|
||||
@ -163,7 +163,7 @@ void ProfileManager::importIdentity()
|
||||
{
|
||||
std::string name,email ;
|
||||
|
||||
RsInit::GetPGPLoginDetails(gpg_id, name, email);
|
||||
RsAccounts::GetPGPLoginDetails(gpg_id, name, email);
|
||||
std::cerr << "Adding PGPUser: " << name << " id: " << gpg_id << std::endl;
|
||||
|
||||
QMessageBox::information(this,tr("New identity imported"),tr("Your identity was imported successfully:")+" \n"+"\nName :"+QString::fromStdString(name)+"\nemail: " + QString::fromStdString(email)+"\nKey ID: "+QString::fromStdString(gpg_id)+"\n\n"+tr("You can use it now to create a new location.")) ;
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include "gui/style/RSStyle.h"
|
||||
|
||||
/** The file in which all settings of he peers will read and written. */
|
||||
#define SETTINGS_FILE (QString::fromUtf8(RsInit::RsProfileConfigDirectory().c_str()) + "/RSPeers.conf")
|
||||
#define SETTINGS_FILE (QString::fromUtf8(RsAccounts::ConfigDirectory().c_str()) + "/RSPeers.conf")
|
||||
|
||||
/* clean dead id's after these days */
|
||||
#define DAYS_TO_CLEAN 7
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include <QTimer>
|
||||
|
||||
ServerPage::ServerPage(QWidget * parent, Qt::WFlags flags)
|
||||
: ConfigPage(parent, flags)
|
||||
: ConfigPage(parent, flags), mIsHiddenNode(false)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
@ -84,10 +84,14 @@ ServerPage::ServerPage(QWidget * parent, Qt::WFlags flags)
|
||||
ui.tabWidget->widget(2)->layout()->addItem(verticalSpacer) ;
|
||||
ui.tabWidget->widget(2)->layout()->update() ;
|
||||
|
||||
ui.torPort->setVisible(false);
|
||||
/* Hide platform specific features */
|
||||
#ifdef Q_WS_WIN
|
||||
|
||||
#endif
|
||||
|
||||
std::cerr << "ServerPage::ServerPage() called";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
void ServerPage::showRoutingInfo()
|
||||
@ -135,6 +139,8 @@ ServerPage::save(QString &/*errmsg*/)
|
||||
/** Loads the settings for this page */
|
||||
void ServerPage::load()
|
||||
{
|
||||
std::cerr << "ServerPage::load() called";
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* load up configuration from rsPeers */
|
||||
RsPeerDetails detail;
|
||||
@ -143,6 +149,13 @@ void ServerPage::load()
|
||||
return;
|
||||
}
|
||||
|
||||
mIsHiddenNode = (detail.netMode == RS_NETMODE_HIDDEN);
|
||||
if (mIsHiddenNode)
|
||||
{
|
||||
loadHiddenNode();
|
||||
return;
|
||||
}
|
||||
|
||||
/* set net mode */
|
||||
int netIndex = 0;
|
||||
switch(detail.netMode)
|
||||
@ -236,12 +249,21 @@ void ServerPage::toggleTurtleRouting(bool b)
|
||||
/** Loads the settings for this page */
|
||||
void ServerPage::updateStatus()
|
||||
{
|
||||
std::cerr << "ServerPage::updateStatusd() called";
|
||||
std::cerr << std::endl;
|
||||
|
||||
if(RsAutoUpdatePage::eventsLocked())
|
||||
return ;
|
||||
|
||||
if(!isVisible())
|
||||
return ;
|
||||
|
||||
if (mIsHiddenNode)
|
||||
{
|
||||
updateStatusHiddenNode();
|
||||
return;
|
||||
}
|
||||
|
||||
/* load up configuration from rsPeers */
|
||||
RsPeerDetails detail;
|
||||
if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail))
|
||||
@ -315,6 +337,12 @@ void ServerPage::saveAddresses()
|
||||
|
||||
bool saveAddr = false;
|
||||
|
||||
if (mIsHiddenNode)
|
||||
{
|
||||
saveAddressesHiddenNode();
|
||||
return;
|
||||
}
|
||||
|
||||
RsPeerDetails detail;
|
||||
std::string ownId = rsPeers->getOwnId();
|
||||
|
||||
@ -327,6 +355,9 @@ void ServerPage::saveAddresses()
|
||||
uint32_t netMode = 0;
|
||||
switch(netIndex)
|
||||
{
|
||||
case 3:
|
||||
netMode = RS_NETMODE_HIDDEN;
|
||||
break;
|
||||
case 2:
|
||||
netMode = RS_NETMODE_EXT;
|
||||
break;
|
||||
@ -384,3 +415,219 @@ void ServerPage::saveAddresses()
|
||||
load();
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************/
|
||||
/***********************************************************************************/
|
||||
/******* ALTERNATIVE VERSION IF HIDDEN NODE ***************************************/
|
||||
/***********************************************************************************/
|
||||
/***********************************************************************************/
|
||||
|
||||
/** Loads the settings for this page */
|
||||
void ServerPage::loadHiddenNode()
|
||||
{
|
||||
std::cerr << "ServerPage::loadHiddenNode() called";
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* load up configuration from rsPeers */
|
||||
RsPeerDetails detail;
|
||||
if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* At this point we want to force the Configuration Page to look different
|
||||
* We will be called multiple times - so cannot just delete bad items.
|
||||
*
|
||||
* We want:
|
||||
* NETMODE: HiddenNode FIXED.
|
||||
* Disc/DHT: Discovery / No Discovery.
|
||||
* Local Address: 127.0.0.1, Port: Listening Port. (listening port changable)
|
||||
* External Address ==> TOR Address: 17621376587.onion + PORT.
|
||||
*
|
||||
* Known / Previous IPs: empty / removed.
|
||||
* Ask about IP: Disabled.
|
||||
*/
|
||||
|
||||
// FIXED.
|
||||
ui.netModeComboBox->setCurrentIndex(3);
|
||||
ui.netModeComboBox->setEnabled(false);
|
||||
|
||||
// CHANGE OPTIONS ON
|
||||
ui.discComboBox->removeItem(3);
|
||||
ui.discComboBox->removeItem(2);
|
||||
ui.discComboBox->removeItem(1);
|
||||
ui.discComboBox->removeItem(0);
|
||||
ui.discComboBox->insertItem (0, tr("Discovery On (recommended)"));
|
||||
ui.discComboBox->insertItem (1, tr("Discovery Off"));
|
||||
|
||||
int netIndex = 1; // OFF.
|
||||
if (detail.vs_disc != RS_VS_DISC_OFF)
|
||||
{
|
||||
netIndex = 0; // DISC ON;
|
||||
}
|
||||
ui.discComboBox->setCurrentIndex(netIndex);
|
||||
|
||||
// Download Rates - Stay the same as before.
|
||||
int dlrate = 0;
|
||||
int ulrate = 0;
|
||||
rsConfig->GetMaxDataRates(dlrate, ulrate);
|
||||
ui.totalDownloadRate->setValue(dlrate);
|
||||
ui.totalUploadRate->setValue(ulrate);
|
||||
|
||||
// Addresses.
|
||||
ui.localAddress->setEnabled(false);
|
||||
ui.localPort -> setEnabled(true);
|
||||
ui.extAddress -> setEnabled(true);
|
||||
ui.extPort -> setEnabled(true);
|
||||
|
||||
/* Addresses must be set here - otherwise can't edit it */
|
||||
/* set local address */
|
||||
ui.localAddress->setText(QString::fromStdString(detail.localAddr));
|
||||
ui.localPort -> setValue(detail.localPort);
|
||||
/* set the server address */
|
||||
|
||||
|
||||
ui.label_extAddress->setText(tr("TOR Onion Address"));
|
||||
ui.extAddress->setText(QString::fromStdString(detail.hiddenNodeAddress));
|
||||
ui.extPort -> setValue(detail.hiddenNodePort);
|
||||
|
||||
/* set DynDNS */
|
||||
ui.label_dynDNS -> setText("TOR Server Port");
|
||||
|
||||
std::string proxyaddr;
|
||||
uint16_t proxyport;
|
||||
rsPeers->getProxyServer(proxyaddr, proxyport);
|
||||
|
||||
ui.dynDNS -> setText(QString::fromStdString(proxyaddr));
|
||||
ui.torPort -> setVisible(true);
|
||||
ui.torPort -> setValue(proxyport);
|
||||
|
||||
ui.showDiscStatusBar->setChecked(Settings->getStatusBarFlags() & STATUSBAR_DISC);
|
||||
|
||||
ui._max_tr_up_per_sec_SB->setValue(rsTurtle->getMaxTRForwardRate()) ;
|
||||
ui._turtle_enabled_CB->setChecked(rsTurtle->enabled()) ;
|
||||
|
||||
// show what we have in ipAddresses. (should be nothing!)
|
||||
ui.ipAddressList->clear();
|
||||
for(std::list<std::string>::const_iterator it(detail.ipAddressList.begin());it!=detail.ipAddressList.end();++it)
|
||||
ui.ipAddressList->addItem(QString::fromStdString(*it));
|
||||
|
||||
ui.iconlabel_upnp->setPixmap(QPixmap(":/images/ledoff1.png"));
|
||||
ui.iconlabel_netLimited->setPixmap(QPixmap(":/images/ledoff1.png"));
|
||||
ui.iconlabel_ext->setPixmap(QPixmap(":/images/ledoff1.png"));
|
||||
|
||||
ui.allowIpDeterminationCB->setChecked(false);
|
||||
ui.allowIpDeterminationCB->setEnabled(false);
|
||||
ui.IPServersLV->setEnabled(false);
|
||||
}
|
||||
|
||||
/** Loads the settings for this page */
|
||||
void ServerPage::updateStatusHiddenNode()
|
||||
{
|
||||
std::cerr << "ServerPage::updateStatusHiddenNode() called";
|
||||
std::cerr << std::endl;
|
||||
|
||||
// THIS IS DISABLED FOR NOW.
|
||||
#if 0
|
||||
|
||||
/* load up configuration from rsPeers */
|
||||
RsPeerDetails detail;
|
||||
if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail))
|
||||
return;
|
||||
|
||||
/* only update if can't edit */
|
||||
if (!ui.localPort->isEnabled())
|
||||
{
|
||||
/* set local address */
|
||||
ui.localPort -> setValue(detail.localPort);
|
||||
ui.extPort -> setValue(detail.extPort);
|
||||
}
|
||||
|
||||
/* set local address */
|
||||
ui.localAddress->setText(QString::fromStdString(detail.localAddr));
|
||||
/* set the server address */
|
||||
ui.extAddress->setText(QString::fromStdString(detail.extAddr));
|
||||
|
||||
|
||||
// Now update network bits.
|
||||
RsConfigNetStatus net_status;
|
||||
rsConfig->getConfigNetStatus(net_status);
|
||||
|
||||
/******* Network Status Tab *******/
|
||||
|
||||
if(net_status.netUpnpOk)
|
||||
ui.iconlabel_upnp->setPixmap(QPixmap(":/images/ledon1.png"));
|
||||
else
|
||||
ui.iconlabel_upnp->setPixmap(QPixmap(":/images/ledoff1.png"));
|
||||
|
||||
if (net_status.netLocalOk)
|
||||
ui.iconlabel_netLimited->setPixmap(QPixmap(":/images/ledon1.png"));
|
||||
else
|
||||
ui.iconlabel_netLimited->setPixmap(QPixmap(":/images/ledoff1.png"));
|
||||
|
||||
if (net_status.netExtAddressOk)
|
||||
ui.iconlabel_ext->setPixmap(QPixmap(":/images/ledon1.png"));
|
||||
else
|
||||
ui.iconlabel_ext->setPixmap(QPixmap(":/images/ledoff1.png"));
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void ServerPage::saveAddressesHiddenNode()
|
||||
{
|
||||
RsPeerDetails detail;
|
||||
std::string ownId = rsPeers->getOwnId();
|
||||
|
||||
if (!rsPeers->getPeerDetails(ownId, detail))
|
||||
return;
|
||||
|
||||
// NETMODE IS UNCHANGABLE
|
||||
uint16_t vs_disc = 0;
|
||||
uint16_t vs_dht = 0;
|
||||
/* Check if vis has changed */
|
||||
switch(ui.discComboBox->currentIndex())
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
vs_disc = RS_VS_DISC_FULL;
|
||||
vs_dht = RS_VS_DHT_OFF;
|
||||
break;
|
||||
case 1:
|
||||
vs_disc = RS_VS_DISC_OFF;
|
||||
vs_dht = RS_VS_DHT_OFF;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((vs_disc != detail.vs_disc) || (vs_dht != detail.vs_dht))
|
||||
rsPeers->setVisState(ownId, vs_disc, vs_dht);
|
||||
|
||||
// Work out what we do with addresses!
|
||||
//rsPeers->setLocalAddress(ownId, ui.localAddress->text().toStdString(), ui.localPort->value());
|
||||
//rsPeers->setExtAddress(ownId, ui.extAddress->text().toStdString(), ui.extPort->value());
|
||||
|
||||
std::string hiddenAddr = ui.extAddress->text().toStdString();
|
||||
uint16_t hiddenPort = ui.extPort->value();
|
||||
if ((hiddenAddr != detail.hiddenNodeAddress) || (hiddenPort != detail.hiddenNodePort))
|
||||
{
|
||||
rsPeers->setHiddenNode(ownId, hiddenAddr, hiddenPort);
|
||||
}
|
||||
|
||||
|
||||
// HANDLE PROXY SERVER.
|
||||
std::string orig_proxyaddr;
|
||||
uint16_t orig_proxyport;
|
||||
rsPeers->getProxyServer(orig_proxyaddr, orig_proxyport);
|
||||
|
||||
std::string new_proxyaddr = ui.dynDNS -> text().toStdString();
|
||||
uint16_t new_proxyport = ui.torPort -> value();
|
||||
|
||||
if ((new_proxyaddr != orig_proxyaddr) || (new_proxyport != orig_proxyport))
|
||||
{
|
||||
rsPeers->setProxyServer(new_proxyaddr, new_proxyport);
|
||||
}
|
||||
|
||||
rsConfig->SetMaxDataRates( ui.totalDownloadRate->value(), ui.totalUploadRate->value() );
|
||||
load();
|
||||
}
|
||||
|
||||
|
@ -56,9 +56,18 @@ private slots:
|
||||
void toggleTurtleRouting(bool) ;
|
||||
|
||||
private:
|
||||
|
||||
// Alternative Versions for HiddenNode Mode.
|
||||
void loadHiddenNode();
|
||||
void updateStatusHiddenNode();
|
||||
void saveAddressesHiddenNode();
|
||||
|
||||
|
||||
Ui::ServerPage ui;
|
||||
|
||||
TurtleRouterDialog *_routing_info_page ;
|
||||
|
||||
bool mIsHiddenNode;
|
||||
};
|
||||
|
||||
#endif // !SERVERPAGE_H
|
||||
|
@ -126,14 +126,14 @@ peers still need to trust each other to allow connection. </string>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<widget class="QLabel" name="label_extAddress">
|
||||
<property name="text">
|
||||
<string>External Address</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<widget class="QLabel" name="label_dynDNS">
|
||||
<property name="text">
|
||||
<string>Dynamic DNS</string>
|
||||
</property>
|
||||
@ -159,10 +159,10 @@ peers still need to trust each other to allow connection. </string>
|
||||
<item row="0" column="2">
|
||||
<widget class="QSpinBox" name="localPort">
|
||||
<property name="toolTip">
|
||||
<string>Acceptable ports range from 1024 to 65535. Ports below 1024 are reserved by your system.</string>
|
||||
<string>Acceptable ports range from 10 to 65535. Normally Ports below 1024 are reserved by your system.</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1024</number>
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
@ -185,10 +185,10 @@ peers still need to trust each other to allow connection. </string>
|
||||
<item row="1" column="2">
|
||||
<widget class="QSpinBox" name="extPort">
|
||||
<property name="toolTip">
|
||||
<string>Acceptable ports range from 1024 to 65535. Ports below 1024 are reserved by your system.</string>
|
||||
<string>Acceptable ports range from 10 to 65535. Normally ports below 1024 are reserved by your system.</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1024</number>
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
@ -201,6 +201,29 @@ peers still need to trust each other to allow connection. </string>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLineEdit" name="dynDNS"/>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QSpinBox" name="torPort">
|
||||
<property name="toolTip">
|
||||
<string>The Port that TOR is listening to for outgoing connections. Normally 9100 or 9150</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1024</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>9100</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Port:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -27,14 +27,14 @@
|
||||
#include <retroshare/rsinit.h>
|
||||
|
||||
/** The file in which all settings will read and written. */
|
||||
#define SETTINGS_FILE (QString::fromUtf8(RsInit::RsProfileConfigDirectory().c_str()) + "/RetroShare.conf")
|
||||
#define SETTINGS_FILE (QString::fromUtf8(RsAccounts::AccountDirectory().c_str()) + "/RetroShare.conf")
|
||||
|
||||
/** Constructor */
|
||||
RSettings::RSettings(const QString settingsGroup)
|
||||
: QSettings(SETTINGS_FILE, QSettings::IniFormat)
|
||||
{
|
||||
std::string sPreferedId;
|
||||
m_bValid = RsInit::getPreferedAccountId(sPreferedId);
|
||||
m_bValid = RsAccounts::GetPreferredAccountId(sPreferedId);
|
||||
|
||||
if (!settingsGroup.isEmpty())
|
||||
beginGroup(settingsGroup);
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
static QMap<RsPlugin*, QTranslator*> translatorPlugins;
|
||||
|
||||
#define EXTERNAL_TRANSLATION_DIR QString::fromUtf8(RsInit::getRetroshareDataDirectory().c_str())
|
||||
#define EXTERNAL_TRANSLATION_DIR QString::fromUtf8(RsAccounts::DataDirectory().c_str())
|
||||
|
||||
/** Initializes the list of available languages. */
|
||||
QMap<QString, QString>
|
||||
|
@ -59,14 +59,17 @@
|
||||
|
||||
static void displayWarningAboutDSAKeys()
|
||||
{
|
||||
if(RsInit::unsupported_keys.empty())
|
||||
std::map<std::string,std::vector<std::string> > unsupported_keys;
|
||||
RsAccounts::GetUnsupportedKeys(unsupported_keys);
|
||||
|
||||
if(unsupported_keys.empty())
|
||||
return ;
|
||||
|
||||
QMessageBox msgBox;
|
||||
|
||||
QString txt = QObject::tr("You appear to have locations associated to DSA keys:");
|
||||
txt += "<UL>" ;
|
||||
for(std::map<std::string,std::vector<std::string> >::const_iterator it(RsInit::unsupported_keys.begin());it!=RsInit::unsupported_keys.end();++it)
|
||||
for(std::map<std::string,std::vector<std::string> >::const_iterator it(unsupported_keys.begin());it!=unsupported_keys.end();++it)
|
||||
{
|
||||
txt += "<LI>" + QString::fromStdString(it->first) ;
|
||||
txt += "<UL>" ;
|
||||
@ -134,7 +137,7 @@ int main(int argc, char *argv[])
|
||||
return 0 ;
|
||||
if(ret == QMessageBox::Ok)
|
||||
{
|
||||
if(!RsInit::copyGnuPGKeyrings())
|
||||
if(!RsAccounts::CopyGnuPGKeyrings())
|
||||
return 0 ;
|
||||
|
||||
initResult = RsInit::InitRetroShare(argc, argv);
|
||||
@ -180,7 +183,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Setup The GUI Stuff */
|
||||
Rshare rshare(args, argc, argv,
|
||||
QString::fromUtf8(RsInit::RsConfigDirectory().c_str()));
|
||||
QString::fromUtf8(RsAccounts::ConfigDirectory().c_str()));
|
||||
|
||||
std::string url = RsInit::getRetroShareLink();
|
||||
if (!url.empty()) {
|
||||
@ -202,7 +205,7 @@ int main(int argc, char *argv[])
|
||||
/* check for existing Certificate */
|
||||
bool genCert = false;
|
||||
std::list<std::string> accountIds;
|
||||
if (RsInit::getAccountIds(accountIds) && (accountIds.size() > 0))
|
||||
if (RsAccounts::GetAccountIds(accountIds) && (accountIds.size() > 0))
|
||||
{
|
||||
StartDialog sd;
|
||||
if (sd.exec() == QDialog::Rejected) {
|
||||
@ -234,7 +237,7 @@ int main(int argc, char *argv[])
|
||||
splashScreen.showMessage(rshare.translate("SplashScreen", "Load profile"), Qt::AlignHCenter | Qt::AlignBottom);
|
||||
|
||||
std::string preferredId;
|
||||
RsInit::getPreferedAccountId(preferredId);
|
||||
RsAccounts::GetPreferredAccountId(preferredId);
|
||||
|
||||
// true: note auto-login is active
|
||||
Rshare::loadCertificate(preferredId, true);
|
||||
|
@ -456,9 +456,9 @@ void Rshare::loadStyleSheet(const QString &sheetName)
|
||||
file.setFileName(":/qss/stylesheet/" + sheetName.mid(1) + ".qss");
|
||||
} else {
|
||||
/* external stylesheet */
|
||||
file.setFileName(QString::fromUtf8(RsInit::RsConfigDirectory().c_str()) + "/qss/" + sheetName + ".qss");
|
||||
file.setFileName(QString::fromUtf8(RsAccounts::ConfigDirectory().c_str()) + "/qss/" + sheetName + ".qss");
|
||||
if (!file.exists()) {
|
||||
file.setFileName(QString::fromUtf8(RsInit::getRetroshareDataDirectory().c_str()) + "/qss/" + sheetName + ".qss");
|
||||
file.setFileName(QString::fromUtf8(RsAccounts::DataDirectory().c_str()) + "/qss/" + sheetName + ".qss");
|
||||
}
|
||||
}
|
||||
if (file.open(QFile::ReadOnly)) {
|
||||
@ -488,14 +488,14 @@ void Rshare::getAvailableStyleSheets(QMap<QString, QString> &styleSheets)
|
||||
styleSheets.insert(QString("%1 (%2)").arg(name, tr("built-in")), ":" + name);
|
||||
}
|
||||
}
|
||||
fileInfoList = QDir(QString::fromUtf8(RsInit::RsConfigDirectory().c_str()) + "/qss/").entryInfoList(QStringList("*.qss"));
|
||||
fileInfoList = QDir(QString::fromUtf8(RsAccounts::ConfigDirectory().c_str()) + "/qss/").entryInfoList(QStringList("*.qss"));
|
||||
foreach (fileInfo, fileInfoList) {
|
||||
if (fileInfo.isFile()) {
|
||||
QString name = fileInfo.baseName();
|
||||
styleSheets.insert(name, name);
|
||||
}
|
||||
}
|
||||
fileInfoList = QDir(QString::fromUtf8(RsInit::getRetroshareDataDirectory().c_str()) + "/qss/").entryInfoList(QStringList("*.qss"));
|
||||
fileInfoList = QDir(QString::fromUtf8(RsAccounts::DataDirectory().c_str()) + "/qss/").entryInfoList(QStringList("*.qss"));
|
||||
foreach (fileInfo, fileInfoList) {
|
||||
if (fileInfo.isFile()) {
|
||||
QString name = fileInfo.baseName();
|
||||
@ -613,15 +613,10 @@ void Rshare::blinkTimer()
|
||||
}
|
||||
}
|
||||
|
||||
bool Rshare::loadCertificate(const std::string &accountId, bool autoLogin, std::string gpgId)
|
||||
bool Rshare::loadCertificate(const std::string &accountId, bool autoLogin)
|
||||
{
|
||||
if (!RsAccounts::SelectAccount(accountId))
|
||||
{
|
||||
if (gpgId.empty()) {
|
||||
std::string gpgName, gpgEmail, sslName;
|
||||
if (!RsInit::getAccountDetails(accountId, gpgId, gpgName, gpgEmail, sslName)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!RsInit::SelectGPGAccount(gpgId)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ public:
|
||||
/** Recalculates matching stylesheet for widget **/
|
||||
static void refreshStyleSheet(QWidget *widget, bool processChildren);
|
||||
|
||||
static bool loadCertificate(const std::string &accountId, bool autoLogin, std::string gpgId = "");
|
||||
static bool loadCertificate(const std::string &accountId, bool autoLogin);
|
||||
|
||||
/**
|
||||
* Update Language, Style and StyleSheet.
|
||||
|
Loading…
Reference in New Issue
Block a user