HTTP boundry
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "AppConfigJson.h"
|
||||
#include "AppConfigProvider.h"
|
||||
#include "AppRestart.h"
|
||||
#include "RenderCadenceHttpRoutes.h"
|
||||
#include "RuntimeLayerController.h"
|
||||
#include "../logging/Logger.h"
|
||||
#include "../control/RuntimeStateJson.h"
|
||||
@@ -246,23 +247,23 @@ private:
|
||||
|
||||
void StartHttpServer()
|
||||
{
|
||||
HttpControlServerCallbacks callbacks;
|
||||
callbacks.getStateJson = [this]() {
|
||||
RenderCadenceHttpRouteCallbacks routeCallbacks;
|
||||
routeCallbacks.getStateJson = [this]() {
|
||||
return BuildStateJson();
|
||||
};
|
||||
callbacks.getConfigJson = [this]() {
|
||||
routeCallbacks.getConfigJson = [this]() {
|
||||
return BuildConfigJson();
|
||||
};
|
||||
callbacks.getNdiSourcesJson = [this]() {
|
||||
routeCallbacks.getNdiSourcesJson = [this]() {
|
||||
return BuildNdiSourcesJson();
|
||||
};
|
||||
callbacks.addLayer = [this](const std::string& body) {
|
||||
routeCallbacks.addLayer = [this](const std::string& body) {
|
||||
return mRuntimeLayers.HandleAddLayer(body);
|
||||
};
|
||||
callbacks.removeLayer = [this](const std::string& body) {
|
||||
routeCallbacks.removeLayer = [this](const std::string& body) {
|
||||
return mRuntimeLayers.HandleRemoveLayer(body);
|
||||
};
|
||||
callbacks.executePost = [this](const std::string& path, const std::string& body) {
|
||||
routeCallbacks.executePost = [this](const std::string& path, const std::string& body) {
|
||||
if (path == "/api/config/save")
|
||||
return HandleConfigSave(body);
|
||||
if (path == "/api/app/restart")
|
||||
@@ -275,6 +276,12 @@ private:
|
||||
return mRuntimeLayers.HandleControlCommand(command);
|
||||
};
|
||||
|
||||
HttpControlServerCallbacks callbacks;
|
||||
callbacks.getWebSocketStateJson = routeCallbacks.getStateJson;
|
||||
callbacks.routeRequest = [this, routeCallbacks](const HttpRequest& request) {
|
||||
return RouteRenderCadenceHttpRequest(request, mHttpServer, routeCallbacks);
|
||||
};
|
||||
|
||||
std::string error;
|
||||
if (!mHttpServer.Start(
|
||||
FindRepoPath("ui/dist"),
|
||||
|
||||
Reference in New Issue
Block a user