Skip to content

Commit

Permalink
fix: ntfy notifications (#394)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellite authored Jun 21, 2024
1 parent 50e52ef commit 17722c3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 4 additions & 1 deletion endpoints/cronjobs/sendnotifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,10 @@

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $ntfy['host'] . '/' . $ntfy['topic']);
$ntfyHost = rtrim($ntfy["host"], '/');
$ntfyTopic = $ntfy['topic'];

curl_setopt($ch, CURLOPT_URL, $ntfyHost . '/' . $ntfyTopic);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $message);
curl_setopt($ch, CURLOPT_HTTPHEADER, $customheaders);
Expand Down
5 changes: 2 additions & 3 deletions endpoints/notifications/testntfynotifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
];
echo json_encode($response);
} else {
$host = $data["host"];
$host = rtrim($data["host"], '/');
$topic = $data["topic"];
$headers = json_decode($data["headers"], true);
$customheaders = array_map(function($key, $value) {
Expand All @@ -42,6 +42,7 @@
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $message);
curl_setopt($ch, CURLOPT_HTTPHEADER, $customheaders);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Execute the request
$response = curl_exec($ch);
Expand All @@ -55,8 +56,6 @@
"success" => false,
"message" => translate('notification_failed', $i18n)
]));
} else {
print_r($response);
}

die(json_encode([
Expand Down
2 changes: 1 addition & 1 deletion includes/version.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php
$version = "v2.5.0";
$version = "v2.5.1";
?>

0 comments on commit 17722c3

Please sign in to comment.