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';
app_downloads/ legen und genau so benennen: = e($p['stored']) ?>plugins deines Spigot-, Paper- oder BungeeCord-Servers legen.plugins/DeskHub-Minecraft/config.yml ausfüllen: Serveradresse (oben), API-Schlüssel und Absender-E-Mail./deskhubmc test ein Testticket anlegen. Bei einem Ausfall des Servers legt das Plugin selbst ein Ticket an.
- 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);