mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-09 20:11:22 +00:00
Add config for ntfy
This commit is contained in:
@@ -28,11 +28,15 @@ use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Messages\SlackMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Ntfy\Message;
|
||||
use Wijourdil\NtfyNotificationChannel\Channels\NtfyChannel;
|
||||
|
||||
//use Illuminate\Notifications\Slack\SlackMessage;
|
||||
|
||||
/**
|
||||
* Class TestNotification
|
||||
*/
|
||||
class TestNotificationDiscord extends Notification
|
||||
class TestNotificationNtfy extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
@@ -61,6 +65,18 @@ class TestNotificationDiscord extends Notification
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function toNtfy(mixed $notifiable): Message
|
||||
{
|
||||
$message = new Message();
|
||||
$message->topic(config('ntfy-notification-channel.topic'));
|
||||
$message->title((string)trans('email.admin_test_subject'));
|
||||
$message->body((string)trans('email.admin_test_message', ['channel' => 'ntfy']));
|
||||
$message->tags(['white_check_mark', 'ok_hand']);
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mail representation of the notification.
|
||||
*
|
||||
@@ -83,13 +99,6 @@ class TestNotificationDiscord extends Notification
|
||||
*
|
||||
*/
|
||||
public function toSlack($notifiable) {
|
||||
|
||||
// since it's an admin notificaiton, grab the URL from fireflyconfig
|
||||
$url = app('fireflyconfig')->get('discord_webhook_url', '')->data;
|
||||
|
||||
return (new SlackMessage())
|
||||
->content((string)trans('email.admin_test_subject'))
|
||||
->to($url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,6 +112,6 @@ class TestNotificationDiscord extends Notification
|
||||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
return ['slack'];
|
||||
return [NtfyChannel::class];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user