Skip to content

Commit aad8345

Browse files
authored
Merge branch 'main' into feat/schedule-ui
2 parents 895c907 + b7846b0 commit aad8345

File tree

6 files changed

+25
-11
lines changed

6 files changed

+25
-11
lines changed

.devcontainer/devcontainer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// https://aka.ms/devcontainer.json
22
{
3-
"name": "Existing Docker Compose (Extend)",
3+
"name": "Speedtest Tracker Dev Environment",
44
"dockerComposeFile": [
5-
"../docker-compose.yml"
5+
"../compose.yaml"
66
],
77
"service": "laravel.test",
88
"workspaceFolder": "/var/www/html",
@@ -20,7 +20,7 @@
2020
}
2121
},
2222
"remoteUser": "sail",
23-
"postCreateCommand": "chown -R 1000:1000 /var/www/html 2>/dev/null || true"
23+
"postCreateCommand": "composer install && npm install && npm run build && touch database/database.sqlite && php artisan migrate:fresh --force"
2424
// "forwardPorts": [],
2525
// "runServices": [],
2626
// "shutdownAction": "none",

.env.example

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ LOG_DEPRECATIONS_CHANNEL=null
1818
LOG_LEVEL=debug
1919

2020
DB_CONNECTION=sqlite
21+
#DB_HOST=
22+
#DB_PORT=
23+
#DB_DATABASE=
24+
#DB_USERNAME=
25+
#DB_PASSWORD=
2126

2227
SESSION_DRIVER=cookie
2328
SESSION_LIFETIME=10080
@@ -42,3 +47,7 @@ MAIL_FROM_ADDRESS="[email protected]"
4247
MAIL_FROM_NAME="Speedtest Tracker"
4348

4449
VITE_APP_NAME="${APP_NAME}"
50+
51+
# For the Dev Container
52+
# WWWUSER=1000
53+
# WWWGROUP=1000

app/Actions/Notifications/SendWebhookTestNotification.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function handle(array $webhooks)
3737
'ping' => $fakeResult->ping,
3838
'download' => $fakeResult->download,
3939
'upload' => $fakeResult->upload,
40-
'packetLoss' => $fakeResult->data['packetLoss'],
40+
'packet_loss' => $fakeResult->data['packetLoss'],
4141
'speedtest_url' => $fakeResult->data['result']['url'],
4242
'url' => url('/admin/results'),
4343
])

app/Jobs/Ookla/BenchmarkSpeedtestJob.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use App\Events\SpeedtestBenchmarking;
88
use App\Events\SpeedtestBenchmarkUnhealthy;
99
use App\Helpers\Benchmark;
10+
use App\Helpers\Number;
1011
use App\Models\Result;
1112
use App\Settings\ThresholdSettings;
1213
use Illuminate\Bus\Batchable;
@@ -83,7 +84,8 @@ private function benchmark(Result $result, ThresholdSettings $settings): array
8384
'bar' => 'min',
8485
'passed' => Benchmark::bitrate($result->download, ['value' => $settings->absolute_download, 'unit' => 'mbps']),
8586
'type' => 'absolute',
86-
'value' => $settings->absolute_download,
87+
'test_value' => Number::bitsToMagnitude(bits: $result->download_bits, precision: 0, magnitude: 'mbit'),
88+
'benchmark_value' => $settings->absolute_download,
8789
'unit' => 'mbps',
8890
]);
8991

@@ -97,7 +99,8 @@ private function benchmark(Result $result, ThresholdSettings $settings): array
9799
'bar' => 'min',
98100
'passed' => filter_var(Benchmark::bitrate($result->upload, ['value' => $settings->absolute_upload, 'unit' => 'mbps']), FILTER_VALIDATE_BOOLEAN),
99101
'type' => 'absolute',
100-
'value' => $settings->absolute_upload,
102+
'test_value' => Number::bitsToMagnitude(bits: $result->upload_bits, precision: 0, magnitude: 'mbit'),
103+
'benchmark_value' => $settings->absolute_upload,
101104
'unit' => 'mbps',
102105
]);
103106

@@ -111,7 +114,8 @@ private function benchmark(Result $result, ThresholdSettings $settings): array
111114
'bar' => 'max',
112115
'passed' => Benchmark::ping($result->ping, ['value' => $settings->absolute_ping]),
113116
'type' => 'absolute',
114-
'value' => $settings->absolute_ping,
117+
'test_value' => round($result->ping),
118+
'benchmark_value' => $settings->absolute_ping,
115119
'unit' => 'ms',
116120
]);
117121

app/Listeners/ProcessCompletedSpeedtest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,11 @@ private function notifyWebhookChannels(Result $result): void
162162
'site_name' => config('app.name'),
163163
'server_name' => Arr::get($result->data, 'server.name'),
164164
'server_id' => Arr::get($result->data, 'server.id'),
165+
'status' => $result->status,
165166
'isp' => Arr::get($result->data, 'isp'),
166-
'ping' => $result->ping,
167-
'download' => $result->downloadBits,
168-
'upload' => $result->uploadBits,
167+
'ping' => round($result->ping),
168+
'download' => Number::bitsToMagnitude(bits: $result->download_bits, precision: 0, magnitude: 'mbit'),
169+
'upload' => Number::bitsToMagnitude(bits: $result->upload_bits, precision: 0, magnitude: 'mbit'),
169170
'packet_loss' => Arr::get($result->data, 'packetLoss'),
170171
'speedtest_url' => Arr::get($result->data, 'result.url'),
171172
'url' => url('/admin/results'),

compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ services:
2525
- mailpit
2626
- apprise
2727
pgsql:
28-
image: 'postgres:17-alpine'
28+
image: 'postgres:18-alpine'
2929
ports:
3030
- '${FORWARD_DB_PORT:-5432}:5432'
3131
environment:

0 commit comments

Comments
 (0)