mirror of
https://github.com/mwalbeck/nextcloud-breeze-dark.git
synced 2025-04-08 06:50:11 +00:00
Only load custom styling when there actually is custom styling to get
This commit is contained in:
parent
41fa3f68e3
commit
0bb63e0b42
3 changed files with 21 additions and 25 deletions
|
@ -2,6 +2,10 @@
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
### Changed
|
||||
|
||||
- Only load custom styling when there actually is custom styling to get
|
||||
|
||||
## 21.0.2 - 2021-02-27
|
||||
|
||||
### Added
|
||||
|
|
|
@ -94,16 +94,19 @@ class Application extends App implements IBootstrap {
|
|||
Util::addStyle($this->appName, 'guest');
|
||||
}
|
||||
|
||||
$linkToCustomStyling = $urlGenerator->linkToRoute(
|
||||
'breezedark.Theming.getCustomStyling',
|
||||
['v' => $cachebuster,]
|
||||
);
|
||||
Util::addHeader(
|
||||
'link',
|
||||
[
|
||||
'rel' => 'stylesheet',
|
||||
'href' => $linkToCustomStyling,
|
||||
]
|
||||
);
|
||||
// Only request the stylesheet if there is any styling to request
|
||||
if ($cachebuster) {
|
||||
$linkToCustomStyling = $urlGenerator->linkToRoute(
|
||||
'breezedark.Theming.getCustomStyling',
|
||||
['v' => $cachebuster,]
|
||||
);
|
||||
Util::addHeader(
|
||||
'link',
|
||||
[
|
||||
'rel' => 'stylesheet',
|
||||
'href' => $linkToCustomStyling,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,21 +99,10 @@ class SettingsController extends Controller {
|
|||
$this->config->setAppValue($this->appName, "theme_custom_styling", $this->request->getParam("theme_custom_styling"));
|
||||
$this->config->setAppValue($this->appName, "theme_cachebuster", time());
|
||||
} else {
|
||||
// If the request is empty set custom_styling to empty string and
|
||||
// set cachebuster to 0 to indicate that no custom styling is available
|
||||
$this->config->setAppValue($this->appName, "theme_custom_styling", "");
|
||||
$this->config->setAppValue($this->appName, "theme_cachebuster", 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoCSRFRequired
|
||||
* @PublicPage
|
||||
* @NoSameSiteCookieRequired
|
||||
*
|
||||
* @return DataDisplayResponse|NotFoundResponse
|
||||
*/
|
||||
public function getCustomStyling(): DataDisplayResponse {
|
||||
$customStyling = $this->config->getAppValue($this->appName, 'theme_custom_styling', '');
|
||||
$response = new DataDisplayResponse($customStyling, Http::STATUS_OK, ['Content-Type' => 'text/css']);
|
||||
$response->cacheFor(86400);
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue