Make version check API that doesn't require login
This commit is contained in:
parent
f20f24994b
commit
53aa167e79
@ -1,5 +1,5 @@
|
|||||||
# Rewrite for Nextcloud Notes API
|
|
||||||
<IfModule mod_rewrite.c>
|
<IfModule mod_rewrite.c>
|
||||||
RewriteEngine on
|
RewriteEngine on
|
||||||
|
RewriteRule version version.php [PT]
|
||||||
RewriteRule ([a-zA-Z0-9]+) index.php?action=$1 [PT]
|
RewriteRule ([a-zA-Z0-9]+) index.php?action=$1 [PT]
|
||||||
</IfModule>
|
</IfModule>
|
@ -1,9 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
||||||
*/
|
|
||||||
|
|
||||||
exitWithJson(["status" => "OK", "version" => $SETTINGS["minimum_client_version"]]);
|
|
@ -10,9 +10,6 @@ $APIS = [
|
|||||||
"ping" => [
|
"ping" => [
|
||||||
"load" => "ping.php"
|
"load" => "ping.php"
|
||||||
],
|
],
|
||||||
"version" => [
|
|
||||||
"load" => "version.php"
|
|
||||||
],
|
|
||||||
"inventory" => [
|
"inventory" => [
|
||||||
"load" => "inventory.php"
|
"load" => "inventory.php"
|
||||||
],
|
],
|
||||||
|
20
api/version.php
Normal file
20
api/version.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once __DIR__ . "/../settings.php";
|
||||||
|
|
||||||
|
$format = end(explode(".", $_SERVER['REQUEST_URI']));
|
||||||
|
|
||||||
|
header("Access-Control-Allow-Origin: *");
|
||||||
|
|
||||||
|
switch ($format) {
|
||||||
|
case "json":
|
||||||
|
header("Content-Type: application/json");
|
||||||
|
echo json_encode(["min_version" => $SETTINGS["minimum_client_version"]]);
|
||||||
|
break;
|
||||||
|
case "txt":
|
||||||
|
default:
|
||||||
|
header("Content-Type: text/plain");
|
||||||
|
echo $SETTINGS["minimum_client_version"];
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
@ -1,11 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Give the minimum allowed game client version. The client should check on
|
|
||||||
* startup and not continue if its version is less than the given version.
|
|
||||||
*/
|
|
||||||
|
|
||||||
header('Content-Type: application/json');
|
|
||||||
header("Access-Control-Allow-Origin: *");
|
|
||||||
|
|
||||||
echo json_encode(["status" => "OK", "version" => "2.0.0"]);
|
|
Loading…
x
Reference in New Issue
Block a user