From 31ce36095f5aaf569fa1a28070c613bf18293972 Mon Sep 17 00:00:00 2001 From: Peter Repukat Date: Mon, 10 Oct 2022 20:44:24 +0200 Subject: [PATCH] HttpServer: endpoint to query shortcut settings --- GlosSITarget/HttpServer.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/GlosSITarget/HttpServer.cpp b/GlosSITarget/HttpServer.cpp index f9c3424..85466e1 100644 --- a/GlosSITarget/HttpServer.cpp +++ b/GlosSITarget/HttpServer.cpp @@ -19,9 +19,11 @@ limitations under the License. #include #include "AppLauncher.h" +#include "Settings.h" HttpServer::HttpServer(AppLauncher& app_launcher) : app_launcher_(app_launcher) -{} +{ +} void HttpServer::run() { @@ -30,6 +32,10 @@ void HttpServer::run() res.set_content(j.dump(), "text/json"); }); + server_.Get("/settings", [this](const httplib::Request& req, httplib::Response& res) { + res.set_content(Settings::toJson().dump(), "text/json"); + }); + server_thread_ = std::thread([this]() { if (!server_.listen("0.0.0.0", port_)) { spdlog::error("Couldn't start http-server");