added ifdef and option to enable/disable embeded friend server

This commit is contained in:
csoler 2022-01-10 17:48:33 +01:00
parent 3bd9188a33
commit 69f6adb6b4
7 changed files with 110 additions and 38 deletions

View File

@ -147,7 +147,6 @@ PUBLIC_HEADERS = retroshare/rsdisc.h \
retroshare/rsrtt.h \
retroshare/rsconfig.h \
retroshare/rsversion.h \
retroshare/rsfriendserver.h \
retroshare/rsservicecontrol.h \
retroshare/rsgxsdistsync.h
@ -409,10 +408,6 @@ HEADERS += pqi/authssl.h \
pqi/pqinetstatebox.h \
pqi/p3servicecontrol.h
SOURCES += friend_server/fsclient.h \
friend_server/fsitem.h \
friend_server/fsmanager.h
HEADERS += rsserver/p3face.h \
rsserver/p3history.h \
rsserver/p3msgs.h \
@ -582,9 +577,6 @@ SOURCES += pqi/authgpg.cc \
pqi/pqinetstatebox.cc \
pqi/p3servicecontrol.cc
SOURCES += friend_server/fsclient.cc \
friend_server/fsmanager.cc
SOURCES += rsserver/p3face-config.cc \
rsserver/p3face-server.cc \
rsserver/p3face-info.cc \
@ -842,6 +834,22 @@ wikipoos {
rsitems/rswikiitems.cc \
}
# Friend server
rs_efs {
DEFINES *= RS_EMBEDED_FRIEND_SERVER
HEADERS += friend_server/fsclient.h \
friend_server/fsitem.h \
friend_server/fsmanager.h \
retroshare/rsfriendserver.h
SOURCES += friend_server/fsclient.cc \
friend_server/fsmanager.cc
}
# The Wire
gxsthewire {
DEFINES *= RS_USE_WIRE

View File

@ -51,7 +51,10 @@
#include "retroshare/rsversion.h"
#include "rsserver/rsloginhandler.h"
#include "rsserver/rsaccounts.h"
#ifdef RS_EMBEDED_FRIEND_SERVER
#include "friend_server/fsmanager.h"
#endif
#include <list>
#include <string>
@ -1176,8 +1179,10 @@ int RsServer::StartupRetroShare()
serviceCtrl->setServiceServer(pqih) ;
#ifdef RS_EMBEDED_FRIEND_SERVER
// setup friend server
rsFriendServer = new FriendServerManager();
#endif
/****** New Ft Server **** !!! */
ftServer *ftserver = new ftServer(mPeerMgr, serviceCtrl);

View File

@ -23,6 +23,7 @@
#include <QTcpSocket>
#include "retroshare/rsfriendserver.h"
#include "retroshare/rstor.h"
#include "util/qtthreadsutils.h"
#include "gui/common/FilesDefs.h"
@ -36,6 +37,7 @@
/** Constructor */
FriendServerControl::FriendServerControl(QWidget *parent)
: QWidget(parent)
{
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
@ -66,6 +68,18 @@ FriendServerControl::FriendServerControl(QWidget *parent)
serverStatusCheckResult_LB->setMovie(mCheckingServerMovie);
updateFriendServerStatusIcon(false);
updateTorProxyInfo();
}
void FriendServerControl::updateTorProxyInfo()
{
std::string friend_proxy_address;
uint16_t friend_proxy_port;
RsTor::getProxyServerInfo(friend_proxy_address,friend_proxy_port);
torProxyPort_SB->setValue(friend_proxy_port);
torProxyAddress_LE->setText(QString::fromStdString(friend_proxy_address));
}
FriendServerControl::~FriendServerControl()
@ -83,34 +97,39 @@ void FriendServerControl::onOnOffClick(bool b)
}
void FriendServerControl::onOnionPortEdit(int)
{
// Setup timer to auto-check the friend server address
mConnectionCheckTimer->setSingleShot(true);
mConnectionCheckTimer->setInterval(5000); // check in 5 secs unless something is changed in the mean time.
mConnectionCheckTimer->start();
if(mCheckingServerMovie->fileName() != QString(":/images/loader/circleball-16.gif" ))
{
mCheckingServerMovie->setFileName(":/images/loader/circleball-16.gif");
mCheckingServerMovie->start();
}
#warning TODO
// // Setup timer to auto-check the friend server address
//
// mConnectionCheckTimer->setSingleShot(true);
// mConnectionCheckTimer->setInterval(5000); // check in 5 secs unless something is changed in the mean time.
//
// mConnectionCheckTimer->start();
//
// if(mCheckingServerMovie->fileName() != QString(":/images/loader/circleball-16.gif" ))
// {
// mCheckingServerMovie->setFileName(":/images/loader/circleball-16.gif");
// mCheckingServerMovie->start();
// }
rsFriendServer->setServerAddress(torServerAddress_LE->text().toStdString(),torServerPort_SB->value());
rsFriendServer->setProxyAddress(torProxyAddress_LE->text().toStdString(),torProxyPort_SB->value());
}
void FriendServerControl::onOnionAddressEdit(const QString&)
{
// Setup timer to auto-check the friend server address
mConnectionCheckTimer->setSingleShot(true);
mConnectionCheckTimer->setInterval(5000); // check in 5 secs unless something is changed in the mean time.
mConnectionCheckTimer->start();
if(mCheckingServerMovie->fileName() != QString(":/images/loader/circleball-16.gif" ))
{
mCheckingServerMovie->setFileName(":/images/loader/circleball-16.gif");
mCheckingServerMovie->start();
}
// mConnectionCheckTimer->setSingleShot(true);
// mConnectionCheckTimer->setInterval(5000); // check in 5 secs unless something is changed in the mean time.
//
// mConnectionCheckTimer->start();
//
// if(mCheckingServerMovie->fileName() != QString(":/images/loader/circleball-16.gif" ))
// {
// mCheckingServerMovie->setFileName(":/images/loader/circleball-16.gif");
// mCheckingServerMovie->start();
// }
rsFriendServer->setServerAddress(torServerAddress_LE->text().toStdString(),torServerPort_SB->value());
rsFriendServer->setProxyAddress(torProxyAddress_LE->text().toStdString(),torProxyPort_SB->value());
}
void FriendServerControl::checkServerAddress()

