chore: update ntfy notifications
This commit is contained in:
+11
-12
@@ -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;
|
||||
}
|
||||
|
||||
+2
-2
@@ -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
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user