Fixed from paulgiordanozethcon suggestion in https://github.com/tuxis-ie/nsedit/issues/162

This commit is contained in:
margau 2018-04-17 18:53:31 +02:00
parent ebd12ebeb2
commit 805176648d
2 changed files with 11 additions and 10 deletions

View file

@ -29,11 +29,12 @@ class ApiHandler {
private function apiurl() {
$tmp = new ApiHandler();
$tmp->url = '/api';
$tmp->url = '/api/v1/servers/localhost';
$tmp->go();
if ($tmp->json[0]['version'] <= 1) {
$this->apiurl = $tmp->json[0]['url'];
$v = intval(substr($tmp->json["version"],0,1));
if ($v == 4) {
$this->apiurl = $tmp->json["url"];
} else {
throw new Exception("Unsupported API version");
}