From d03272a2583f4a5d9082a50e4cc3cdae30ab7d72 Mon Sep 17 00:00:00 2001 From: Samuel Weirich <4281791+SamuelWei@users.noreply.github.com> Date: Fri, 13 Dec 2024 15:19:57 +0100 Subject: [PATCH] Add dark mode logo support --- .../Controllers/api/v1/SettingsController.php | 11 +++++ app/Http/Requests/UpdateSettings.php | 2 + app/Http/Resources/Settings.php | 1 + app/Services/MeetingService.php | 5 +++ app/Settings/BigBlueButtonSettings.php | 2 + ..._mode_logo_to_big_blue_button_settings.php | 11 +++++ resources/js/views/AdminSettings.vue | 42 +++++++++++++++++++ 7 files changed, 74 insertions(+) create mode 100644 database/settings/2024_12_13_133315_add_dark_mode_logo_to_big_blue_button_settings.php diff --git a/app/Http/Controllers/api/v1/SettingsController.php b/app/Http/Controllers/api/v1/SettingsController.php index 68e808687..85725f9c2 100644 --- a/app/Http/Controllers/api/v1/SettingsController.php +++ b/app/Http/Controllers/api/v1/SettingsController.php @@ -110,6 +110,17 @@ public function update(UpdateSettings $request) $bigBlueButtonSettings->logo = null; } + // Dark version Logo for BBB + if ($request->has('bbb_logo_dark_file')) { + $path = $request->file('bbb_logo_dark_file')->store('images', 'public'); + $url = Storage::url($path); + $bigBlueButtonSettings->logo_dark = url($url); + } elseif ($request->has('bbb_logo_dark') && trim($request->input('bbb_logo_dark') != '')) { + $bigBlueButtonSettings->logo_dark = $request->input('bbb_logo_dark'); + } else { + $bigBlueButtonSettings->logo_dark = null; + } + // Custom style file for BBB if ($request->has('bbb_style')) { if (! empty($request->file('bbb_style'))) { diff --git a/app/Http/Requests/UpdateSettings.php b/app/Http/Requests/UpdateSettings.php index 5bc9a97cd..b687023a7 100644 --- a/app/Http/Requests/UpdateSettings.php +++ b/app/Http/Requests/UpdateSettings.php @@ -79,6 +79,8 @@ public function rules() 'bbb_logo' => ['string', 'max:255'], 'bbb_logo_file' => ['image', 'max:500'], + 'bbb_logo_dark' => ['string', 'max:255'], + 'bbb_logo_dark_file' => ['image', 'max:500'], 'bbb_style' => ['nullable', 'file', 'max:500'], 'bbb_default_presentation' => ['nullable', 'file', 'max:'.(config('bigbluebutton.max_filesize') * 1000), 'mimes:'.config('bigbluebutton.allowed_file_mimes')], ]; diff --git a/app/Http/Resources/Settings.php b/app/Http/Resources/Settings.php index 0511eb9b2..7188c7e4d 100644 --- a/app/Http/Resources/Settings.php +++ b/app/Http/Resources/Settings.php @@ -71,6 +71,7 @@ public function toArray($request) 'recording_attendance_retention_period' => $recordingSettings->attendance_retention_period, 'recording_recording_retention_period' => $recordingSettings->recording_retention_period, 'bbb_logo' => $bigBlueButtonSettings->logo, + 'bbb_logo_dark' => $bigBlueButtonSettings->logo_dark, 'bbb_style' => $bigBlueButtonSettings->style, 'bbb_default_presentation' => $bigBlueButtonSettings->default_presentation, ]; diff --git a/app/Services/MeetingService.php b/app/Services/MeetingService.php index f3c32a525..045893b31 100644 --- a/app/Services/MeetingService.php +++ b/app/Services/MeetingService.php @@ -130,6 +130,11 @@ public function start(): ?\BigBlueButton\Responses\CreateMeetingResponse $meetingParams->setLogo(app(BigBlueButtonSettings::class)->logo); } + // if a dark logo is defined, set dark logo + if (app(BigBlueButtonSettings::class)->logo_dark) { + $meetingParams->setDarklogo(app(BigBlueButtonSettings::class)->logo_dark); + } + // Try to start meeting try { $result = $this->serverService->getBigBlueButton()->createMeeting($meetingParams); diff --git a/app/Settings/BigBlueButtonSettings.php b/app/Settings/BigBlueButtonSettings.php index 619035b90..2a66edfd3 100644 --- a/app/Settings/BigBlueButtonSettings.php +++ b/app/Settings/BigBlueButtonSettings.php @@ -8,6 +8,8 @@ class BigBlueButtonSettings extends Settings { public ?string $logo; + public ?string $logo_dark; + public ?string $style; public ?string $default_presentation; diff --git a/database/settings/2024_12_13_133315_add_dark_mode_logo_to_big_blue_button_settings.php b/database/settings/2024_12_13_133315_add_dark_mode_logo_to_big_blue_button_settings.php new file mode 100644 index 000000000..121ca2e46 --- /dev/null +++ b/database/settings/2024_12_13_133315_add_dark_mode_logo_to_big_blue_button_settings.php @@ -0,0 +1,11 @@ +migrator->add('bbb.logo_dark'); + } +}; diff --git a/resources/js/views/AdminSettings.vue b/resources/js/views/AdminSettings.vue index 7fd932740..c814f1872 100644 --- a/resources/js/views/AdminSettings.vue +++ b/resources/js/views/AdminSettings.vue @@ -1098,6 +1098,34 @@ /> +