Merge pull request #213 from fireice-uk/topic-json-api

Initial JSON API implementation
This commit is contained in:
fireice-uk
2017-07-18 22:19:26 +01:00
committed by GitHub
7 changed files with 179 additions and 8 deletions
+7
View File
@@ -82,6 +82,13 @@ int httpd::req_handler(void * cls,
MHD_add_response_header(rsp, "ETag", sHtmlCssEtag);
MHD_add_response_header(rsp, "Content-Type", "text/css; charset=utf-8");
}
else if(strcasecmp(url, "/api.json") == 0)
{
executor::inst()->get_http_report(EV_HTML_JSON, str);
rsp = MHD_create_response_from_buffer(str.size(), (void*)str.c_str(), MHD_RESPMEM_MUST_COPY);
MHD_add_response_header(rsp, "Content-Type", "application/json; charset=utf-8");
}
else if(strcasecmp(url, "/h") == 0 || strcasecmp(url, "/hashrate") == 0)
{
executor::inst()->get_http_report(EV_HTML_HASHRATE, str);