View File

@ -37,6 +37,7 @@ protected slots:
void onOnionAddressEdit(const QString&);
void onOnionPortEdit(int);
void onNbFriendsToRequestsChanged(int n);
void updateTorProxyInfo();
private:
void checkServerAddress();

View File

@ -73,7 +73,20 @@
</sizepolicy>
</property>
<property name="text">
<string>127.0.0.1</string>
<string>.onion</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="torServerPort_SB">
<property name="minimum">
<number>1025</number>
</property>
<property name="maximum">
<number>65536</number>
</property>
<property name="value">
<number>2017</number>
</property>
</widget>
</item>
@ -98,23 +111,43 @@
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Server port:</string>
<string>Tor proxy address:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="torServerPort_SB">
<widget class="QLineEdit" name="torProxyAddress_LE">
<property name="text">
<string>127.0.0.1</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="torProxyPort_SB">
<property name="minimum">
<number>1025</number>
</property>
<property name="maximum">
<number>65536</number>
<number>65535</number>
</property>
<property name="value">
<number>2017</number>
<number>9050</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">

View File

@ -89,7 +89,9 @@ FriendsDialog::FriendsDialog(QWidget *parent) : MainPage(parent)
ui.avatar->setFrameType(AvatarWidget::STATUS_FRAME);
ui.tabWidget->setTabPosition(QTabWidget::North);
#ifdef RS_EMBEDED_FRIEND_SERVER
ui.tabWidget->addTab(friendServerControl = new FriendServerControl(),QIcon(IMAGE_PEERS), tr("Friend Server"));
#endif
ui.tabWidget->addTab(networkView = new NetworkView(),QIcon(IMAGE_NETWORK2), tr("Network graph"));
ui.tabWidget->addTab(networkDialog = new NetworkDialog(),QIcon(IMAGE_PEERS), tr("Keyring"));

View File

@ -383,7 +383,6 @@ HEADERS += rshare.h \
gui/AboutDialog.h \
gui/AboutWidget.h \
gui/NetworkView.h \
gui/FriendServerControl.h \
gui/FriendsDialog.h \
gui/ServicePermissionDialog.h \
gui/RemoteDirModel.h \
@ -648,7 +647,6 @@ FORMS += gui/StartDialog.ui \
gui/FileTransfer/BannedFilesDialog.ui \
gui/MainWindow.ui \
gui/NetworkView.ui \
gui/FriendServerControl.ui \
gui/FriendsDialog.ui \
gui/ShareManager.ui \
# gui/ShareDialog.ui \
@ -769,7 +767,6 @@ SOURCES += main.cpp \
gui/mainpagestack.cpp \
gui/MainWindow.cpp \
gui/NetworkView.cpp \
gui/FriendServerControl.cpp \
gui/FriendsDialog.cpp \
gui/ServicePermissionDialog.cpp \
gui/RemoteDirModel.cpp \
@ -1092,6 +1089,13 @@ DEFINES *= CHANNELS_FRAME_CATCHER
}
# Embedded Friend Server
rs_efs {
SOURCES += gui/FriendServerControl.cpp
HEADERS += gui/FriendServerControl.h
FORMS += gui/FriendServerControl.ui
}
# BELOW IS GXS Unfinished Services.