diff --git a/app/Events/SpeedtestCompleted.php b/app/Events/SpeedtestCompleted.php index cf5d97253..90ea3e2df 100644 --- a/app/Events/SpeedtestCompleted.php +++ b/app/Events/SpeedtestCompleted.php @@ -16,6 +16,5 @@ class SpeedtestCompleted */ public function __construct( public Result $result, - ) { - } + ) {} } diff --git a/app/Events/SpeedtestFailed.php b/app/Events/SpeedtestFailed.php index 6181d3d44..c931555b2 100644 --- a/app/Events/SpeedtestFailed.php +++ b/app/Events/SpeedtestFailed.php @@ -16,6 +16,5 @@ class SpeedtestFailed */ public function __construct( public Result $result, - ) { - } + ) {} } diff --git a/app/Events/SpeedtestStarted.php b/app/Events/SpeedtestStarted.php index 84b49e3e4..d4bdf9913 100644 --- a/app/Events/SpeedtestStarted.php +++ b/app/Events/SpeedtestStarted.php @@ -16,6 +16,5 @@ class SpeedtestStarted */ public function __construct( public Result $result, - ) { - } + ) {} } diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index d0522d498..23349fdfe 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -13,10 +13,6 @@ class HomeController extends Controller */ public function __invoke(Request $request) { - if (! config('speedtest.public_dashboard')) { - return redirect()->route('filament.admin.auth.login'); - } - $latestResult = Result::query() ->select(['id', 'ping', 'download', 'upload', 'status', 'created_at']) ->where('status', '=', ResultStatus::Completed) diff --git a/app/Http/Middleware/PublicDashboard.php b/app/Http/Middleware/PublicDashboard.php new file mode 100644 index 000000000..31e2ad023 --- /dev/null +++ b/app/Http/Middleware/PublicDashboard.php @@ -0,0 +1,24 @@ +route('filament.admin.auth.login'); + } + + return $next($request); + } +} diff --git a/app/Jobs/InfluxDBv2/WriteCompletedSpeedtest.php b/app/Jobs/InfluxDBv2/WriteCompletedSpeedtest.php index ea6328bd8..c06de4525 100644 --- a/app/Jobs/InfluxDBv2/WriteCompletedSpeedtest.php +++ b/app/Jobs/InfluxDBv2/WriteCompletedSpeedtest.php @@ -24,8 +24,7 @@ class WriteCompletedSpeedtest implements ShouldQueue public function __construct( public Result $result, public InfluxDbSettings $settings, - ) { - } + ) {} /** * Execute the job. diff --git a/app/Jobs/Speedtests/ExecuteOoklaSpeedtest.php b/app/Jobs/Speedtests/ExecuteOoklaSpeedtest.php index 995884519..166c03e41 100644 --- a/app/Jobs/Speedtests/ExecuteOoklaSpeedtest.php +++ b/app/Jobs/Speedtests/ExecuteOoklaSpeedtest.php @@ -34,8 +34,7 @@ class ExecuteOoklaSpeedtest implements ShouldBeUnique, ShouldQueue public function __construct( public Result $result, public ?int $serverId, - ) { - } + ) {} /** * Execute the job. diff --git a/app/Jobs/TruncateResults.php b/app/Jobs/TruncateResults.php index b3202a800..e5e065567 100644 --- a/app/Jobs/TruncateResults.php +++ b/app/Jobs/TruncateResults.php @@ -24,8 +24,7 @@ class TruncateResults implements ShouldQueue public function __construct( public User $user, - ) { - } + ) {} /** * Execute the job. diff --git a/app/Mail/SpeedtestCompletedMail.php b/app/Mail/SpeedtestCompletedMail.php index 66890aa36..f8480f1bb 100644 --- a/app/Mail/SpeedtestCompletedMail.php +++ b/app/Mail/SpeedtestCompletedMail.php @@ -23,8 +23,7 @@ class SpeedtestCompletedMail extends Mailable implements ShouldQueue */ public function __construct( public Result $result, - ) { - } + ) {} /** * Get the message envelope. diff --git a/app/Mail/SpeedtestThresholdMail.php b/app/Mail/SpeedtestThresholdMail.php index 6fb93ee09..46202f28f 100644 --- a/app/Mail/SpeedtestThresholdMail.php +++ b/app/Mail/SpeedtestThresholdMail.php @@ -23,8 +23,7 @@ class SpeedtestThresholdMail extends Mailable implements ShouldQueue public function __construct( public Result $result, public array $metrics, - ) { - } + ) {} /** * Get the message envelope. diff --git a/app/Notifications/Telegram/SpeedtestNotification.php b/app/Notifications/Telegram/SpeedtestNotification.php index 066bef93f..5317f7bf9 100644 --- a/app/Notifications/Telegram/SpeedtestNotification.php +++ b/app/Notifications/Telegram/SpeedtestNotification.php @@ -17,8 +17,7 @@ class SpeedtestNotification extends Notification implements ShouldQueue public function __construct( public string $content, public bool $disableNotification = false, - ) { - } + ) {} /** * Get the notification's delivery channels. diff --git a/bootstrap/app.php b/bootstrap/app.php index 1966d3b22..111038ee8 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -1,5 +1,6 @@ withMiddleware(function (Middleware $middleware) { + $middleware->alias([ + 'public-dashboard' => PublicDashboard::class, + ]); + $middleware->redirectGuestsTo(fn () => route('admin/login')); $middleware->redirectUsersTo(AppServiceProvider::HOME); diff --git a/pint.json b/pint.json index 818cc63b8..714c8e3ab 100644 --- a/pint.json +++ b/pint.json @@ -4,6 +4,7 @@ "config" ], "rules": { - "fully_qualified_strict_types": false + "fully_qualified_strict_types": false, + "single_line_empty_body": true } } diff --git a/routes/web.php b/routes/web.php index 0700387c8..9d36b44a8 100644 --- a/routes/web.php +++ b/routes/web.php @@ -14,8 +14,10 @@ | */ -Route::get('/', HomeController::class) - ->name('home'); +Route::middleware('public-dashboard')->group(function () { + Route::get('/', HomeController::class) + ->name('home'); +}); Route::redirect('/login', '/admin/login') ->name('login');