Add Pushover notification channel and improve status detection
Introduces Pushover as a new notification channel with priority-based alerts, device targeting, and custom sounds. Enhances domain status detection for .nl and .eu domains, ensuring accurate handling when expiration dates or explicit status flags are missing. Fixes PHP 8.x compatibility issues with null parameters in date functions and improves error handling and logging by replacing error_log() with a centralized Logger service. Updates documentation and migrations for version 1.1.1.
This commit is contained in:
@@ -305,6 +305,9 @@ class NotificationGroupController extends Controller
|
||||
case 'webhook':
|
||||
$missingField = 'webhook URL';
|
||||
break;
|
||||
case 'pushover':
|
||||
$missingField = empty($_POST['pushover_api_token']) ? 'API token' : 'user key';
|
||||
break;
|
||||
}
|
||||
|
||||
$_SESSION['error'] = "Invalid channel configuration: Missing {$missingField}";
|
||||
@@ -545,6 +548,39 @@ class NotificationGroupController extends Controller
|
||||
}
|
||||
return ['webhook_url' => $webhookUrl];
|
||||
|
||||
case 'pushover':
|
||||
$apiToken = trim($data['pushover_api_token'] ?? '');
|
||||
$userKey = trim($data['pushover_user_key'] ?? '');
|
||||
|
||||
// Both API token and user key are required
|
||||
if (empty($apiToken) || empty($userKey)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Basic validation for Pushover token format (30 characters, alphanumeric)
|
||||
if (!preg_match('/^[a-zA-Z0-9]{30}$/', $apiToken) || !preg_match('/^[a-zA-Z0-9]{30}$/', $userKey)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$config = [
|
||||
'api_token' => $apiToken,
|
||||
'user_key' => $userKey
|
||||
];
|
||||
|
||||
// Optional: Device name
|
||||
$device = trim($data['pushover_device'] ?? '');
|
||||
if (!empty($device)) {
|
||||
$config['device'] = $device;
|
||||
}
|
||||
|
||||
// Optional: Sound
|
||||
$sound = trim($data['pushover_sound'] ?? '');
|
||||
if (!empty($sound)) {
|
||||
$config['sound'] = $sound;
|
||||
}
|
||||
|
||||
return $config;
|
||||
|
||||
case 'webhook':
|
||||
$webhookUrl = trim($data['webhook_url'] ?? '');
|
||||
if (empty($webhookUrl) || !filter_var($webhookUrl, FILTER_VALIDATE_URL)) {
|
||||
|
||||
Reference in New Issue
Block a user