mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-01 18:56:23 -04:00
Prepare for merging
This commit is contained in:
parent
b1860d8682
commit
1d4ca64dee
27 changed files with 1442 additions and 992 deletions
|
@ -100,8 +100,10 @@ void JsonApiPage::load()
|
|||
|
||||
QStringList newTk;
|
||||
|
||||
for(const auto& it : rsJsonAPI->getAuthorizedTokens())
|
||||
newTk.push_back(QString::fromStdString(it.first)+":"+QString::fromStdString(it.second)) ;
|
||||
for(const auto& it : rsJsonApi->getAuthorizedTokens())
|
||||
newTk.push_back(
|
||||
QString::fromStdString(it.first) + ":" +
|
||||
QString::fromStdString(it.second) );
|
||||
|
||||
whileBlocking(ui.tokensListView)->setModel(new QStringListModel(newTk));
|
||||
}
|
||||
|
@ -113,19 +115,17 @@ bool JsonApiPage::checkStartJsonApi()
|
|||
if(!Settings->getJsonApiEnabled())
|
||||
return false;
|
||||
|
||||
rsJsonAPI->setListeningPort(Settings->getJsonApiPort());
|
||||
rsJsonAPI->setBindingAddress(Settings->getJsonApiListenAddress().toStdString());
|
||||
rsJsonAPI->restart();
|
||||
rsJsonApi->setListeningPort(Settings->getJsonApiPort());
|
||||
rsJsonApi->setBindingAddress(Settings->getJsonApiListenAddress().toStdString());
|
||||
rsJsonApi->restart();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*static*/ void JsonApiPage::checkShutdownJsonApi()
|
||||
{
|
||||
if(!rsJsonAPI->isRunning())
|
||||
return;
|
||||
|
||||
rsJsonAPI->stop(); // this is a blocking call until the thread is terminated.
|
||||
if(!rsJsonApi->isRunning()) return;
|
||||
rsJsonApi->fullstop(); // this is a blocks until the thread is terminated.
|
||||
}
|
||||
|
||||
void JsonApiPage::onApplyClicked()
|
||||
|
@ -138,9 +138,10 @@ void JsonApiPage::onApplyClicked()
|
|||
|
||||
void JsonApiPage::checkToken(QString s)
|
||||
{
|
||||
std::string user,passwd;
|
||||
std::string user,passwd;
|
||||
bool valid = RsJsonApi::parseToken(s.toStdString(), user, passwd) &&
|
||||
!user.empty() && !passwd.empty();
|
||||
|
||||
bool valid = RsJsonAPI::parseToken(s.toStdString(),user,passwd) && !user.empty() && !passwd.empty();
|
||||
QColor color;
|
||||
|
||||
if(!valid)
|
||||
|
@ -160,15 +161,16 @@ void JsonApiPage::addTokenClicked()
|
|||
QString token(ui.tokenLineEdit->text());
|
||||
std::string user,passwd;
|
||||
|
||||
if(!RsJsonAPI::parseToken(token.toStdString(),user,passwd))
|
||||
return;
|
||||
if(!RsJsonApi::parseToken(token.toStdString(),user,passwd)) return;
|
||||
|
||||
rsJsonAPI->authorizeUser(user,passwd);
|
||||
rsJsonApi->authorizeUser(user,passwd);
|
||||
|
||||
QStringList newTk;
|
||||
|
||||
for(const auto& it : rsJsonAPI->getAuthorizedTokens())
|
||||
newTk.push_back(QString::fromStdString(it.first)+":"+QString::fromStdString(it.second)) ;
|
||||
for(const auto& it : rsJsonApi->getAuthorizedTokens())
|
||||
newTk.push_back(
|
||||
QString::fromStdString(it.first) + ":" +
|
||||
QString::fromStdString(it.second) );
|
||||
|
||||
whileBlocking(ui.tokensListView)->setModel(new QStringListModel(newTk));
|
||||
}
|
||||
|
@ -176,12 +178,14 @@ void JsonApiPage::addTokenClicked()
|
|||
void JsonApiPage::removeTokenClicked()
|
||||
{
|
||||
QString token(ui.tokenLineEdit->text());
|
||||
rsJsonAPI->revokeAuthToken(token.toStdString());
|
||||
rsJsonApi->revokeAuthToken(token.toStdString());
|
||||
|
||||
QStringList newTk;
|
||||
|
||||
for(const auto& it : rsJsonAPI->getAuthorizedTokens())
|
||||
newTk.push_back(QString::fromStdString(it.first)+":"+QString::fromStdString(it.second)) ;
|
||||
for(const auto& it : rsJsonApi->getAuthorizedTokens())
|
||||
newTk.push_back(
|
||||
QString::fromStdString(it.first) + ":" +
|
||||
QString::fromStdString(it.second) );
|
||||
|
||||
whileBlocking(ui.tokensListView)->setModel(new QStringListModel(Settings->getJsonApiAuthTokens()) );
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ void WebuiPage::load()
|
|||
whileBlocking(ui.webInterfaceFiles_LE)->setText(Settings->getWebinterfaceFilesDirectory());
|
||||
|
||||
#ifdef RS_JSONAPI
|
||||
auto smap = rsJsonAPI->getAuthorizedTokens();
|
||||
auto smap = rsJsonApi->getAuthorizedTokens();
|
||||
auto it = smap.find("webui");
|
||||
|
||||
if(it != smap.end())
|
||||
|
@ -151,10 +151,14 @@ QString WebuiPage::helpText() const
|
|||
|
||||
/*static*/ void WebuiPage::showWebui()
|
||||
{
|
||||
if(Settings->getWebinterfaceEnabled())
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl(QString("http://localhost:")+QString::number(rsJsonAPI->listeningPort())));
|
||||
}
|
||||
if(Settings->getWebinterfaceEnabled())
|
||||
{
|
||||
QUrl webuiUrl;
|
||||
webuiUrl.setScheme("http");
|
||||
webuiUrl.setHost(QString::fromStdString(rsJsonApi->getBindingAddress()));
|
||||
webuiUrl.setPort(rsJsonApi->listeningPort());
|
||||
QDesktopServices::openUrl(webuiUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::warning(0, tr("Webinterface not enabled"), tr("The webinterface is not enabled. Enable it in Settings -> Webinterface."));
|
||||
|
@ -200,8 +204,4 @@ void WebuiPage::onApplyClicked()
|
|||
emit passwordChanged();
|
||||
}
|
||||
|
||||
void WebuiPage::onStartWebBrowserClicked()
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl(QString("http://localhost:")+QString::number(rsJsonAPI->listeningPort())));
|
||||
}
|
||||
|
||||
void WebuiPage::onStartWebBrowserClicked() { showWebui(); }
|
||||
|
|
|
@ -28,13 +28,12 @@ DEFINES += TARGET=\\\"$${TARGET}\\\"
|
|||
DEPENDPATH *= $${PWD} $${RS_INCLUDE_DIR} retroshare-gui
|
||||
INCLUDEPATH *= $${PWD} retroshare-gui
|
||||
|
||||
!include("../../libretroshare/src/use_libretroshare.pri"):error("Including")
|
||||
|
||||
rs_webui {
|
||||
!include("../../libresapi/src/use_libresapi.pri"):error("Including")
|
||||
HEADERS *= gui/settings/WebuiPage.h
|
||||
SOURCES *= gui/settings/WebuiPage.cpp
|
||||
FORMS *= gui/settings/WebuiPage.ui
|
||||
} else {
|
||||
!include("../../libretroshare/src/use_libretroshare.pri"):error("Including")
|
||||
}
|
||||
|
||||
rs_jsonapi {
|
||||
|
@ -273,9 +272,9 @@ macx {
|
|||
mac_icon.files = $$files($$PWD/rsMacIcon.icns)
|
||||
mac_icon.path = Contents/Resources
|
||||
QMAKE_BUNDLE_DATA += mac_icon
|
||||
mac_webui.files = $$files($$PWD/../../libresapi/src/webui)
|
||||
mac_webui.path = Contents/Resources
|
||||
QMAKE_BUNDLE_DATA += mac_webui
|
||||
# mac_webui.files = $$files($$PWD/../../libresapi/src/webui)
|
||||
# mac_webui.path = Contents/Resources
|
||||
# QMAKE_BUNDLE_DATA += mac_webui
|
||||
|
||||
CONFIG += version_detail_bash_script
|
||||
LIBS += -lssl -lcrypto -lz
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue