From a11a4f7a7577638a2262084ece867b5570c9db0b Mon Sep 17 00:00:00 2001 From: jld3103 Date: Wed, 11 Oct 2023 19:01:59 +0200 Subject: [PATCH] fix(theming): Stop leaking user theme into capabilities Signed-off-by: jld3103 --- apps/theming/lib/Capabilities.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/apps/theming/lib/Capabilities.php b/apps/theming/lib/Capabilities.php index fbb287aa41067..b63401b7c10a6 100644 --- a/apps/theming/lib/Capabilities.php +++ b/apps/theming/lib/Capabilities.php @@ -86,23 +86,26 @@ public function __construct(ThemingDefaults $theming, Util $util, IURLGenerator * } */ public function getCapabilities() { + $color = $this->theming->getDefaultColorPrimary(); + $colorText = $this->theming->getDefaultTextColorPrimary(); + $backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime', ''); - $color = $this->theming->getColorPrimary(); + $backgroundPlain = $backgroundLogo === 'backgroundColor' || ($backgroundLogo === '' && $color !== '#0082c9'); + $background = $backgroundPlain ? $color : $this->url->getAbsoluteURL($this->theming->getBackground()); + return [ 'theming' => [ 'name' => $this->theming->getName(), 'url' => $this->theming->getBaseUrl(), 'slogan' => $this->theming->getSlogan(), 'color' => $color, - 'color-text' => $this->theming->getTextColorPrimary(), + 'color-text' => $colorText, 'color-element' => $this->util->elementColor($color), 'color-element-bright' => $this->util->elementColor($color), 'color-element-dark' => $this->util->elementColor($color, false), 'logo' => $this->url->getAbsoluteURL($this->theming->getLogo()), - 'background' => $backgroundLogo === 'backgroundColor' || ($backgroundLogo === '' && $this->theming->getColorPrimary() !== '#0082c9') ? - $this->theming->getColorPrimary() : - $this->url->getAbsoluteURL($this->theming->getBackground()), - 'background-plain' => $backgroundLogo === 'backgroundColor' || ($backgroundLogo === '' && $this->theming->getColorPrimary() !== '#0082c9'), + 'background' => $background, + 'background-plain' => $backgroundPlain, 'background-default' => !$this->util->isBackgroundThemed(), 'logoheader' => $this->url->getAbsoluteURL($this->theming->getLogo()), 'favicon' => $this->url->getAbsoluteURL($this->theming->getLogo()),