Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/Listeners/SpeedtestCompletedListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@

use App\Events\ResultCreated;
use App\Mail\SpeedtestCompletedMail;
use App\Settings\GeneralSettings;
use App\Settings\NotificationSettings;
use App\Telegram\TelegramNotification;
use Filament\Notifications\Notification;
use Illuminate\Support\Facades\Mail;

class SpeedtestCompletedListener
{
public $generalSettings;

public $notificationSettings;

/**
Expand All @@ -20,6 +23,8 @@ class SpeedtestCompletedListener
*/
public function __construct()
{
$this->generalSettings = new (GeneralSettings::class);

$this->notificationSettings = new (NotificationSettings::class);
}

Expand Down Expand Up @@ -59,6 +64,7 @@ public function handle(ResultCreated $event)

$message = view('telegram.speedtest-completed', [
'id' => $event->result->id,
'site_name' => $this->generalSettings->site_name,
'ping' => $ping_value,
'download' => $download_value,
'upload' => $upload_value,
Expand Down
6 changes: 6 additions & 0 deletions app/Listeners/Threshold/AbsoluteListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Events\ResultCreated;
use App\Mail\Threshold\AbsoluteMail;
use App\Settings\GeneralSettings;
use App\Settings\NotificationSettings;
use App\Settings\ThresholdSettings;
use App\Telegram\TelegramNotification;
Expand All @@ -14,6 +15,8 @@

class AbsoluteListener implements ShouldQueue
{
public $generalSettings;

public $notificationSettings;

public $thresholdSettings;
Expand All @@ -25,6 +28,8 @@ class AbsoluteListener implements ShouldQueue
*/
public function __construct()
{
$this->generalSettings = new (GeneralSettings::class);

$this->notificationSettings = new (NotificationSettings::class);

$this->thresholdSettings = new (ThresholdSettings::class);
Expand Down Expand Up @@ -205,6 +210,7 @@ protected function telegramChannel(ResultCreated $event)
$message = view('telegram.threshold.absolute', [
'id' => $event->result->id,
'url' => url('/admin/results'),
'site_name' => $this->generalSettings->site_name,
'metrics' => $failedThresholds,
])->render();

Expand Down
5 changes: 4 additions & 1 deletion resources/views/telegram/speedtest-completed.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
Speedtest #{{ $id }}
{{ $site_name }} - Result *#{{ $id }}*

*Speedtest Completed*
-----
Ping: *{{ $ping }}*
Download: *{{ $download }}*
Upload: *{{ $upload }}*
8 changes: 5 additions & 3 deletions resources/views/telegram/threshold/absolute.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Speedtest Result *#{{ $id }}*
*Absolute Threshold Failed*
{{ $site_name }} - Result *#{{ $id }}*

*Absolute Threshold(s) Failed*
-----
@foreach ($metrics as $item)
Threshold *{{ $item['name'] }}* {{ $item['threshold'] }}: *{{ $item['value'] }}*
Threshold *{{ $item['name'] }}* {{ $item['threshold'] }}: *{{ $item['value'] }}*
@endforeach