From 5bb991f34da94f213d60927ee2f1ce07f6bf9460 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Fri, 23 Oct 2026 18:44:43 +0200 Subject: [PATCH 1/2] fix(viewer): link the theme stylesheet only if the theme has one The editor linked themes//apps/files_mindmap/css/style.css on every instance, and without a theme as /themes//apps/..., so most instances requested a missing file each time a mind map opened. It also read the theme through the private OC_Util. Work out the stylesheet in the controller instead: read the theme from the system config, fall back to the default theme as the server does, and pass the URL to the template only if the file exists, with its modification time so changes to it are not cached. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Andy Scherzinger Signed-off-by: Felix --- lib/Controller/DisplayController.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/Controller/DisplayController.php b/lib/Controller/DisplayController.php index 645003bb..8b867169 100644 --- a/lib/Controller/DisplayController.php +++ b/lib/Controller/DisplayController.php @@ -26,6 +26,8 @@ class DisplayController extends Controller { private $l10nFactory; + private $config; + /** * @param string $AppName * @param IRequest $request @@ -36,12 +38,29 @@ class DisplayController extends Controller { public function __construct(string $AppName, IRequest $request, IURLGenerator $urlGenerator, + IConfig $config, L10NFactory $l10nFactory) { parent::__construct($AppName, $request); $this->urlGenerator = $urlGenerator; + $this->config = $config; $this->l10nFactory = $l10nFactory; } + /** + * URL of the stylesheet a legacy theme provides for the editor, with its + * modification time against caching, or null if the theme has none + */ + private function getThemeStylesheet(): ?string { + $theme = $this->config->getSystemValueString('theme', '') ?: 'default'; + $path = '/themes/' . $theme . '/apps/files_mindmap/css/style.css'; + // No public API exposes the server root + $file = \OC::$SERVERROOT . $path; + if (!is_file($file)) { + return null; + } + return $this->urlGenerator->getWebroot() . $path . '?v=' . filemtime($file); + } + /** * @PublicPage * @NoCSRFRequired @@ -51,7 +70,8 @@ public function __construct(string $AppName, public function showMindmapViewer(): TemplateResponse { $params = [ 'urlGenerator' => $this->urlGenerator, - 'lang' => $this->l10nFactory->findLanguage() + 'lang' => $this->l10nFactory->findLanguage(), + 'themeStylesheet' => $this->getThemeStylesheet(), ]; $response = new TemplateResponse($this->appName, 'viewer', $params, 'blank'); $response->addHeader('Cache-Control', 'no-cache'); From 0171784ef863414867859ae17531826a003209da Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Fri, 23 Oct 2026 18:45:08 +0200 Subject: [PATCH 2/2] fix(viewer): load the theme stylesheet after the editor's own styles The theme stylesheet came before the template's inline styles, so for rules of equal specificity, such as #menu-header .btn, the inline styles won and the theme could not override them. Link it last. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Andy Scherzinger Signed-off-by: Felix --- templates/viewer.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/viewer.php b/templates/viewer.php index 9accc0d2..0dd52cc4 100644 --- a/templates/viewer.php +++ b/templates/viewer.php @@ -126,6 +126,10 @@ line-height: 1.2; } + + + +