From b5f95cb6516baeb1ab442198496faa4f94958d8c Mon Sep 17 00:00:00 2001 From: Gio Date: Thu, 14 Jul 2016 22:48:44 +0200 Subject: [PATCH] libresapilocal is now optional (enabled by default) --- libresapi/src/libresapi.pro | 16 ++++++++++------ retroshare-gui/src/gui/settings/WebuiPage.cpp | 10 +++++++++- retroshare-gui/src/gui/settings/WebuiPage.h | 2 ++ retroshare.pri | 6 ++++++ 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/libresapi/src/libresapi.pro b/libresapi/src/libresapi.pro index 01dd68ffb..bf51989f8 100644 --- a/libresapi/src/libresapi.pro +++ b/libresapi/src/libresapi.pro @@ -3,8 +3,7 @@ TEMPLATE = lib CONFIG += staticlib CONFIG += create_prl -CONFIG += qt -QT += network +CONFIG -= qt TARGET = resapi TARGET_PRL = libresapi DESTDIR = lib @@ -147,8 +146,7 @@ SOURCES += \ api/TmpBlobStore.cpp \ util/ContentTypes.cpp \ api/ApiPluginHandler.cpp \ - api/ChannelsHandler.cpp \ - api/ApiServerLocal.cpp + api/ChannelsHandler.cpp HEADERS += \ api/ApiServer.h \ @@ -174,5 +172,11 @@ HEADERS += \ api/TmpBlobStore.h \ util/ContentTypes.h \ api/ApiPluginHandler.h \ - api/ChannelsHandler.h \ - api/ApiServerLocal.h + api/ChannelsHandler.h + +libresapilocalserver { + CONFIG *= qt + QT *= network + SOURCES *= api/ApiServerLocal.cpp + HEADERS *= api/ApiServerLocal.h +} diff --git a/retroshare-gui/src/gui/settings/WebuiPage.cpp b/retroshare-gui/src/gui/settings/WebuiPage.cpp index 9a9f98a8f..8e8c3498b 100644 --- a/retroshare-gui/src/gui/settings/WebuiPage.cpp +++ b/retroshare-gui/src/gui/settings/WebuiPage.cpp @@ -15,7 +15,10 @@ resource_api::ApiServer* WebuiPage::apiServer = 0; resource_api::ApiServerMHD* WebuiPage::apiServerMHD = 0; +// TODO: LIBRESAPI_LOCAL_SERVER Move in appropriate place +#ifdef LIBRESAPI_LOCAL_SERVER resource_api::ApiServerLocal* WebuiPage::apiServerLocal = 0; +#endif resource_api::RsControlModule* WebuiPage::controlModule = 0; WebuiPage::WebuiPage(QWidget */*parent*/, Qt::WindowFlags /*flags*/) @@ -95,8 +98,10 @@ QString WebuiPage::helpText() const Settings->getWebinterfaceAllowAllIps()); apiServerMHD->start(); +// TODO: LIBRESAPI_LOCAL_SERVER Move in appropriate place +#ifdef LIBRESAPI_LOCAL_SERVER apiServerLocal = new resource_api::ApiServerLocal(apiServer); - +#endif return ok; } @@ -107,8 +112,11 @@ QString WebuiPage::helpText() const apiServerMHD->stop(); delete apiServerMHD; apiServerMHD = 0; +// TODO: LIBRESAPI_LOCAL_SERVER Move in appropriate place +#ifdef LIBRESAPI_LOCAL_SERVER delete apiServerLocal; apiServerLocal = 0; +#endif delete apiServer; apiServer = 0; delete controlModule; diff --git a/retroshare-gui/src/gui/settings/WebuiPage.h b/retroshare-gui/src/gui/settings/WebuiPage.h index 879d26ee8..7da68c21d 100644 --- a/retroshare-gui/src/gui/settings/WebuiPage.h +++ b/retroshare-gui/src/gui/settings/WebuiPage.h @@ -49,6 +49,8 @@ private: static resource_api::ApiServer* apiServer; static resource_api::ApiServerMHD* apiServerMHD; + #ifdef LIBRESAPI_LOCAL_SERVER static resource_api::ApiServerLocal* apiServerLocal; + #endif static resource_api::RsControlModule* controlModule; }; diff --git a/retroshare.pri b/retroshare.pri index bdedd670a..76f68bbed 100644 --- a/retroshare.pri +++ b/retroshare.pri @@ -1,3 +1,7 @@ +# To {dis,en}able libresapi via local socket (unix domain socket or windows named pipes) +# {,un}comment the following line +CONFIG *= libresapilocalserver + # Gxs is always enabled now. DEFINES *= RS_ENABLE_GXS @@ -62,3 +66,5 @@ unfinished { } wikipoos:DEFINES *= RS_USE_WIKI + +libresapilocalserver:DEFINES *= LIBRESAPI_LOCAL_SERVER