mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-28 16:17:28 -04:00
fixed retroshare_service with embedded webui
This commit is contained in:
parent
2123ad7645
commit
997501a24d
8 changed files with 66 additions and 35 deletions
|
@ -48,11 +48,13 @@ static constexpr char *mime_types[3] = {
|
|||
};
|
||||
|
||||
#ifdef WINDOWS_SYS
|
||||
static std::string _base_directory = "data/webui";
|
||||
const std::string RsWebUI::DEFAULT_BASE_DIRECTORY = "data/webui";
|
||||
#else
|
||||
static std::string _base_directory = "/usr/share/retroshare/webui/";
|
||||
const std::string RsWebUI::DEFAULT_BASE_DIRECTORY = "/usr/share/retroshare/webui/";
|
||||
#endif
|
||||
|
||||
static std::string _base_directory = RsWebUI::DEFAULT_BASE_DIRECTORY;
|
||||
|
||||
|
||||
template<int MIME_TYPE_INDEX> class handler
|
||||
{
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
#include "gxstunnel/p3gxstunnel.h"
|
||||
#include "retroshare/rsgxsdistsync.h"
|
||||
#include "file_sharing/p3filelists.h"
|
||||
#include "jsonapi/jsonapi.h"
|
||||
|
||||
#define ENABLE_GROUTER
|
||||
|
||||
|
@ -391,6 +392,22 @@ int RsInit::InitRetroShare(const RsConfigOptions& conf)
|
|||
if(!RsAccounts::init(rsInitConfig->optBaseDir,error_code))
|
||||
return error_code ;
|
||||
|
||||
#ifdef RS_JSONAPI
|
||||
// We create the JsonApiServer this early, because it is needed *before* login
|
||||
|
||||
RsInfo() << "Allocating jsonAPI server (not launched yet) " << std::endl;
|
||||
JsonApiServer *jas = new JsonApiServer();
|
||||
jas->setListeningPort(conf.jsonApiPort);
|
||||
jas->setBindingAddress(conf.jsonApiBindAddress);
|
||||
|
||||
if(conf.jsonApiPort != NULL)
|
||||
{
|
||||
RsInfo() << "Launching jsonAPI server on port " << conf.jsonApiPort << std::endl;
|
||||
jas->restart();
|
||||
}
|
||||
|
||||
rsJsonAPI = jas;
|
||||
#endif
|
||||
|
||||
#ifdef RS_AUTOLOGIN
|
||||
/* check that we have selected someone */
|
||||
|
@ -408,16 +425,6 @@ int RsInit::InitRetroShare(const RsConfigOptions& conf)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef RS_JSONAPI
|
||||
if(rsInitConfig->jsonApiPort)
|
||||
{
|
||||
rsJsonAPI->setListeningPort(rsInitConfig->jsonApiPort);
|
||||
rsJsonAPI->setBindingAddress(rsInitConfig->jsonApiBindAddress);
|
||||
rsJsonAPI->restart();
|
||||
}
|
||||
|
||||
#endif // ifdef RS_JSONAPI
|
||||
|
||||
return RS_INIT_OK;
|
||||
}
|
||||
|
||||
|
@ -1217,13 +1224,10 @@ int RsServer::StartupRetroShare()
|
|||
mPluginsManager->loadPlugins(programatically_inserted_plugins) ;
|
||||
|
||||
#ifdef RS_JSONAPI
|
||||
mJsonAPIServer = new JsonApiServer;
|
||||
rsJsonAPI = mJsonAPIServer;
|
||||
// add jsonapi server to config manager so that it can save/load its tokens
|
||||
|
||||
mConfigMgr->addConfiguration("jsonapi.cfg",mJsonAPIServer);
|
||||
|
||||
RsFileHash dummyHash;
|
||||
mJsonAPIServer->loadConfiguration(dummyHash);
|
||||
if(rsJsonAPI)
|
||||
rsJsonAPI->connectToConfigManager(mConfigMgr);
|
||||
#endif
|
||||
|
||||
/**** Reputation system ****/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue