From b13dd6078863b46e17443e57fcd9b8fa7068265b Mon Sep 17 00:00:00 2001 From: orfelorfel23 Date: Sun, 5 Jul 2026 22:13:02 +0200 Subject: [PATCH] chore: update ntfy notifications --- tester_backend.php | 23 +++++++++++------------ upload_backend.php | 4 ++-- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/tester_backend.php b/tester_backend.php index fa4f81d..3457cf8 100644 --- a/tester_backend.php +++ b/tester_backend.php @@ -5,38 +5,37 @@ header('Content-Type: application/json'); if ($_SERVER['REQUEST_METHOD'] === 'POST') { $inputJSON = file_get_contents('php://input'); $input = json_decode($inputJSON, true); - + if (!$input || empty($input['email'])) { http_response_code(400); echo json_encode(['error' => 'Ungültige Eingabe']); exit; } - + $email = filter_var($input['email'], FILTER_SANITIZE_EMAIL); - + if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { - http_response_code(400); - echo json_encode(['error' => 'Ungültige E-Mail Adresse']); - exit; + http_response_code(400); + echo json_encode(['error' => 'Ungültige E-Mail Adresse']); + exit; } - + // Send notification to Ntfy $ntfyUrl = 'https://ntfy.orfel.de/Schnappix-App-Testing'; - $message = "Eine neue Anfrage für das Schnappix App Testing ist eingegangen!\n\nE-Mail: $email\n\nBitte prüfen und ggf. die Registrierungslinks via E-Mail versenden."; - + $message = "E-Mail: $email"; + $ch = curl_init($ntfyUrl); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $message); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Title: Neue Tester-Anmeldung', - 'Tags: mobile_phone,warning,bust_in_silhouette', - 'Click: mailto:' . $email . '?subject=Schnappix%20App%20Testing%20-%20Einladung&body=Hallo,%0A%0Avielen%20Dank%20f%C3%BCr%20dein%20Interesse%20als%20Tester!%20Hier%20sind%20die%20Links:%0A' + 'Tags: calling,bust_in_silhouette' ]); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 5); curl_exec($ch); curl_close($ch); - + echo json_encode(['success' => true]); exit; } diff --git a/upload_backend.php b/upload_backend.php index b72a91a..4204385 100644 --- a/upload_backend.php +++ b/upload_backend.php @@ -88,14 +88,14 @@ if (move_uploaded_file($file['tmp_name'], $destination)) { // Send notification to Ntfy $ntfyUrl = 'https://ntfy.orfel.de/Schnappix-Frame-Upload'; - $message = "Ein neuer Rahmen wurde hochgeladen!\n\nName: $filename\nVon: $email\nBild-URL: $publicUrl"; + $message = "Name: $filename\nVon: $email\nBild-URL: $publicUrl"; $ch = curl_init($ntfyUrl); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $message); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Title: Neuer Schnappix Hintergrund', - 'Tags: frame_with_picture,tada', + 'Tags: framed_picture,tada', 'Click: ' . $publicUrl, 'Attach: ' . $publicUrl ]);