Skip to content

Commit 70865d7

Browse files
authored
Merge pull request #38853 from nextcloud/backport/38823/stable26
[stable26] generate user themed favicon and touchicon
2 parents 97addd5 + 63df50f commit 70865d7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

apps/theming/lib/Controller/IconController.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,15 @@ public function getFavicon(string $app = 'core'): Response {
120120
} catch (NotFoundException $e) {
121121
}
122122
if ($iconFile === null && $this->imageManager->shouldReplaceIcons()) {
123+
$color = $this->themingDefaults->getColorPrimary();
123124
try {
124-
$iconFile = $this->imageManager->getCachedImage('favIcon-' . $app);
125+
$iconFile = $this->imageManager->getCachedImage('favIcon-' . $app . $color);
125126
} catch (NotFoundException $exception) {
126127
$icon = $this->iconBuilder->getFavicon($app);
127128
if ($icon === false || $icon === '') {
128129
return new NotFoundResponse();
129130
}
130-
$iconFile = $this->imageManager->setCachedImage('favIcon-' . $app, $icon);
131+
$iconFile = $this->imageManager->setCachedImage('favIcon-' . $app . $color, $icon);
131132
}
132133
$response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/x-icon']);
133134
}
@@ -157,14 +158,15 @@ public function getTouchIcon(string $app = 'core'): Response {
157158
} catch (NotFoundException $e) {
158159
}
159160
if ($this->imageManager->shouldReplaceIcons()) {
161+
$color = $this->themingDefaults->getColorPrimary();
160162
try {
161-
$iconFile = $this->imageManager->getCachedImage('touchIcon-' . $app);
163+
$iconFile = $this->imageManager->getCachedImage('touchIcon-' . $app . $color);
162164
} catch (NotFoundException $exception) {
163165
$icon = $this->iconBuilder->getTouchIcon($app);
164166
if ($icon === false || $icon === '') {
165167
return new NotFoundResponse();
166168
}
167-
$iconFile = $this->imageManager->setCachedImage('touchIcon-' . $app, $icon);
169+
$iconFile = $this->imageManager->setCachedImage('touchIcon-' . $app . $color, $icon);
168170
}
169171
$response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/png']);
170172
}

0 commit comments

Comments
 (0)