adasd
All checks were successful
Deploy / deploy-staging (push) Successful in 25s
Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-06-25 01:08:50 +02:00
parent bd5cb9364c
commit 52879ede31
11 changed files with 103 additions and 35 deletions

View File

@@ -4,36 +4,6 @@ declare(strict_types=1);
require_once dirname(__DIR__, 4) . '/src/App/bootstrap.php';
use App\ConfigLoader;
use App\GiteaDeployStatusService;
use App\AppPaths;
session_start();
$authUser = is_array($_SESSION['desktop_auth']['user'] ?? null) ? $_SESSION['desktop_auth']['user'] : [];
$groups = array_values(array_map('strval', (array) ($authUser['groups'] ?? [])));
$isAdmin = in_array('administrators', $groups, true);
$projectRoot = dirname(__DIR__, 4);
$service = new GiteaDeployStatusService(ConfigLoader::load($projectRoot, 'gitea'));
if (!$service->shouldShowInTray($isAdmin)) {
respond([
'error' => 'forbidden',
'message' => 'Kein Zugriff auf den Gitea-Deploy-Status.',
], 403);
}
respond([
'data' => $service->status(),
]);
/**
* @param array<string, mixed> $payload
*/
function respond(array $payload, int $statusCode = 200): never
{
http_response_code($statusCode);
header('Content-Type: application/json; charset=utf-8');
echo json_encode($payload, JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
exit;
}
require AppPaths::systemAddonPath(dirname(__DIR__, 4), 'gitea-deploy-status') . '/api.php';