From 3aed0cc51769ef1d6ee0407fef4635b854c421fd Mon Sep 17 00:00:00 2001 From: M_Viper Date: Sun, 25 Oct 2026 17:47:11 +0000 Subject: [PATCH] Upload via GUI (338 Dateien) --- DeskHub-Webseite/api/public/v1/health.php | 18 ++ DeskHub-Webseite/api/staff/v1/app_update.php | 49 +++++ DeskHub-Webseite/status.php | 191 +++++++++++++++++-- DeskHub-Webseite/version.php | 2 +- 4 files changed, 244 insertions(+), 16 deletions(-) create mode 100644 DeskHub-Webseite/api/public/v1/health.php create mode 100644 DeskHub-Webseite/api/staff/v1/app_update.php diff --git a/DeskHub-Webseite/api/public/v1/health.php b/DeskHub-Webseite/api/public/v1/health.php new file mode 100644 index 00000000..3ac77299 --- /dev/null +++ b/DeskHub-Webseite/api/public/v1/health.php @@ -0,0 +1,18 @@ +query('SELECT 1'); + echo json_encode(['status' => 'ok'], JSON_UNESCAPED_UNICODE); +} catch (Throwable $e) { + http_response_code(503); + echo json_encode(['status' => 'unavailable'], JSON_UNESCAPED_UNICODE); +} diff --git a/DeskHub-Webseite/api/staff/v1/app_update.php b/DeskHub-Webseite/api/staff/v1/app_update.php new file mode 100644 index 00000000..9305ee07 --- /dev/null +++ b/DeskHub-Webseite/api/staff/v1/app_update.php @@ -0,0 +1,49 @@ + false, 'platform' => $platform]); + +if (($_GET['download'] ?? '') !== '1') { + api_json([ + 'available' => true, + 'platform' => $platform, + 'version' => (string) $info['version'], + 'sha256' => (string) $info['sha256'], + 'size' => (int) $info['size'], + 'notes' => (string) ($info['notes'] ?? ''), + 'publishedAt' => (string) ($info['modified_at'] ?? ''), + ]); +} + +@set_time_limit(0); +while (ob_get_level() > 0) { @ob_end_clean(); } +header('Content-Type: ' . $info['mime']); +header('Content-Disposition: attachment; filename="' . $info['filename'] . '"'); +if ((int) $info['size'] > 0) header('Content-Length: ' . (int) $info['size']); +header('X-Content-Type-Options: nosniff'); +header('X-DeskHub-SHA256: ' . $info['sha256']); +header('Cache-Control: private, no-store'); + +$url = app_publisher_endpoint($platform, true); +$headers = function_exists('catalog_access_headers') ? catalog_access_headers($url) : []; +if (function_exists('curl_init')) { + $ch = curl_init($url); + curl_setopt_array($ch, [CURLOPT_FOLLOWLOCATION => false, CURLOPT_CONNECTTIMEOUT => 8, CURLOPT_TIMEOUT => 0, CURLOPT_HTTPHEADER => $headers, CURLOPT_RETURNTRANSFER => false, CURLOPT_WRITEFUNCTION => static function ($curl, $chunk) { echo $chunk; return strlen($chunk); }]); + curl_exec($ch); + curl_close($ch); +} else { + $remote = @fopen($url, 'rb', false, stream_context_create(['http' => ['timeout' => 0, 'header' => implode("\r\n", $headers)]])); + if ($remote) { fpassthru($remote); fclose($remote); } +} diff --git a/DeskHub-Webseite/status.php b/DeskHub-Webseite/status.php index 314ac63c..88561b44 100644 --- a/DeskHub-Webseite/status.php +++ b/DeskHub-Webseite/status.php @@ -19,23 +19,71 @@ if (!status_page_enabled()) { $states = status_component_states(); $overall = status_overall($pdo); $components = status_components($pdo); +foreach ($components as &$component) { + $component['timeline'] = status_component_timeline($pdo, (int) $component['id'], 30); +} +unset($component); $incidents = status_incidents($pdo, 14); $open = array_values(array_filter($incidents, fn($i) => $i['status'] !== 'resolved')); $past = array_values(array_filter($incidents, fn($i) => $i['status'] === 'resolved')); $incStates = status_incident_states(); -// Aktualisiert sich selbst, damit eine offene Seite nicht veraltet -header('Cache-Control: no-cache'); -header('Refresh: 120'); +if (($_GET['live'] ?? '') === '1') { + header('Content-Type: application/json; charset=utf-8'); + header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0'); + $liveComponents = []; + foreach ($components as $component) { + $componentState = $states[$component['status']] ?? $states['operational']; + $liveComponents[] = [ + 'id' => (int) $component['id'], + 'status' => (string) $component['status'], + 'statusLabel' => (string) $componentState[0], + 'color' => (string) $componentState[1], + 'uptime' => $component['timeline']['uptime'], + 'bars' => array_map(static function (array $bar) use ($states): array { + $key = $bar['status']; + return [ + 'date' => (string) $bar['date'], + 'status' => $key, + 'label' => $key !== null ? (string) ($states[$key][0] ?? $key) : 'Keine Daten', + 'color' => $key !== null ? (string) ($states[$key][1] ?? '#cbd5e1') : '#dfe4e8', + ]; + }, $component['timeline']['bars']), + ]; + } + $liveIncidents = []; + foreach ($open as $incident) { + $liveIncidents[] = [ + 'title' => (string) $incident['title'], + 'statusLabel' => (string) ($incStates[$incident['status']] ?? $incident['status']), + 'componentName' => (string) ($incident['component_name'] ?? ''), + 'updates' => array_map(static fn(array $update): array => [ + 'statusLabel' => (string) ($incStates[$update['status']] ?? $update['status']), + 'createdAt' => format_dt((string) $update['created_at']), + 'body' => (string) ($update['body'] ?? ''), + ], $incident['updates']), + ]; + } + echo json_encode([ + 'updatedAt' => date('d.m.Y H:i:s'), + 'overall' => $overall, + 'components' => $liveComponents, + 'incidents' => $liveIncidents, + ], JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT); + exit; +} + +header('Cache-Control: no-cache, no-store, must-revalidate'); require __DIR__ . '/includes/header_customer.php'; ?>

-
- -
Stand: Uhr
+
+ +
Stand: Uhr · Live-Aktualisierung aktiv
+
@@ -47,17 +95,42 @@ require __DIR__ . '/includes/header_customer.php';
- -
-

Es sind noch keine Dienste eingetragen.

- $c): $st = $states[$c['status']] ?? $states['operational']; ?> -
-
- -
-
+ +

Es sind noch keine Dienste eingetragen.

+ + + $group): ?> +

+
+ $c): $st = $states[$c['status']] ?? $states['operational']; ?> +
+
+
+ +
+ +
+
+ + + +
+ +
+
Letzte PrüfungenJetzt
+ +
+ $stateMeta): ?> + Keine Daten +
+
+ +
+ + +

Vergangene Meldungen (letzte 14 Tage)

Keine Störungen in den letzten 14 Tagen.

@@ -69,4 +142,92 @@ require __DIR__ . '/includes/header_customer.php';
+ diff --git a/DeskHub-Webseite/version.php b/DeskHub-Webseite/version.php index 1db218f8..9cfe8da2 100644 --- a/DeskHub-Webseite/version.php +++ b/DeskHub-Webseite/version.php @@ -1,7 +1,7 @@