diff --git a/brmd/brmd.pl b/brmd/brmd.pl index 2fe953e..ce1488c 100755 --- a/brmd/brmd.pl +++ b/brmd/brmd.pl @@ -279,6 +279,7 @@ sub new { "/brmstatus.png" => \&web_brmstatus_png, "/brmstatus.txt" => \&web_brmstatus_txt, "/brmstatus-switch" => sub { $self->web_brmstatus_switch(@_) }, + "/brmstatus.json" => \&web_brmstatus_json, "/alphasign" => \&web_alphasign_text, "/alphasign-set" => \&web_alphasign_set, "/" => \&web_index @@ -354,7 +355,7 @@ sub web_index {

brmd web interface

Enjoy the view!

@@ -415,6 +416,46 @@ EOT return RC_OK; } +sub web_brmstatus_json { + my ($request, $response) = @_; + + $response->protocol("HTTP/1.0"); + $response->code(RC_OK); + $response->push_header("Content-Type", "application/json"); + $response->push_header("Access-Control-Allow-Origin", "*"); + disable_caching($response); + + $response->content(<