diff --git a/RetroShare.pro b/RetroShare.pro index e04442e4d..845cdd3a6 100644 --- a/RetroShare.pro +++ b/RetroShare.pro @@ -29,6 +29,12 @@ rs_jsonapi:isEmpty(JSONAPI_GENERATOR_EXE) { libretroshare.depends += jsonapi-generator } +rs_webui { + !rs_jsonapi { + error("rs_webui requires rs_jsonapi") + } +} + SUBDIRS += libbitdht libbitdht.file = libbitdht/src/libbitdht.pro libretroshare.depends += openpgpsdk libbitdht diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index 48dae7fa0..74519dd92 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -61,7 +61,6 @@ #include "gxstunnel/p3gxstunnel.h" #include "retroshare/rsgxsdistsync.h" #include "file_sharing/p3filelists.h" -#include "jsonapi/jsonapi.h" #define ENABLE_GROUTER @@ -97,6 +96,10 @@ RsDht *rsDht = NULL ; #ifdef RS_JSONAPI # include "jsonapi/jsonapi.h" +#ifdef RS_WEBUI +#include "jsonapi/jsonapi.h" +#endif + #endif #ifdef RS_BROADCAST_DISCOVERY diff --git a/retroshare-gui/src/gui/AboutWidget.cpp b/retroshare-gui/src/gui/AboutWidget.cpp index a6ec24358..c2b07a6fe 100644 --- a/retroshare-gui/src/gui/AboutWidget.cpp +++ b/retroshare-gui/src/gui/AboutWidget.cpp @@ -23,7 +23,9 @@ #include "HelpDialog.h" #include "rshare.h" +#ifdef RS_JSONAPI #include "restbed" +#endif #include #include @@ -970,13 +972,13 @@ void AboutWidget::on_copy_button_clicked() RsControl::instance()->getLibraries(libraries); verInfo+=addLibraries("libretroshare", libraries); -// #ifdef RS_WEBUI -// /* Add version numbers of RetroShare */ -// // Add versions here. Find a better place. -// libraries.clear(); -// libraries.push_back(RsLibraryInfo("RestBed", restbed::get_version())); -// verInfo+=addLibraries("RetroShare", libraries); -// #endif +#ifdef RS_JSONAPI + /* Add version numbers of RetroShare */ + // Add versions here. Find a better place. + libraries.clear(); + libraries.push_back(RsLibraryInfo("RestBed", restbed::get_version())); + verInfo+=addLibraries("RetroShare", libraries); +#endif /* Add version numbers of plugins */ if (rsPlugins) { diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp index 72d422db0..6ec0c22f7 100644 --- a/retroshare-gui/src/gui/MainWindow.cpp +++ b/retroshare-gui/src/gui/MainWindow.cpp @@ -606,8 +606,10 @@ void MainWindow::createTrayIcon() trayMenu->addAction(QIcon(IMAGE_MESSENGER), tr("Open Messenger"), this, SLOT(showMessengerWindow())); #endif trayMenu->addAction(QIcon(IMAGE_MESSAGES), tr("Open Messages"), this, SLOT(showMess())); +#ifdef RS_JSONAPI #ifdef RS_WEBUI trayMenu->addAction(QIcon(":/images/emblem-web.png"), tr("Show web interface"), this, SLOT(showWebinterface())); +#endif #endif trayMenu->addAction(QIcon(IMAGE_BWGRAPH), tr("Bandwidth Graph"), this, SLOT(showBandwidthGraph())); trayMenu->addAction(QIcon(IMAGE_STATS), tr("Statistics"), this, SLOT(showStatisticsWindow())); @@ -1117,12 +1119,14 @@ void MainWindow::showStatisticsWindow() StatisticsWindow::showYourself(); } +#ifdef RS_JSONAPI #ifdef RS_WEBUI void MainWindow::showWebinterface() { WebuiPage::showWebui(); } #endif // ENABLE_WEBUI +#endif /** Shows Application window */ #ifdef UNFINISHED diff --git a/retroshare-gui/src/gui/MainWindow.h b/retroshare-gui/src/gui/MainWindow.h index d60524bd2..5240cdce3 100644 --- a/retroshare-gui/src/gui/MainWindow.h +++ b/retroshare-gui/src/gui/MainWindow.h @@ -230,8 +230,10 @@ private slots: void showMessengerWindow(); #endif void showStatisticsWindow(); +#ifdef RS_JSONAPI #ifdef RS_WEBUI void showWebinterface(); +#endif #endif //void servicePermission(); diff --git a/retroshare-gui/src/gui/settings/rsharesettings.cpp b/retroshare-gui/src/gui/settings/rsharesettings.cpp index 3f5ced4fc..e47362b10 100644 --- a/retroshare-gui/src/gui/settings/rsharesettings.cpp +++ b/retroshare-gui/src/gui/settings/rsharesettings.cpp @@ -30,8 +30,9 @@ #include "rsharesettings.h" #include "gui/MainWindow.h" -// for this one, we'd rather use a file in retroshare/*h list. -#include +#ifdef RS_JSONAPI +#include +#endif #include #include diff --git a/retroshare-gui/src/main.cpp b/retroshare-gui/src/main.cpp index d0d68b2dc..f0130ac86 100644 --- a/retroshare-gui/src/main.cpp +++ b/retroshare-gui/src/main.cpp @@ -574,11 +574,11 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO); #ifdef RS_JSONAPI JsonApiPage::checkStartJsonApi(); -#endif // RS_JSONAPI #ifdef RS_WEBUI WebuiPage::checkStartWebui(); // normally we should rather save the UI flags internally to p3webui #endif +#endif // RS_JSONAPI // This is done using a timer, because the passphrase request from notify is asynchrouneous and therefore clearing the // passphrase here makes it request for a passphrase when creating the default chat identity. diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro index 86a393a33..d5099aa03 100644 --- a/retroshare-gui/src/retroshare-gui.pro +++ b/retroshare-gui/src/retroshare-gui.pro @@ -31,10 +31,12 @@ INCLUDEPATH *= $${PWD} retroshare-gui !include("../../libretroshare/src/use_libretroshare.pri"):error("Including") rs_webui { +rs_jsonapi { HEADERS *= gui/settings/WebuiPage.h SOURCES *= gui/settings/WebuiPage.cpp FORMS *= gui/settings/WebuiPage.ui } +} rs_jsonapi { HEADERS *= gui/settings/JsonApiPage.h diff --git a/retroshare-service/src/retroshare-service.cc b/retroshare-service/src/retroshare-service.cc index bceddf983..7242b08e4 100644 --- a/retroshare-service/src/retroshare-service.cc +++ b/retroshare-service/src/retroshare-service.cc @@ -23,11 +23,11 @@ #ifdef RS_JSONAPI #include "retroshare/rsjsonapi.h" -#endif #ifdef RS_WEBUI #include "retroshare/rswebui.h" #endif +#endif static CrashStackTrace gCrashStackTrace; @@ -124,10 +124,11 @@ int main(int argc, char* argv[]) std::string prefUserString; RsConfigOptions conf; - std::string webui_base_directory = RsWebUi::DEFAULT_BASE_DIRECTORY; - #ifdef RS_JSONAPI conf.jsonApiPort = RsJsonApi::DEFAULT_PORT; // enable JSonAPI by default +#ifdef RS_WEBUI + std::string webui_base_directory = RsWebUi::DEFAULT_BASE_DIRECTORY; +#endif #endif argstream as(argc,argv); @@ -164,7 +165,7 @@ int main(int argc, char* argv[]) "127.0.0.1.", false ); #endif // def RS_JSONAPI -#if (defined(RS_JSONAPI) || defined(RS_WEBUI)) && defined(RS_SERVICE_TERMINAL_WEBUI_PASSWORD) +#if (defined(RS_JSONAPI) && defined(RS_WEBUI)) && defined(RS_SERVICE_TERMINAL_WEBUI_PASSWORD) bool askWebUiPassword = false; as >> parameter( 'B', "webui-directory", webui_base_directory, "Place where to find the html/js files for the webui.",false ); as >> option( 'W', "webui-password", askWebUiPassword, "Ask WebUI password on the console." ); @@ -185,7 +186,7 @@ int main(int argc, char* argv[]) as >> help( 'h', "help", "Display this Help" ); as.defaultErrorHandling(true, true); -#if (defined(RS_JSONAPI) || defined(RS_WEBUI)) && defined(RS_SERVICE_TERMINAL_WEBUI_PASSWORD) +#if (defined(RS_JSONAPI) && defined(RS_WEBUI)) && defined(RS_SERVICE_TERMINAL_WEBUI_PASSWORD) std::string webui_pass1 = "Y"; if(askWebUiPassword) { @@ -308,7 +309,7 @@ int main(int argc, char* argv[]) } #endif // def RS_SERVICE_TERMINAL_LOGIN -#if (defined(RS_JSONAPI) || defined(RS_WEBUI)) && defined(RS_SERVICE_TERMINAL_WEBUI_PASSWORD) +#if (defined(RS_JSONAPI) && defined(RS_WEBUI)) && defined(RS_SERVICE_TERMINAL_WEBUI_PASSWORD) if(rsJsonAPI && !webui_pass1.empty()) { rsWebUI->setHtmlFilesDirectory(webui_base_directory); diff --git a/retroshare.pri b/retroshare.pri index d140f9867..b6a786251 100644 --- a/retroshare.pri +++ b/retroshare.pri @@ -180,10 +180,10 @@ rs_use_native_dialogs:CONFIG -= no_rs_use_native_dialogs CONFIG *= rs_broadcast_discovery no_rs_broadcast_discovery:CONFIG -= rs_broadcast_discovery -# To disable webui append the following assignation to qmake -# command line "CONFIG+=rs_no_webui" -CONFIG *= rs_webui -rs_no_webui:CONFIG -= rs_webui +# To enable webui append the following assignation to qmake +# command line "CONFIG+=rs_webui" +CONFIG *= rs_no_webui +rs_webui:CONFIG -= rs_no_webui # To enable webui append the following assignation to qmake # command line "CONFIG+=rs_service_webui_terminal_password"