mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-28 16:17:28 -04:00
converted JsonAPI with public api and using RestbedService system
This commit is contained in:
parent
3ca22f0052
commit
a304ec20ef
10 changed files with 198 additions and 206 deletions
|
@ -91,7 +91,7 @@ void RsServer::rsGlobalShutDown()
|
|||
mNetMgr->shutdown(); /* Handles UPnP */
|
||||
|
||||
#ifdef RS_JSONAPI
|
||||
JsonApiServer::instance().shutdown();
|
||||
rsJsonAPI->stop();
|
||||
#endif
|
||||
|
||||
rsAutoProxyMonitor::instance()->stopAllRSShutdown();
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "retroshare/rsiface.h"
|
||||
#include "retroshare/rstypes.h"
|
||||
#include "util/rsthreads.h"
|
||||
#include "jsonapi/jsonapi.h"
|
||||
|
||||
#include "chat/p3chatservice.h"
|
||||
#include "gxstunnel/p3gxstunnel.h"
|
||||
|
@ -157,6 +158,7 @@ public:
|
|||
RsPluginManager *mPluginsManager;
|
||||
|
||||
//sslroot *sslr;
|
||||
JsonApiServer *mJsonAPIServer;
|
||||
|
||||
/* services */
|
||||
p3heartbeat *mHeart;
|
||||
|
|
|
@ -37,6 +37,7 @@ public:
|
|||
virtual bool restart() override { return RestbedService::restart();}
|
||||
virtual bool stop() override { return RestbedService::stop();}
|
||||
virtual void setListeningPort(uint16_t port) override { RestbedService::setListeningPort(port) ;}
|
||||
virtual void setBindingAddress(const std::string& address) override { RestbedService::setBindAddress(address) ;}
|
||||
|
||||
virtual int status() const override;
|
||||
virtual std::vector<std::shared_ptr<restbed::Resource> > getResources() const override;
|
||||
|
|
|
@ -410,7 +410,11 @@ int RsInit::InitRetroShare(const RsConfigOptions& conf)
|
|||
|
||||
#ifdef RS_JSONAPI
|
||||
if(rsInitConfig->jsonApiPort)
|
||||
JsonApiServer::instance().start(rsInitConfig->jsonApiPort, rsInitConfig->jsonApiBindAddress);
|
||||
{
|
||||
rsJsonAPI->setListeningPort(rsInitConfig->jsonApiPort);
|
||||
rsJsonAPI->setBindingAddress(rsInitConfig->jsonApiBindAddress);
|
||||
rsJsonAPI->restart();
|
||||
}
|
||||
|
||||
#endif // ifdef RS_JSONAPI
|
||||
|
||||
|
@ -1212,7 +1216,15 @@ int RsServer::StartupRetroShare()
|
|||
//
|
||||
mPluginsManager->loadPlugins(programatically_inserted_plugins) ;
|
||||
|
||||
JsonApiServer::setConfigMgr(mConfigMgr);
|
||||
#ifdef RS_JSONAPI
|
||||
mJsonAPIServer = new JsonApiServer;
|
||||
rsJsonAPI = mJsonAPIServer;
|
||||
|
||||
mConfigMgr->addConfiguration("jsonapi.cfg",mJsonAPIServer);
|
||||
|
||||
RsFileHash dummyHash;
|
||||
mJsonAPIServer->loadConfiguration(dummyHash);
|
||||
#endif
|
||||
|
||||
/**** Reputation system ****/
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue