Refactor API structure: update internal handling, enhance input retrieval, and improve template loading

This commit is contained in:
marc-go committed 2026-10-10 15:05:24 +02:00
1 parent a33de15f0c
commit 9cb50d7d28
13 files changed
+181 -95

No files matched your search

+3 -2
View File
@@ -2,11 +2,12 @@
// Set internal to false so that the answer goes to the client
if (!isset($internal)) {
$internal = false;
define("API_DIR", "../");
}
// Load Main Library
require "../api.php";
$api = new gbAPI(true);
require API_DIR . "api.php";
$api = new gbAPI(true, $internal);
$api->answer(200, [
"login" => true,
+4 -10
View File
@@ -2,22 +2,16 @@
// Set internal to false so that the answer goes to the client
if (!isset($internal)) {
$internal = false;
define("API_DIR", "../");
}
// Load API Library
require "../api.php";
require API_DIR . "api.php";
$api = new gbAPI(false);
$api = new gbAPI(false, $internal);
// Check Request Body
if ($_SERVER["REQUEST_METHOD"] !== "POST") {
$api->answer(400, [
"error" => "false_request_method",
"error_text" => "Only POST allowed"
], true);
}
$input = json_decode(file_get_contents("php://input"), true);
$input = $api->getInput();
if (!isset($input["username"]) || !isset($input["password"])) {
$api->answer(400, [