From 2443fcff92a8dbb1652a9203cf1b597277352e16 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Tue, 20 Mar 2018 14:58:06 +0100 Subject: [PATCH] Added new API JSON-based auth scheme # Conflicts: # src/controller/controller_api.cpp --- src/controller/controller_api.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/controller/controller_api.cpp b/src/controller/controller_api.cpp index 3f95e218..663c866e 100644 --- a/src/controller/controller_api.cpp +++ b/src/controller/controller_api.cpp @@ -145,6 +145,19 @@ int Controller::handleAPIConnection(Socket::Connection & conn){ } } } + //Catch prometheus requests + if (Controller::prometheus.size()){ + if (H.url == "/"+Controller::prometheus){ + handlePrometheus(H, conn, PROMETHEUS_TEXT); + H.Clean(); + continue; + } + if (H.url == "/"+Controller::prometheus+".json"){ + handlePrometheus(H, conn, PROMETHEUS_JSON); + H.Clean(); + continue; + } + } JSON::Value Response; JSON::Value Request = JSON::fromString(H.GetVar("command")); //invalid request? send the web interface, unless requested as "/api"