weitere updates für instanzierbarkeit und sauberes testing

This commit is contained in:
2026-02-24 08:49:40 +01:00
parent 7b53faca37
commit 16759a2732
119 changed files with 6371 additions and 745 deletions

View File

@@ -27,9 +27,9 @@ class ApiBootstrap
* Initialize the API request context.
*
* Call this at the top of every API page action.
* Sets MINTY_ALLOW_OUTPUT, CORS headers, authenticates via Bearer token.
* Sets MINTY_ALLOW_OUTPUT, CORS headers and optional Bearer auth.
*/
public static function init(): void
public static function init(bool $requireAuth = true): void
{
if (self::$initialized) {
return;
@@ -51,9 +51,11 @@ class ApiBootstrap
self::enforceRateLimit();
$authenticated = ApiAuth::authenticate();
if (!$authenticated) {
ApiResponse::unauthorized();
if ($requireAuth) {
$authenticated = ApiAuth::authenticate();
if (!$authenticated) {
ApiResponse::unauthorized();
}
}
}