From 63561d259f3a4edea96437c3d7091878d8881f75 Mon Sep 17 00:00:00 2001 From: M_Viper Date: Sun, 25 Oct 2026 17:47:01 +0000 Subject: [PATCH] Upload via GUI (338 Dateien) --- DeskHub-Webseite/staff/app_download.php | 26 ++++++++++++++++++++-- DeskHub-Webseite/staff/apps.php | 29 ++++++++++++++----------- DeskHub-Webseite/staff/backup.php | 16 +++++++++++++- DeskHub-Webseite/staff/profile.php | 2 ++ 4 files changed, 57 insertions(+), 16 deletions(-) diff --git a/DeskHub-Webseite/staff/app_download.php b/DeskHub-Webseite/staff/app_download.php index 22651954..3b8d0806 100644 --- a/DeskHub-Webseite/staff/app_download.php +++ b/DeskHub-Webseite/staff/app_download.php @@ -3,7 +3,12 @@ require_once __DIR__ . '/../includes/bootstrap.php'; $staff = require_staff_login(); -$info = app_download_info((string) ($_GET['platform'] ?? '')); +$platform = (string) ($_GET['platform'] ?? ''); +if ($platform === 'minecraft' && !app_minecraft_enabled()) { + http_response_code(404); + exit('Diese App ist nicht hinterlegt.'); +} +$info = app_publisher_info($platform); if (!$info) { http_response_code(404); exit('Diese App ist nicht hinterlegt.'); @@ -18,4 +23,21 @@ header('Content-Disposition: attachment; filename="' . $info['filename'] . '"'); header('Content-Length: ' . $info['size']); header('X-Content-Type-Options: nosniff'); header('Cache-Control: private, no-store'); -readfile($info['path']); +if (($info['source'] ?? '') === 'publisher') { + session_write_close(); + @set_time_limit(0); + $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 { + $context = stream_context_create(['http' => ['timeout' => 0, 'header' => implode("\r\n", $headers)]]); + $remote = @fopen($url, 'rb', false, $context); + if ($remote) { fpassthru($remote); fclose($remote); } + } +} else { + readfile($info['path']); +} diff --git a/DeskHub-Webseite/staff/apps.php b/DeskHub-Webseite/staff/apps.php index 0480d77b..bec48632 100644 --- a/DeskHub-Webseite/staff/apps.php +++ b/DeskHub-Webseite/staff/apps.php @@ -4,10 +4,9 @@ require_once __DIR__ . '/_ui.php'; $staff = require_staff_login(); $isAdmin = ($staff['role'] ?? '') === 'admin'; -if ($isAdmin) app_downloads_prepare_dir(); // Ordner anlegen und Direktzugriff sperren - $apps = []; -foreach (array_keys(app_platforms()) as $key) $apps[$key] = app_download_info($key); +$visiblePlatforms = array_filter(app_platforms(), fn($k) => $k !== 'minecraft' || app_minecraft_enabled(), ARRAY_FILTER_USE_KEY); +foreach (array_keys($visiblePlatforms) as $key) $apps[$key] = app_publisher_info($key); $serverUrl = base_url(); $pageTitle = 'Apps'; @@ -27,20 +26,21 @@ require __DIR__ . '/_header.php';
- $p): $a = $apps[$key]; ?> + $p): $a = $apps[$key]; $noun = $key === "minecraft" ? "Plugin" : "App"; ?>
-
-App
+
-
· Stand
- ⬇ -App herunterladen + ⬇ - herunterladen
SHA-256:
+
-
Hier ist noch keine -App hinterlegt.
+
Für ist noch keine Version auf der Plugin-Website veröffentlicht.
-
Datei per FTP in den Ordner app_downloads/ legen und genau so benennen:
+
Veröffentliche die Version im Administrationsbereich der Plugin-Website.
@@ -52,6 +52,13 @@ require __DIR__ . '/_header.php';
  • Falls Windows warnt („Der Computer wurde geschützt“): Weitere Informationen → Trotzdem ausführen.
  • App öffnen, Serveradresse eingeben und anmelden.
  • + +
      +
    1. Jar herunterladen und in den Ordner plugins deines Spigot-, Paper- oder BungeeCord-Servers legen.
    2. +
    3. Server einmal starten, dann plugins/DeskHub-Minecraft/config.yml ausfüllen: Serveradresse (oben), API-Schlüssel und Absender-E-Mail.
    4. +
    5. API-Schlüssel mit dem Recht „Tickets anlegen“ erzeugst du unter Verwalten → API-Schlüssel.
    6. +
    7. Mit /deskhubmc test ein Testticket anlegen. Bei einem Ausfall des Servers legt das Plugin selbst ein Ticket an.
    8. +
    1. Datei auf dem Handy herunterladen und öffnen.
    2. @@ -65,9 +72,5 @@ require __DIR__ . '/_header.php';
    - -

    - Hinweis für Administratoren: Zum Aktualisieren einer App die neue Datei per FTP in app_downloads/ hochladen und die alte ersetzen (Namen: DeskHub-Setup.exe und DeskHub.apk). Die Seite zeigt automatisch Größe, Datum und Prüfsumme der neuen Datei. Die Dateien sind nur für angemeldete Mitarbeiter abrufbar. -

    - +

    Neue App-Versionen veröffentlichst du in der Plugin-Website unter „DeskHub-Apps veröffentlichen“. Downloads hier bleiben auf angemeldete Mitarbeiter beschränkt.

    diff --git a/DeskHub-Webseite/staff/backup.php b/DeskHub-Webseite/staff/backup.php index c742bbbb..e1c67e57 100644 --- a/DeskHub-Webseite/staff/backup.php +++ b/DeskHub-Webseite/staff/backup.php @@ -29,7 +29,20 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $action = $_POST['action'] ?? ''; if ($action === 'create_backup') { - $result = create_backup(); + // Lange Aufgabe: Sitzungssperre freigeben (sonst blockiert sie jede weitere Seite dieses Mitarbeiters) und bei Abbruch des Browsers weiterlaufen + @ignore_user_abort(true); + @set_time_limit(600); + if (!backup_lock_acquire($pdo)) { + flash('error', 'Es läuft bereits ein Backup (automatisch oder von jemand anderem gestartet). Bitte warte, bis es fertig ist, und prüfe dann die Liste.'); + redirect('/staff/backup.php'); + } + session_write_close(); + try { + $result = create_backup(); + } finally { + backup_lock_release($pdo); + } + if (session_status() !== PHP_SESSION_ACTIVE) { @session_start(); } if ($result['ok']) { // FTP-Upload wenn konfiguriert $ftpHost = bget('ftp_host'); @@ -42,6 +55,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { if ($ftpHost && $ftpUser && function_exists('ftp_connect')) { $ftp = $ftpTls ? @ftp_ssl_connect($ftpHost, $ftpPort, 10) : @ftp_connect($ftpHost, $ftpPort, 10); if ($ftp && @ftp_login($ftp, $ftpUser, $ftpPass)) { + @ftp_set_option($ftp, FTP_TIMEOUT_SEC, 120); // sonst wartet die Seite bei hängender Verbindung bis zu 90 s je Schritt ftp_pasv($ftp, true); $remote = rtrim($ftpPath, '/') . '/' . $result['filename']; $ftpMsg = ftp_put($ftp, $remote, $result['path'], FTP_BINARY) diff --git a/DeskHub-Webseite/staff/profile.php b/DeskHub-Webseite/staff/profile.php index 64b1d14e..fe6f155d 100644 --- a/DeskHub-Webseite/staff/profile.php +++ b/DeskHub-Webseite/staff/profile.php @@ -73,6 +73,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $errors[] = 'Erlaubte Bildformate: JPG, PNG, GIF, WEBP.'; } elseif ($_FILES['avatar']['size'] > 2 * 1024 * 1024) { $errors[] = 'Maximale Dateigröße: 2 MB.'; + } elseif (($imgErr = favicon_validate_file($_FILES['avatar']['tmp_name'], $ext)) !== null) { + $errors[] = $imgErr; } else { $dir = __DIR__ . '/../assets/avatars/'; if (!is_dir($dir)) mkdir($dir, 0755, true);