1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-23 09:02:41 +00:00
Arsse/lib/REST/NextCloudNews/Versions.php
J. King 25d9158171 Fix output of NCN version list
List is supposed to be contained in a JSON object, not a bare list
2017-03-19 21:54:28 -04:00

30 lines
No EOL
697 B
PHP

<?php
declare(strict_types=1);
namespace JKingWeb\NewsSync\REST\NextCloudNews;
use JKingWeb\NewsSync\REST\Response;
class Versions implements \JKingWeb\NewsSync\REST\Handler {
function __construct(\JKingWeb\NewsSync\RuntimeData $data) {
}
function dispatch(\JKingWeb\NewsSync\REST\Request $req): \JKingWeb\NewsSync\REST\Response {
$path = $req->url;
$query = "";
if(strpos($path, "?") !== false) {
list($path, $query) = explode("?", $path);
}
if($req->method != "GET") {
return new Response(405);
}
if(preg_match("<^/?$>",$path)) {
$out = [
'apiLevels' => [
'v1-2'
]
];
return new Response(200, $out);
} else {
return new Response(404);
}
}
}