From f7c4fbeeedf78f52d511ff4b45f0bbb351a64fac Mon Sep 17 00:00:00 2001 From: TowyTowy <85077986+TowyTowy@users.noreply.github.com> Date: Thu, 9 Jul 2026 16:37:49 +0200 Subject: [PATCH] Redirect after saving user CSS/JS so changes apply immediately (#9006) Saving custom CSS/JS rendered the response from the pre-save state (no Post/Redirect/Get), so the stylesheet cache-busting URL was stale and the change only appeared after a manual reload, which reads as erratic behavior. Redirect back to the extension config after save, matching the pattern used elsewhere in the codebase. Fixes #8795 Co-authored-by: Claude Fable 5 --- lib/core-extensions/UserCSS/extension.php | 5 +++++ lib/core-extensions/UserCSS/metadata.json | 2 +- lib/core-extensions/UserJS/extension.php | 5 +++++ lib/core-extensions/UserJS/metadata.json | 2 +- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/core-extensions/UserCSS/extension.php b/lib/core-extensions/UserCSS/extension.php index 79b65dc6f..7f60490ff 100644 --- a/lib/core-extensions/UserCSS/extension.php +++ b/lib/core-extensions/UserCSS/extension.php @@ -25,6 +25,11 @@ final class UserCSSExtension extends Minz_Extension { $css_rules = Minz_Request::paramString('css-rules', plaintext: true); $this->saveFile(self::FILENAME, $css_rules); FreshRSS_UserDAO::touch(); + // Redirect (Post/Redirect/Get) so the next page is built after the save, + // with a fresh cache-busting URL for the updated stylesheet + Minz_Request::good(_t('feedback.conf.updated'), [ + 'c' => 'extension', 'a' => 'configure', 'params' => ['e' => $this->getName()], + ]); } $this->css_rules = ''; diff --git a/lib/core-extensions/UserCSS/metadata.json b/lib/core-extensions/UserCSS/metadata.json index 7d305c059..7ed77be17 100644 --- a/lib/core-extensions/UserCSS/metadata.json +++ b/lib/core-extensions/UserCSS/metadata.json @@ -2,7 +2,7 @@ "name": "User CSS", "author": "hkcomori, Marien Fressinaud", "description": "Give possibility to overwrite the CSS with a user-specific rules.", - "version": "1.1.1", + "version": "1.1.2", "entrypoint": "UserCSS", "type": "user" } diff --git a/lib/core-extensions/UserJS/extension.php b/lib/core-extensions/UserJS/extension.php index 56788f0ce..a983793b8 100644 --- a/lib/core-extensions/UserJS/extension.php +++ b/lib/core-extensions/UserJS/extension.php @@ -29,6 +29,11 @@ final class UserJSExtension extends Minz_Extension { $js_rules = Minz_Request::paramString('js-rules', plaintext: true); $this->saveFile(self::FILENAME, $js_rules); FreshRSS_UserDAO::touch(); + // Redirect (Post/Redirect/Get) so the next page is built after the save, + // with a fresh cache-busting URL for the updated script + Minz_Request::good(_t('feedback.conf.updated'), [ + 'c' => 'extension', 'a' => 'configure', 'params' => ['e' => $this->getName()], + ]); } $this->js_rules = ''; diff --git a/lib/core-extensions/UserJS/metadata.json b/lib/core-extensions/UserJS/metadata.json index ba15d5e36..bfc2130c3 100644 --- a/lib/core-extensions/UserJS/metadata.json +++ b/lib/core-extensions/UserJS/metadata.json @@ -2,7 +2,7 @@ "name": "User JS", "author": "hkcomori, Frans de Jonge", "description": "Apply user JS.", - "version": "1.1.2", + "version": "1.1.3", "entrypoint": "UserJS", "type": "user" }