diff options
| author | Darkelarious <darkelarious@333networks.com> | 2022-08-07 17:58:59 +0200 |
|---|---|---|
| committer | Darkelarious <darkelarious@333networks.com> | 2022-08-07 17:58:59 +0200 |
| commit | 1ca9cdc52f3b63c8bf5e4550bbb922608beb437f (patch) | |
| tree | 90802c7f7800c1b9d2d5d22f0e6b41b373ec39b9 /lib/MasterWebInterface/Handler/Json/JsonServerInfo.pm | |
| parent | e9b4cd5fc79ca2d044eba4fed8bf62b138f44249 (diff) | |
| download | WebInterface-Perl-1ca9cdc52f3b63c8bf5e4550bbb922608beb437f.tar.gz WebInterface-Perl-1ca9cdc52f3b63c8bf5e4550bbb922608beb437f.zip | |
fixes in Json API
Diffstat (limited to 'lib/MasterWebInterface/Handler/Json/JsonServerInfo.pm')
| -rwxr-xr-x | lib/MasterWebInterface/Handler/Json/JsonServerInfo.pm | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/MasterWebInterface/Handler/Json/JsonServerInfo.pm b/lib/MasterWebInterface/Handler/Json/JsonServerInfo.pm index 5669003..2ff6194 100755 --- a/lib/MasterWebInterface/Handler/Json/JsonServerInfo.pm +++ b/lib/MasterWebInterface/Handler/Json/JsonServerInfo.pm @@ -22,11 +22,14 @@ sub json_serverinfo hostport => $port, limit => 1, )->[0] if ($ip && $port); - + + # allow all outside sources to access the json api + $self->resHeader("Access-Control-Allow-Origin", "*"); + # return error state on invalid IP/port unless ($info) { - $self->resHeader("Content-Type", "application/json; charset=UTF-8"); + # response as json data $self->resJSON({ error => 1, in => "not_in_db", @@ -70,8 +73,7 @@ sub json_serverinfo $info->{mapurl} = "/map/default/333networks.jpg"; } - # return json data as the response - $self->resHeader("Content-Type", "application/json; charset=UTF-8"); + # response as json data $self->resJSON($info); } |
