From 3bba050f70a4e70051dc560befbf8bc9c6a10a7b Mon Sep 17 00:00:00 2001 From: Alex Justesen Date: Sat, 30 Mar 2024 19:57:57 -0400 Subject: [PATCH 1/4] deprecated general setting site name variable --- app/Filament/Pages/Settings/GeneralPage.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Filament/Pages/Settings/GeneralPage.php b/app/Filament/Pages/Settings/GeneralPage.php index 3ca1bae59..134aa1795 100644 --- a/app/Filament/Pages/Settings/GeneralPage.php +++ b/app/Filament/Pages/Settings/GeneralPage.php @@ -49,8 +49,8 @@ public function form(Form $form): Form Forms\Components\Section::make('Site Settings') ->schema([ Forms\Components\TextInput::make('site_name') - ->maxLength(50) - ->required() + ->disabled() + ->helperText(new HtmlString('⚠️ DEPRECATED: Use APP_NAME environment variable.')) ->columnSpanFull(), Forms\Components\Toggle::make('public_dashboard_enabled') ->label('Public dashboard'), From a1cee54bb7b4a39718540264f0c9d70203b40602 Mon Sep 17 00:00:00 2001 From: Alex Justesen Date: Sat, 30 Mar 2024 19:58:11 -0400 Subject: [PATCH 2/4] use app name instead --- app/Listeners/Webhook/SendSpeedtestCompletedNotification.php | 5 +---- app/Listeners/Webhook/SendSpeedtestThresholdNotification.php | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/app/Listeners/Webhook/SendSpeedtestCompletedNotification.php b/app/Listeners/Webhook/SendSpeedtestCompletedNotification.php index 9000464d5..262a18525 100644 --- a/app/Listeners/Webhook/SendSpeedtestCompletedNotification.php +++ b/app/Listeners/Webhook/SendSpeedtestCompletedNotification.php @@ -3,7 +3,6 @@ namespace App\Listeners\Webhook; use App\Events\SpeedtestCompleted; -use App\Settings\GeneralSettings; use App\Settings\NotificationSettings; use Illuminate\Support\Facades\Log; use Spatie\WebhookServer\WebhookCall; @@ -15,8 +14,6 @@ class SendSpeedtestCompletedNotification */ public function handle(SpeedtestCompleted $event): void { - $generalSettings = new GeneralSettings(); - $notificationSettings = new NotificationSettings(); if (! $notificationSettings->webhook_enabled) { @@ -38,7 +35,7 @@ public function handle(SpeedtestCompleted $event): void ->url($url['url']) ->payload([ 'result_id' => $event->result->id, - 'site_name' => $generalSettings->site_name, + 'site_name' => config('app.name'), 'ping' => $event->result->ping, 'download' => $event->result->downloadBits, 'upload' => $event->result->uploadBits, diff --git a/app/Listeners/Webhook/SendSpeedtestThresholdNotification.php b/app/Listeners/Webhook/SendSpeedtestThresholdNotification.php index 6af4d5bda..11b46d2df 100644 --- a/app/Listeners/Webhook/SendSpeedtestThresholdNotification.php +++ b/app/Listeners/Webhook/SendSpeedtestThresholdNotification.php @@ -4,7 +4,6 @@ use App\Events\SpeedtestCompleted; use App\Helpers\Number; -use App\Settings\GeneralSettings; use App\Settings\NotificationSettings; use App\Settings\ThresholdSettings; use Illuminate\Support\Facades\Log; @@ -33,8 +32,6 @@ public function handle(SpeedtestCompleted $event): void return; } - $generalSettings = new GeneralSettings(); - $thresholdSettings = new ThresholdSettings(); if (! $thresholdSettings->absolute_enabled) { @@ -68,7 +65,7 @@ public function handle(SpeedtestCompleted $event): void ->url($url['url']) ->payload([ 'result_id' => $event->result->id, - 'site_name' => $generalSettings->site_name, + 'site_name' => config('app.name'), 'metrics' => $failed, ]) ->doNotSign() From e6598fc7c52e87b90a8e09977df075543a978518 Mon Sep 17 00:00:00 2001 From: Alex Justesen Date: Sat, 30 Mar 2024 20:03:06 -0400 Subject: [PATCH 3/4] code quality --- app/helpers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers.php b/app/helpers.php index 068e47a29..8684022ce 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -62,7 +62,7 @@ function absolutePingThresholdFailed(float $threshold, float $ping): bool * @deprecated * * @param string $data - * @return bool + * @return bool */ if (! function_exists('json_validate')) { function json_validate($data) From 22aa0c904744fe6891da74fb6d2dceb83ca05322 Mon Sep 17 00:00:00 2001 From: Alex Justesen Date: Sat, 30 Mar 2024 20:06:39 -0400 Subject: [PATCH 4/4] updated doc block --- app/Settings/GeneralSettings.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Settings/GeneralSettings.php b/app/Settings/GeneralSettings.php index 234bf6f4b..40a294dad 100644 --- a/app/Settings/GeneralSettings.php +++ b/app/Settings/GeneralSettings.php @@ -15,6 +15,9 @@ class GeneralSettings extends Settings /** @var string[] */ public $speedtest_server; + /** + * @deprecated Use APP_NAME environment variable. + */ public string $site_name; public string $time_format;