Upload via GUI (396 Dateien)
This commit is contained in:
@@ -47,7 +47,10 @@ if (!$apiKey) {
|
|||||||
if ($method === 'POST') {
|
if ($method === 'POST') {
|
||||||
if (!$apiKey['can_create_tickets']) public_api_fail(403, 'FORBIDDEN', 'Dieser Schlüssel darf keine Tickets anlegen.');
|
if (!$apiKey['can_create_tickets']) public_api_fail(403, 'FORBIDDEN', 'Dieser Schlüssel darf keine Tickets anlegen.');
|
||||||
$raw = file_get_contents('php://input') ?: '';
|
$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);
|
$body = json_decode($raw, true);
|
||||||
if (!is_array($body)) public_api_fail(400, 'INVALID_JSON', 'Der Anfragekörper muss gültiges JSON sein.');
|
if (!is_array($body)) public_api_fail(400, 'INVALID_JSON', 'Der Anfragekörper muss gültiges JSON sein.');
|
||||||
if (($body['action'] ?? '') === 'resolve') {
|
if (($body['action'] ?? '') === 'resolve') {
|
||||||
|
|||||||
@@ -6,11 +6,18 @@ api_require_method('GET');
|
|||||||
$staff = api_require_staff();
|
$staff = api_require_staff();
|
||||||
$pdo = get_db();
|
$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'] ?? '');
|
$since = trim($_GET['since'] ?? '');
|
||||||
if ($since === '') {
|
if ($since === '') {
|
||||||
// Erster Aufruf nach Login: nur die Serverzeit als Referenzpunkt liefern, noch nichts zählen
|
// Erster Aufruf nach Login: nur die Serverzeit als Referenzpunkt liefern, noch nichts zählen
|
||||||
// (verhindert Uhrzeit-Abweichungen zwischen Client und Server bei der Baseline).
|
// (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) {
|
if (strtotime($since) === false) {
|
||||||
api_error(422, 'INVALID_SINCE', 'Der since-Zeitstempel ist ungültig.');
|
api_error(422, 'INVALID_SINCE', 'Der since-Zeitstempel ist ungültig.');
|
||||||
@@ -36,6 +43,7 @@ $newUnassigned = (int) $stmt->fetchColumn();
|
|||||||
api_json([
|
api_json([
|
||||||
'newReplies' => $newReplies,
|
'newReplies' => $newReplies,
|
||||||
'newUnassigned' => $newUnassigned,
|
'newUnassigned' => $newUnassigned,
|
||||||
|
'attention' => api_attention($pdo, $staff),
|
||||||
'serverTime' => db_now(),
|
'serverTime' => db_now(),
|
||||||
'health' => has_permission($staff, 'manage_email_addresses') ? system_health($pdo) : [],
|
'health' => has_permission($staff, 'manage_email_addresses') ? system_health($pdo) : [],
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -3,14 +3,14 @@ declare(strict_types=1);
|
|||||||
require_once __DIR__ . '/common.php';
|
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).
|
* mit &download=1 die Installationsdatei. Die Quelle ist die Plugin-Webseite (Zugangsschlüssel bleibt auf dem Server).
|
||||||
*/
|
*/
|
||||||
api_require_method('GET');
|
api_require_method('GET');
|
||||||
api_require_staff();
|
api_require_staff();
|
||||||
|
|
||||||
$platform = (string) ($_GET['platform'] ?? '');
|
$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);
|
$info = app_publisher_info($platform);
|
||||||
if (!$info) api_json(['available' => false, 'platform' => $platform]);
|
if (!$info) api_json(['available' => false, 'platform' => $platform]);
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ $siteName = get_setting('display_name', config()['site']['name'] ?? 'DeskHub');
|
|||||||
$isStaff = $msg['author_type'] === 'staff';
|
$isStaff = $msg['author_type'] === 'staff';
|
||||||
$author = $isStaff ? ($msg['staff_name'] ?? 'Support') : ($msg['user_name'] ?? $ticket['requester_name']);
|
$author = $isStaff ? ($msg['staff_name'] ?? 'Support') : ($msg['user_name'] ?? $ticket['requester_name']);
|
||||||
$body = $msg['message'] ?? '';
|
$body = $msg['message'] ?? '';
|
||||||
$isHtml = preg_match('/<[a-zA-Z][^>]*>/i', $body);
|
$isHtml = message_is_html($body);
|
||||||
$attStmt->execute([$msg['id']]);
|
$attStmt->execute([$msg['id']]);
|
||||||
$atts = $attStmt->fetchAll();
|
$atts = $attStmt->fetchAll();
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
if (defined('DESKHUB_VERSION')) return;
|
if (defined('DESKHUB_VERSION')) return;
|
||||||
|
|
||||||
define('DESKHUB_VERSION', '1.0.66');
|
define('DESKHUB_VERSION', '1.0.71');
|
||||||
define('DESKHUB_RELEASE_URL', 'https://git.viper.ipv64.net/M_Viper/deskhub/releases');
|
define('DESKHUB_RELEASE_URL', 'https://git.viper.ipv64.net/M_Viper/deskhub/releases');
|
||||||
|
|
||||||
// Kein eingebautes Zugangstoken: Das Update liest die öffentlichen Releases. Ist das Repository privat, kann ein Token
|
// Kein eingebautes Zugangstoken: Das Update liest die öffentlichen Releases. Ist das Repository privat, kann ein Token
|
||||||
|
|||||||
Reference in New Issue
Block a user