mirror of
https://github.com/jez500/pricebuddy.git
synced 2026-11-24 19:58:13 +01:00
Adds three new push notification channels to reach feature parity with PriceGhost, following the existing channel pattern (app-level service config + per-user routing target): - Telegram: shared bot token (app) + per-user chat id, HTML messages - Discord: rich embed via webhook, app-level default + per-user override - ntfy: app-level server/auth (defaults to ntfy.sh) + per-user topic, optional basic auth for self-hosted servers Each channel is wired into NotificationMethods, exposes its config in the app settings and per-user profile forms, and Telegram/Discord get a Test action. Full unit coverage for settings merging, send payloads, routing guards and per-channel enable/disable. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
51 lines
1.2 KiB
PHP
Executable File
51 lines
1.2 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Enums;
|
|
|
|
use App\Notifications\Channels\AppriseChannel;
|
|
use App\Notifications\Channels\DiscordChannel;
|
|
use App\Notifications\Channels\GotifyChannel;
|
|
use App\Notifications\Channels\NtfyChannel;
|
|
use App\Notifications\Channels\TelegramChannel;
|
|
use NotificationChannels\Pushover\PushoverChannel;
|
|
|
|
enum NotificationMethods: string
|
|
{
|
|
case Mail = 'mail';
|
|
|
|
case Database = 'database';
|
|
|
|
case Pushover = 'pushover';
|
|
|
|
case Gotify = 'gotify';
|
|
|
|
case Apprise = 'apprise';
|
|
|
|
case Telegram = 'telegram';
|
|
|
|
case Discord = 'discord';
|
|
|
|
case Ntfy = 'ntfy';
|
|
|
|
public function getChannel(): string
|
|
{
|
|
return match ($this) {
|
|
self::Pushover => PushoverChannel::class,
|
|
self::Gotify => GotifyChannel::class,
|
|
self::Apprise => AppriseChannel::class,
|
|
self::Telegram => TelegramChannel::class,
|
|
self::Discord => DiscordChannel::class,
|
|
self::Ntfy => NtfyChannel::class,
|
|
default => $this->value,
|
|
};
|
|
}
|
|
|
|
public function requiresUserSettings(): bool
|
|
{
|
|
return match ($this) {
|
|
self::Database => false,
|
|
default => true,
|
|
};
|
|
}
|
|
}
|