diff --git a/.github/workflows/inactivity-actions.yml b/.github/workflows/inactivity-actions.yml index e4f4ab5b9..8cf93b3c6 100644 --- a/.github/workflows/inactivity-actions.yml +++ b/.github/workflows/inactivity-actions.yml @@ -14,7 +14,7 @@ jobs: name: Lock Inactive Issues runs-on: ubuntu-24.04 steps: - - uses: klaasnicolaas/action-inactivity-lock@v1.1.3 + - uses: klaasnicolaas/action-inactivity-lock@v2.0.1 id: lock with: days-inactive-issues: 14 diff --git a/app/Actions/Notifications/SendWebhookTestNotification.php b/app/Actions/Notifications/SendWebhookTestNotification.php index 45aa2abc5..7842c6ba7 100644 --- a/app/Actions/Notifications/SendWebhookTestNotification.php +++ b/app/Actions/Notifications/SendWebhookTestNotification.php @@ -2,6 +2,7 @@ namespace App\Actions\Notifications; +use App\Helpers\Number; use App\Models\Result; use App\Services\SpeedtestFakeResultGenerator; use Filament\Notifications\Notification; @@ -33,16 +34,18 @@ public function handle(array $webhooks) ->payload([ 'result_id' => Str::uuid(), 'site_name' => __('settings/notifications.test_notifications.webhook.payload'), + 'server_name' => $fakeResult->data['server']['name'], + 'server_id' => $fakeResult->data['server']['id'], 'isp' => $fakeResult->data['isp'], - 'ping' => $fakeResult->ping, - 'download' => $fakeResult->download, - 'upload' => $fakeResult->upload, + 'ping' => round($fakeResult->ping), + 'download' => Number::bitsToMagnitude(bits: $fakeResult->upload, precision: 0, magnitude: 'mbit'), + 'upload' => Number::bitsToMagnitude(bits: $fakeResult->download, precision: 0, magnitude: 'mbit'), 'packet_loss' => $fakeResult->data['packetLoss'], 'speedtest_url' => $fakeResult->data['result']['url'], 'url' => url('/admin/results'), ]) ->doNotSign() - ->dispatch(); + ->dispatchSync(); } Notification::make() diff --git a/app/Filament/Widgets/Concerns/HasChartFilters.php b/app/Filament/Widgets/Concerns/HasChartFilters.php index ce12d9384..a792e07c9 100644 --- a/app/Filament/Widgets/Concerns/HasChartFilters.php +++ b/app/Filament/Widgets/Concerns/HasChartFilters.php @@ -7,9 +7,9 @@ trait HasChartFilters protected function getFilters(): ?array { return [ - '24h' => 'Last 24 hours', - 'week' => 'Last 7 days', - 'month' => 'Last 30 days', + '24h' => __('general.last_24h'), + 'week' => __('general.last_week'), + 'month' => __('general.last_month'), ]; } } diff --git a/app/Listeners/LogWebhookFailure.php b/app/Listeners/LogWebhookFailure.php new file mode 100644 index 000000000..d9884b873 --- /dev/null +++ b/app/Listeners/LogWebhookFailure.php @@ -0,0 +1,21 @@ + $event->webhookUrl, + 'error_type' => $event->errorType, + 'error_message' => $event->errorMessage, + ]); + } +} diff --git a/app/Listeners/ProcessCompletedSpeedtest.php b/app/Listeners/ProcessCompletedSpeedtest.php index 87b7b7794..c1399c076 100644 --- a/app/Listeners/ProcessCompletedSpeedtest.php +++ b/app/Listeners/ProcessCompletedSpeedtest.php @@ -72,7 +72,7 @@ private function notifyAppriseChannels(Result $result): void 'ping' => round($result->ping).' ms', 'download' => Number::toBitRate(bits: $result->download_bits, precision: 2), 'upload' => Number::toBitRate(bits: $result->upload_bits, precision: 2), - 'packetLoss' => $result->packet_loss, + 'packetLoss' => $result->packet_loss ? round($result->packet_loss, precision: 2) : '', 'speedtest_url' => $result->result_url, 'url' => url('/admin/results'), ])->render(); diff --git a/app/Mail/CompletedSpeedtestMail.php b/app/Mail/CompletedSpeedtestMail.php index 109d95360..cfd7cecf6 100644 --- a/app/Mail/CompletedSpeedtestMail.php +++ b/app/Mail/CompletedSpeedtestMail.php @@ -51,7 +51,7 @@ public function content(): Content 'ping' => round($this->result->ping, 2).' ms', 'download' => Number::toBitRate(bits: $this->result->download_bits, precision: 2), 'upload' => Number::toBitRate(bits: $this->result->upload_bits, precision: 2), - 'packetLoss' => is_numeric($this->result->packet_loss) ? $this->result->packet_loss : 'n/a', + 'packetLoss' => $result->packet_loss ? round($result->packet_loss, precision: 2) : '', 'speedtest_url' => $this->result->result_url, 'url' => url('/admin/results'), ], diff --git a/app/Notifications/AppriseChannel.php b/app/Notifications/AppriseChannel.php index c6fe6a1c3..b5885202b 100644 --- a/app/Notifications/AppriseChannel.php +++ b/app/Notifications/AppriseChannel.php @@ -32,6 +32,11 @@ public function send(object $notifiable, Notification $notification): void return; } + Log::debug('Attempting to send Apprise notification', [ + 'channel' => $message->urls, + 'instance' => $appriseUrl, + ]); + try { $request = Http::timeout(30) ->withHeaders([ @@ -57,7 +62,7 @@ public function send(object $notifiable, Notification $notification): void throw new Exception('Apprise returned an error, please check Apprise logs for details'); } - Log::info('Apprise notification sent', [ + Log::debug('Apprise notification sent', [ 'channel' => $message->urls, 'instance' => $appriseUrl, ]); diff --git a/lang/en/general.php b/lang/en/general.php index 2d39844c2..65ffa88ee 100644 --- a/lang/en/general.php +++ b/lang/en/general.php @@ -48,10 +48,12 @@ 'settings' => 'Settings', 'users' => 'Users', 'documentation' => 'Documentation', + 'documentation_description' => 'Need help getting started or configuring your speedtests?', 'view_documentation' => 'View documentation', 'links' => 'Links', 'donate' => 'Donate', 'donations' => 'Donations', + 'donations_description' => 'Support the development and maintenance of Speedtest Tracker by making a donation.', // Roles 'admin' => 'Admin', diff --git a/lang/en/settings/notifications.php b/lang/en/settings/notifications.php index 8c3145532..8ccd940a2 100644 --- a/lang/en/settings/notifications.php +++ b/lang/en/settings/notifications.php @@ -56,6 +56,7 @@ 'webhook' => [ 'add' => 'Add webhook URLs!', 'sent' => 'Test webhook notification sent.', + 'failed' => 'Webhook notification failed.', 'payload' => 'Testing webhook notification', ], ], diff --git a/resources/views/apprise/speedtest-completed.blade.php b/resources/views/apprise/speedtest-completed.blade.php index 2efca5492..13a29162b 100644 --- a/resources/views/apprise/speedtest-completed.blade.php +++ b/resources/views/apprise/speedtest-completed.blade.php @@ -6,7 +6,9 @@ - **Ping:** {{ $ping }} - **Download:** {{ $download }} - **Upload:** {{ $upload }} +@filled($packetLoss) - **Packet Loss:** {{ $packetLoss }}% +@endfilled ### Links - [View Ookla Results]({{ $speedtest_url }}) diff --git a/resources/views/filament/pages/dashboard.blade.php b/resources/views/filament/pages/dashboard.blade.php index 2d9d68211..4dd7514ee 100644 --- a/resources/views/filament/pages/dashboard.blade.php +++ b/resources/views/filament/pages/dashboard.blade.php @@ -20,7 +20,7 @@ class="col-span-1"
-

Need help getting started or configuring your speedtests?

+

{{ __('general.documentation_description') }}

@@ -45,7 +45,7 @@ class="col-span-1"
-

Support the development and maintenance of Speedtest Tracker by making a donation.

+

{{ __('general.donations_description') }}

diff --git a/resources/views/mail/speedtest/completed.blade.php b/resources/views/mail/speedtest/completed.blade.php index ac40c0e0f..cb0413e47 100644 --- a/resources/views/mail/speedtest/completed.blade.php +++ b/resources/views/mail/speedtest/completed.blade.php @@ -12,7 +12,9 @@ | Ping | {{ $ping }} | | Download | {{ $download }} | | Upload | {{ $upload }} | +@filled($packetLoss) | Packet Loss | {{ $packetLoss }} **%** | +@endfilled