Added new API JSON-based auth scheme

# Conflicts:
#	src/controller/controller_api.cpp
This commit is contained in:
Thulinma 2018-03-20 14:58:06 +01:00
parent d3d93eb4da
commit 2443fcff92

View file

@ -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 Response;
JSON::Value Request = JSON::fromString(H.GetVar("command")); JSON::Value Request = JSON::fromString(H.GetVar("command"));
//invalid request? send the web interface, unless requested as "/api" //invalid request? send the web interface, unless requested as "/api"