File tree Expand file tree Collapse file tree 3 files changed +32
-1
lines changed
Expand file tree Collapse file tree 3 files changed +32
-1
lines changed Original file line number Diff line number Diff line change 1111use App \Filament \Widgets \RecentUploadChartWidget ;
1212use App \Filament \Widgets \RecentUploadLatencyChartWidget ;
1313use App \Filament \Widgets \StatsOverviewWidget ;
14+ use App \Helpers \Ookla ;
1415use Carbon \Carbon ;
1516use Cron \CronExpression ;
1617use Filament \Actions \Action ;
@@ -57,6 +58,12 @@ protected function getHeaderActions(): array
5758 ->label ('Select Server ' )
5859 ->helperText ('Leave empty to run the speedtest without specifying a server. ' )
5960 ->options (fn (): array => GetOoklaSpeedtestServers::run ())
61+ ->options (function (): array {
62+ return array_filter ([
63+ 'Manual servers ' => Ookla::getConfigServers (),
64+ 'Closest servers ' => GetOoklaSpeedtestServers::run (),
65+ ]);
66+ })
6067 ->searchable (),
6168 ])
6269 ->action (function (array $ data ) {
Original file line number Diff line number Diff line change @@ -28,4 +28,28 @@ public static function getErrorMessage(ProcessFailedException $exception): strin
2828
2929 return $ errorMessage ;
3030 }
31+
32+ public static function getConfigServers (): ?array
33+ {
34+ $ list = [];
35+
36+ if (blank (config ('speedtest.servers ' ))) {
37+ return null ;
38+ }
39+
40+ $ servers = collect (array_map (
41+ 'trim ' ,
42+ explode (', ' , config ('speedtest.servers ' ))
43+ ));
44+
45+ if (! count ($ servers )) {
46+ return null ;
47+ }
48+
49+ $ list = $ servers ->mapWithKeys (function ($ serverId ) {
50+ return [$ serverId => $ serverId .' (Config server) ' ];
51+ })->sort ()->toArray ();
52+
53+ return $ list ;
54+ }
3155}
Original file line number Diff line number Diff line change 3131 */
3232 'schedule ' => env ('SPEEDTEST_SCHEDULE ' , false ),
3333
34- 'servers ' => env ('SPEEDTEST_SERVERS ' , '' ),
34+ 'servers ' => env ('SPEEDTEST_SERVERS ' ),
3535
3636 /**
3737 * IP filtering settings.
You can’t perform that action at this time.
0 commit comments