From fad8536292ab7253109f2420c538e9cd0031760d Mon Sep 17 00:00:00 2001 From: M_Viper Date: Wed, 4 Nov 2026 07:55:51 +0000 Subject: [PATCH] Upload via GUI (396 Dateien) --- DeskHub-Webseite/api/public/v1/tickets.php | 5 ++++- DeskHub-Webseite/api/staff/v1/activity.php | 10 +++++++++- DeskHub-Webseite/api/staff/v1/app_update.php | 4 ++-- DeskHub-Webseite/ticket_print.php | 2 +- DeskHub-Webseite/version.php | 2 +- 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/DeskHub-Webseite/api/public/v1/tickets.php b/DeskHub-Webseite/api/public/v1/tickets.php index 9a56b41a..34860237 100644 --- a/DeskHub-Webseite/api/public/v1/tickets.php +++ b/DeskHub-Webseite/api/public/v1/tickets.php @@ -47,7 +47,10 @@ if (!$apiKey) { if ($method === 'POST') { if (!$apiKey['can_create_tickets']) public_api_fail(403, 'FORBIDDEN', 'Dieser Schlüssel darf keine Tickets anlegen.'); $raw = file_get_contents('php://input') ?: ''; - if (strlen($raw) > 200000) public_api_fail(413, 'TOO_LARGE', 'Die Anfrage ist zu groß.'); + // Normale Anfragen höchstens 200 KB; mit Dateianhängen (Base64) mehr: bis zu 10 MB Dateien, Base64 macht rund ein Drittel mehr daraus + if (strlen($raw) > 200000 && (strlen($raw) > 200000 + (int) (PUBLIC_ATTACHMENT_TOTAL_BYTES * 1.4) || !str_contains($raw, '"attachments"'))) { + public_api_fail(413, 'TOO_LARGE', 'Die Anfrage ist zu groß.'); + } $body = json_decode($raw, true); if (!is_array($body)) public_api_fail(400, 'INVALID_JSON', 'Der Anfragekörper muss gültiges JSON sein.'); if (($body['action'] ?? '') === 'resolve') { diff --git a/DeskHub-Webseite/api/staff/v1/activity.php b/DeskHub-Webseite/api/staff/v1/activity.php index a44a8cc8..c1e71b3f 100644 --- a/DeskHub-Webseite/api/staff/v1/activity.php +++ b/DeskHub-Webseite/api/staff/v1/activity.php @@ -6,11 +6,18 @@ api_require_method('GET'); $staff = api_require_staff(); $pdo = get_db(); +/** Echter Stand für den Zähler: Ticket-IDs, die jetzt Aufmerksamkeit brauchen (nicht zugewiesen / mir gehörend), plus Anzahlen. */ +function api_attention(PDO $pdo, array $staff): array +{ + $a = staff_attention_tickets($pdo, $staff); + return ['unassigned' => $a['unassigned'], 'mine' => $a['mine'], 'unassignedCount' => count($a['unassigned']), 'mineCount' => count($a['mine'])]; +} + $since = trim($_GET['since'] ?? ''); if ($since === '') { // Erster Aufruf nach Login: nur die Serverzeit als Referenzpunkt liefern, noch nichts zählen // (verhindert Uhrzeit-Abweichungen zwischen Client und Server bei der Baseline). - api_json(['newReplies' => 0, 'newUnassigned' => 0, 'serverTime' => db_now(), 'health' => has_permission($staff, 'manage_email_addresses') ? system_health($pdo) : []]); + api_json(['newReplies' => 0, 'newUnassigned' => 0, 'attention' => api_attention($pdo, $staff), 'serverTime' => db_now(), 'health' => has_permission($staff, 'manage_email_addresses') ? system_health($pdo) : []]); } if (strtotime($since) === false) { api_error(422, 'INVALID_SINCE', 'Der since-Zeitstempel ist ungültig.'); @@ -36,6 +43,7 @@ $newUnassigned = (int) $stmt->fetchColumn(); api_json([ 'newReplies' => $newReplies, 'newUnassigned' => $newUnassigned, + 'attention' => api_attention($pdo, $staff), 'serverTime' => db_now(), 'health' => has_permission($staff, 'manage_email_addresses') ? system_health($pdo) : [], ]); diff --git a/DeskHub-Webseite/api/staff/v1/app_update.php b/DeskHub-Webseite/api/staff/v1/app_update.php index 9305ee07..0f430ecc 100644 --- a/DeskHub-Webseite/api/staff/v1/app_update.php +++ b/DeskHub-Webseite/api/staff/v1/app_update.php @@ -3,14 +3,14 @@ declare(strict_types=1); require_once __DIR__ . '/common.php'; /** - * Update-Prüfung der Apps: GET ?platform=android|windows liefert die aktuell veröffentlichte Version, + * Update-Prüfung der Apps und der Chrome-Erweiterung: GET ?platform=android|windows|chrome liefert die aktuell veröffentlichte Version, * mit &download=1 die Installationsdatei. Die Quelle ist die Plugin-Webseite (Zugangsschlüssel bleibt auf dem Server). */ api_require_method('GET'); api_require_staff(); $platform = (string) ($_GET['platform'] ?? ''); -if (!in_array($platform, ['android', 'windows'], true)) api_error(400, 'bad_platform', 'Unbekannte Plattform.'); +if (!in_array($platform, ['android', 'windows', 'chrome'], true)) api_error(400, 'bad_platform', 'Unbekannte Plattform.'); $info = app_publisher_info($platform); if (!$info) api_json(['available' => false, 'platform' => $platform]); diff --git a/DeskHub-Webseite/ticket_print.php b/DeskHub-Webseite/ticket_print.php index 97b4a127..1473f685 100644 --- a/DeskHub-Webseite/ticket_print.php +++ b/DeskHub-Webseite/ticket_print.php @@ -98,7 +98,7 @@ $siteName = get_setting('display_name', config()['site']['name'] ?? 'DeskHub'); $isStaff = $msg['author_type'] === 'staff'; $author = $isStaff ? ($msg['staff_name'] ?? 'Support') : ($msg['user_name'] ?? $ticket['requester_name']); $body = $msg['message'] ?? ''; - $isHtml = preg_match('/<[a-zA-Z][^>]*>/i', $body); + $isHtml = message_is_html($body); $attStmt->execute([$msg['id']]); $atts = $attStmt->fetchAll(); ?> diff --git a/DeskHub-Webseite/version.php b/DeskHub-Webseite/version.php index f4d90f79..8a1a72c1 100644 --- a/DeskHub-Webseite/version.php +++ b/DeskHub-Webseite/version.php @@ -1,7 +1,7 @@