implement activity logging feature with UI for viewing logs

This commit is contained in:
tom.hempel
2026-06-01 21:40:50 +02:00
parent 890232f58f
commit da394c5525
8 changed files with 1129 additions and 13 deletions

View File

@ -16,8 +16,18 @@ function json_error(string $code, string $message, int $status = 400): never {
exit;
}
/** Raw request body (cached; php://input is single-read). */
function qdb_raw_request_body(): string {
static $raw = null;
if ($raw === null) {
$read = file_get_contents('php://input');
$raw = $read === false ? '' : $read;
}
return $raw;
}
function read_json_body(): array {
$raw = file_get_contents('php://input');
$raw = qdb_raw_request_body();
$data = json_decode($raw, true);
if (!is_array($data)) {
json_error('INVALID_BODY', 'Request body must be valid JSON', 400);