Skip to content

Commit 362311c

Browse files
Release v0.21.0 (alexjustesen#1648)
* Develop v0.21.0 (additional notification channels) (alexjustesen#1647) * Add Placeholder text for notifications (alexjustesen#1570) first_commit * Add Gotify Notifications via Webhook (alexjustesen#1561) * first_commit * Ready! * Add_placeholder * change url --------- Co-authored-by: Alex Justesen <[email protected]> * Add Support for Slack Notifications via Webhook (alexjustesen#1522) * First Commit * Fix lint * add_url_placeholder * Fix the liniting * Add HealthCheck.io Notifications via Webhooks (alexjustesen#1567) * first_commit * linting * add_descrip_for_threshold * Change name * add_url_placeholder * fix_linting * Add Pushover Notifications via Webhooks (alexjustesen#1574) * add_pushover * add_placeholder * Linting --------- Co-authored-by: Alex Justesen <[email protected]> * Add ntfy Notifications via Webhooks (alexjustesen#1579) * first_push * Fix_json_payload * Add_auth_option * fix lint * fix packet_loss_% * added eof line --------- Co-authored-by: Alex Justesen <[email protected]> * Add Ookla URL to the notification (alexjustesen#1615) * first commit * added eof line --------- Co-authored-by: Alex Justesen <[email protected]> * Fix notifications layouts (alexjustesen#1639) first commit --------- Co-authored-by: Sven van Ginkel <[email protected]> * updated npm dependencies --------- Co-authored-by: Sven van Ginkel <[email protected]>
1 parent 811fbfc commit 362311c

File tree

45 files changed

+1757
-102
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1757
-102
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
namespace App\Actions\Notifications;
4+
5+
use Filament\Notifications\Notification;
6+
use Lorisleiva\Actions\Concerns\AsAction;
7+
use Spatie\WebhookServer\WebhookCall;
8+
9+
class SendGotifyTestNotification
10+
{
11+
use AsAction;
12+
13+
public function handle(array $webhooks)
14+
{
15+
if (! count($webhooks)) {
16+
Notification::make()
17+
->title('You need to add Gotify urls!')
18+
->warning()
19+
->send();
20+
21+
return;
22+
}
23+
24+
foreach ($webhooks as $webhook) {
25+
WebhookCall::create()
26+
->url($webhook['url'])
27+
->payload(['message' => '👋 Testing the Gotify notification channel.'])
28+
->doNotSign()
29+
->dispatch();
30+
}
31+
32+
Notification::make()
33+
->title('Test Gotify notification sent.')
34+
->success()
35+
->send();
36+
}
37+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
namespace App\Actions\Notifications;
4+
5+
use Filament\Notifications\Notification;
6+
use Lorisleiva\Actions\Concerns\AsAction;
7+
use Spatie\WebhookServer\WebhookCall;
8+
9+
class SendHealthCheckTestNotification
10+
{
11+
use AsAction;
12+
13+
public function handle(array $webhooks)
14+
{
15+
if (! count($webhooks)) {
16+
Notification::make()
17+
->title('You need to add HealthCheck.io urls!')
18+
->warning()
19+
->send();
20+
21+
return;
22+
}
23+
24+
foreach ($webhooks as $webhook) {
25+
WebhookCall::create()
26+
->url($webhook['url'])
27+
->payload(['message' => '👋 Testing the HealthCheck.io notification channel.'])
28+
->doNotSign()
29+
->dispatch();
30+
}
31+
32+
Notification::make()
33+
->title('Test HealthCheck.io notification sent.')
34+
->success()
35+
->send();
36+
}
37+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
3+
namespace App\Actions\Notifications;
4+
5+
use Filament\Notifications\Notification;
6+
use Lorisleiva\Actions\Concerns\AsAction;
7+
use Spatie\WebhookServer\WebhookCall;
8+
9+
class SendNtfyTestNotification
10+
{
11+
use AsAction;
12+
13+
public function handle(array $webhooks)
14+
{
15+
if (! count($webhooks)) {
16+
Notification::make()
17+
->title('You need to add ntfy urls!')
18+
->warning()
19+
->send();
20+
21+
return;
22+
}
23+
24+
foreach ($webhooks as $webhook) {
25+
$webhookCall = WebhookCall::create()
26+
->url($webhook['url'])
27+
->payload([
28+
'topic' => $webhook['topic'],
29+
'message' => '👋 Testing the ntfy notification channel.',
30+
])
31+
->doNotSign();
32+
33+
// Only add authentication if username and password are provided
34+
if (! empty($webhook['username']) && ! empty($webhook['password'])) {
35+
$authHeader = 'Basic '.base64_encode($webhook['username'].':'.$webhook['password']);
36+
$webhookCall->withHeaders([
37+
'Authorization' => $authHeader,
38+
]);
39+
}
40+
41+
$webhookCall->dispatch();
42+
}
43+
44+
Notification::make()
45+
->title('Test ntfy notification sent.')
46+
->success()
47+
->send();
48+
}
49+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
namespace App\Actions\Notifications;
4+
5+
use Filament\Notifications\Notification;
6+
use Lorisleiva\Actions\Concerns\AsAction;
7+
use Spatie\WebhookServer\WebhookCall;
8+
9+
class SendPushoverTestNotification
10+
{
11+
use AsAction;
12+
13+
public function handle(array $webhooks)
14+
{
15+
if (! count($webhooks)) {
16+
Notification::make()
17+
->title('You need to add Pushover URLs!')
18+
->warning()
19+
->send();
20+
21+
return;
22+
}
23+
24+
foreach ($webhooks as $webhook) {
25+
WebhookCall::create()
26+
->url($webhook['url'])
27+
->payload([
28+
'token' => $webhook['api_token'],
29+
'user' => $webhook['user_key'],
30+
'message' => '👋 Testing the Pushover notification channel.',
31+
])
32+
->doNotSign()
33+
->dispatch();
34+
}
35+
36+
Notification::make()
37+
->title('Test Pushover notification sent.')
38+
->success()
39+
->send();
40+
}
41+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
namespace App\Actions\Notifications;
4+
5+
use Filament\Notifications\Notification;
6+
use Lorisleiva\Actions\Concerns\AsAction;
7+
use Spatie\WebhookServer\WebhookCall;
8+
9+
class SendSlackTestNotification
10+
{
11+
use AsAction;
12+
13+
public function handle(array $webhooks)
14+
{
15+
if (! count($webhooks)) {
16+
Notification::make()
17+
->title('You need to add Slack URLs!')
18+
->warning()
19+
->send();
20+
21+
return;
22+
}
23+
24+
foreach ($webhooks as $webhook) {
25+
WebhookCall::create()
26+
->url($webhook['url'])
27+
->payload(['text' => '👋 Testing the Slack notification channel.'])
28+
->doNotSign()
29+
->dispatch();
30+
}
31+
32+
Notification::make()
33+
->title('Test Slack notification sent.')
34+
->success()
35+
->send();
36+
}
37+
}

0 commit comments

Comments
 (0)