mirror of
https://github.com/ellite/Wallos.git
synced 2026-08-02 03:06:16 -04:00
feat: add Arabic localization feat: add manual logo search box and png prioritization fix: pin discord notification action to a commit sha fix: service worker caching stale logo search results and broken images as logos fix: ai recommendations not handling varied provider responses fix: deleting orphaned logos not taking into account themed variants fix: stats page not using themed logo variants fix: email notification test rejecting non-admin users fix: notification test/send requests hanging on unreachable hosts fix: progress bar showing 100% when next payment is more than one cycle away
56 lines
1.7 KiB
PHP
56 lines
1.7 KiB
PHP
<?php
|
|
require_once '../../includes/connect_endpoint.php';
|
|
require_once '../../includes/validate_endpoint.php';
|
|
|
|
$postData = file_get_contents("php://input");
|
|
$data = json_decode($postData, true);
|
|
|
|
if (
|
|
!isset($data["bottoken"]) || $data["bottoken"] == "" ||
|
|
!isset($data["chatid"]) || $data["chatid"] == ""
|
|
) {
|
|
$response = [
|
|
"success" => false,
|
|
"message" => translate('fill_mandatory_fields', $i18n)
|
|
];
|
|
echo json_encode($response);
|
|
} else {
|
|
// Set the message parameters
|
|
$title = translate('wallos_notification', $i18n);
|
|
$message = translate('test_notification', $i18n);
|
|
|
|
$botToken = $data["bottoken"];
|
|
$chatId = $data["chatid"];
|
|
|
|
$ch = curl_init();
|
|
|
|
// Set the URL and other options
|
|
curl_setopt($ch, CURLOPT_URL, "https://api.telegram.org/bot" . $botToken . "/sendMessage");
|
|
curl_setopt($ch, CURLOPT_POST, 1);
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
|
|
'chat_id' => $chatId,
|
|
'text' => $message,
|
|
]));
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
|
|
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
|
|
|
|
// Execute the request
|
|
$response = curl_exec($ch);
|
|
|
|
// Close the cURL session
|
|
unset($ch);
|
|
|
|
// Check if the message was sent successfully
|
|
if ($response === false) {
|
|
die(json_encode([
|
|
"success" => false,
|
|
"message" => translate('notification_failed', $i18n)
|
|
]));
|
|
} else {
|
|
die(json_encode([
|
|
"success" => true,
|
|
"message" => translate('notification_sent_successfuly', $i18n)
|
|
]));
|
|
}
|
|
} |