From 108fd13cdb76e41bc6bf70c6e4548955d263d7f5 Mon Sep 17 00:00:00 2001 From: NopeCharon <115794254+NopeCharon@users.noreply.github.com> Date: Tue, 27 Oct 2026 17:17:16 +0530 Subject: [PATCH] [xExtension-ImageProxy] Respect the feed option to hide enclosures The `entry_before_display` hook proxied `$entry->content()`, which by default appends the thumbnail and enclosures of the entry to its content, and then stored the result as the new content. FreshRSS renders the content afterwards with `content($withEnclosures)` based on the "Show enclosures" option of the feed, but since the enclosures were already baked into the content, they were displayed even for feeds where that option is disabled, as soon as the extension was enabled. Only include the enclosures when the feed displays them, following the same `display_enclosures` logic as the FreshRSS views and APIs. The feed is looked up in the cached categories first, like the views do, to avoid one database request per entry. When enclosures are displayed, the output is unchanged: they are still proxied and not duplicated. Bump the extension version to 1.0.4. --- xExtension-ImageProxy/README.md | 1 + xExtension-ImageProxy/extension.php | 5 ++++- xExtension-ImageProxy/metadata.json | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/xExtension-ImageProxy/README.md b/xExtension-ImageProxy/README.md index e58edc29..81ae273e 100644 --- a/xExtension-ImageProxy/README.md +++ b/xExtension-ImageProxy/README.md @@ -6,6 +6,7 @@ To use it, upload this entire directory to the FreshRSS `./extensions` directory ## Changelog +* 1.0.4 Respect the feed option to hide enclosures * 1.0.3 Proxy the poster images of videos * 1.0.1 Replace deprecated HTML entity conversion on PHP 8.2+ * 1.0 Breaking changes due to significant code upgrade: settings must be saved again diff --git a/xExtension-ImageProxy/extension.php b/xExtension-ImageProxy/extension.php index ebd056eb..4b35a07f 100644 --- a/xExtension-ImageProxy/extension.php +++ b/xExtension-ImageProxy/extension.php @@ -184,8 +184,11 @@ public static function swapUris(string $content): string { * @throws FreshRSS_Context_Exception */ public static function setImageProxyHook(FreshRSS_Entry $entry): FreshRSS_Entry { + // The enclosures become part of the content, so only include them if the feed displays them + // We most likely already have the feed object in cache, otherwise make a request + $feed = FreshRSS_Category::findFeed(FreshRSS_Context::categories(), $entry->feedId()) ?? $entry->feed(); $entry->_content( - self::swapUris($entry->content()) + self::swapUris($entry->content($feed?->attributeBoolean('display_enclosures') ?? true)) ); return $entry; diff --git a/xExtension-ImageProxy/metadata.json b/xExtension-ImageProxy/metadata.json index 9f9141c5..0663a117 100644 --- a/xExtension-ImageProxy/metadata.json +++ b/xExtension-ImageProxy/metadata.json @@ -2,7 +2,7 @@ "name": "Image Proxy", "author": "Frans de Jonge", "description": "No insecure content warnings or disappearing images.", - "version": "1.0.3", + "version": "1.0.4", "entrypoint": "ImageProxy", "type": "user" }