Browse Source

Properly use user background cachebuster

Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
tags/v26.0.0beta1
John Molakvoæ 1 year ago
parent
commit
a8e90a03fc
No account linked to committer's email address
2 changed files with 5 additions and 1 deletions
  1. 3
    0
      apps/theming/lib/ImageManager.php
  2. 2
    1
      apps/theming/lib/Themes/DefaultTheme.php

+ 3
- 0
apps/theming/lib/ImageManager.php View File

@@ -106,9 +106,11 @@ class ImageManager {
public function getImage(string $key, bool $useSvg = true): ISimpleFile {
$logo = $this->config->getAppValue('theming', $key . 'Mime', '');
$folder = $this->getRootFolder()->getFolder('images');

if ($logo === '' || !$folder->fileExists($key)) {
throw new NotFoundException();
}

if (!$useSvg && $this->shouldReplaceIcons()) {
if (!$folder->fileExists($key . '.png')) {
try {
@@ -126,6 +128,7 @@ class ImageManager {
return $folder->getFile($key . '.png');
}
}

return $folder->getFile($key);
}


+ 2
- 1
apps/theming/lib/Themes/DefaultTheme.php View File

@@ -239,9 +239,10 @@ class DefaultTheme implements ITheme {
$user = $this->userSession->getUser();
if ($appManager->isEnabledForUser(Application::APP_ID) && $user !== null) {
$themingBackground = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'background', 'default');
$currentVersion = (int)$this->config->getUserValue($user->getUID(), Application::APP_ID, 'backgroundVersion', '0');

if ($themingBackground === 'custom') {
$variables['--image-main-background'] = "url('" . $this->urlGenerator->linkToRouteAbsolute('theming.userTheme.getBackground') . "')";
$variables['--image-main-background'] = "url('" . $this->urlGenerator->linkToRouteAbsolute('theming.userTheme.getBackground') . "?v=$currentVersion')";
} elseif (isset(BackgroundService::SHIPPED_BACKGROUNDS[$themingBackground])) {
$variables['--image-main-background'] = "url('" . $this->urlGenerator->linkTo(Application::APP_ID, "/img/background/$themingBackground") . "')";
} elseif (substr($themingBackground, 0, 1) === '#') {

Loading…
Cancel
Save