Skip to content

Wallos: Open-source, self-hostable personal subscription tracker. Visualize your recurring expenses, manage your budget, and save money.

fix: ntfy notifications (#394)

Miguel Ribeiro17722c31e31e
diff --git a/endpoints/cronjobs/sendnotifications.php b/endpoints/cronjobs/sendnotifications.php
index ad6d09d..192e3cf 100644
--- a/endpoints/cronjobs/sendnotifications.php
+++ b/endpoints/cronjobs/sendnotifications.php
@@ -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);
diff --git a/endpoints/notifications/testntfynotifications.php b/endpoints/notifications/testntfynotifications.php
index 612d061..da0d29f 100644
--- a/endpoints/notifications/testntfynotifications.php
+++ b/endpoints/notifications/testntfynotifications.php
@@ -23,7 +23,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
];
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) {
@@ -42,6 +42,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
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);
@@ -55,8 +56,6 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
"success" => false,
"message" => translate('notification_failed', $i18n)
]));
- } else {
- print_r($response);
}
die(json_encode([
diff --git a/includes/version.php b/includes/version.php
index a1b4c47..7eb8e1e 100644
--- a/includes/version.php
+++ b/includes/version.php
@@ -1,3 +1,3 @@
<?php
- $version = "v2.5.0";
+ $version = "v2.5.1";
?>