Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
generate user themed favicon and touchicon
Signed-off-by: Simon L <[email protected]>
  • Loading branch information
szaimen authored and backportbot-nextcloud[bot] committed Jun 16, 2023
commit 53c0790e8f0d6085455ccb23ffb0c0cf9e193930
10 changes: 6 additions & 4 deletions apps/theming/lib/Controller/IconController.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,15 @@ public function getFavicon(string $app = 'core'): Response {
} catch (NotFoundException $e) {
}
if ($iconFile === null && $this->imageManager->shouldReplaceIcons()) {
$color = $this->themingDefaults->getColorPrimary();
try {
$iconFile = $this->imageManager->getCachedImage('favIcon-' . $app);
$iconFile = $this->imageManager->getCachedImage('favIcon-' . $app . $color);
} catch (NotFoundException $exception) {
$icon = $this->iconBuilder->getFavicon($app);
if ($icon === false || $icon === '') {
return new NotFoundResponse();
}
$iconFile = $this->imageManager->setCachedImage('favIcon-' . $app, $icon);
$iconFile = $this->imageManager->setCachedImage('favIcon-' . $app . $color, $icon);
}
$response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/x-icon']);
}
Expand Down Expand Up @@ -157,14 +158,15 @@ public function getTouchIcon(string $app = 'core'): Response {
} catch (NotFoundException $e) {
}
if ($this->imageManager->shouldReplaceIcons()) {
$color = $this->themingDefaults->getColorPrimary();
try {
$iconFile = $this->imageManager->getCachedImage('touchIcon-' . $app);
$iconFile = $this->imageManager->getCachedImage('touchIcon-' . $app . $color);
} catch (NotFoundException $exception) {
$icon = $this->iconBuilder->getTouchIcon($app);
if ($icon === false || $icon === '') {
return new NotFoundResponse();
}
$iconFile = $this->imageManager->setCachedImage('touchIcon-' . $app, $icon);
$iconFile = $this->imageManager->setCachedImage('touchIcon-' . $app . $color, $icon);
}
$response = new FileDisplayResponse($iconFile, Http::STATUS_OK, ['Content-Type' => 'image/png']);
}
Expand Down