From 6f81c0d1c91ae98e121a2098ad71d6606223e675 Mon Sep 17 00:00:00 2001 From: NopeCharon <115794254+NopeCharon@users.noreply.github.com> Date: Wed, 11 Nov 2026 19:40:39 +0530 Subject: [PATCH 1/6] [xExtension-ImageProxy] Add a list of domains that are not proxied Every image whose scheme is enabled for proxying was sent through the proxy, with no way to keep some hosts out. This breaks images served from internal hosts that the proxy cannot reach (e.g. an intranet or a private IP range, which also happens with a self-hosted wsrv.nl), and images from domains that the proxy refuses to serve, such as some of the domains blocked by wsrv.nl. Add an "excluded domains" setting to the configuration page: a textarea taking one domain per line or a comma-separated list, empty by default. When the host of an image URL (`src`, each `srcset` candidate, or video `poster`) is one of those domains or a subdomain of one of them, the URL is left untouched. The comparison is case-insensitive and only looks at the host, so ports and paths do not matter. Entries written as `*.example.org` or `.example.org` are accepted, as are IPv6 addresses with or without brackets. Hosts that merely end with an excluded domain (`myexample.org`) are still proxied. Add regression tests, document the setting in the README with a changelog entry, add the English, German, French and Dutch translations (Turkish is marked as TODO), and bump the extension version to 1.1.0. Fixes #229 --- tests/ImageProxyTest.php | 43 ++++++++++++++++++++++++++- xExtension-ImageProxy/README.md | 5 ++++ xExtension-ImageProxy/configure.phtml | 9 ++++++ xExtension-ImageProxy/extension.php | 29 ++++++++++++++++++ xExtension-ImageProxy/i18n/de/ext.php | 4 ++- xExtension-ImageProxy/i18n/en/ext.php | 4 ++- xExtension-ImageProxy/i18n/fr/ext.php | 4 ++- xExtension-ImageProxy/i18n/nl/ext.php | 4 ++- xExtension-ImageProxy/i18n/tr/ext.php | 2 ++ xExtension-ImageProxy/metadata.json | 2 +- 10 files changed, 100 insertions(+), 6 deletions(-) diff --git a/tests/ImageProxyTest.php b/tests/ImageProxyTest.php index 8049d7db..1aae4ac0 100644 --- a/tests/ImageProxyTest.php +++ b/tests/ImageProxyTest.php @@ -68,6 +68,7 @@ public function run(): void { $this->testImageAttributes(); $this->testVideoPosters(); $this->testUriSchemes(); + $this->testExcludedDomains(); } catch (FreshRSS_Context_Exception $e) { throw new RuntimeException('ImageProxy configuration failed', 0, $e); } finally { @@ -77,7 +78,7 @@ public function run(): void { fwrite(STDOUT, "ImageProxy regression tests passed ({$this->assertions} assertions).\n"); } - private function configure(bool $includeScheme = true, bool $encodeUrl = false): void { + private function configure(bool $includeScheme = true, bool $encodeUrl = false, string $excludedDomains = ''): void { ImageProxyTestContext::configure([ 'image_proxy_url' => self::PROXY_URL, 'image_proxy_scheme_http' => true, @@ -85,6 +86,7 @@ private function configure(bool $includeScheme = true, bool $encodeUrl = false): 'image_proxy_scheme_default' => 'auto', 'image_proxy_scheme_include' => $includeScheme, 'image_proxy_url_encode' => $encodeUrl, + 'image_proxy_excluded_domains' => $excludedDomains, ]); } @@ -209,6 +211,45 @@ private function testUriSchemes(): void { ); } + /** @throws FreshRSS_Context_Exception */ + private function testExcludedDomains(): void { + $this->configure(excludedDomains: " Intranet.example,\r\n*.cdn.example 192.168.1.10\n.dot.example,[::1],,\n"); + $notProxied = [ + 'http://intranet.example/a.png' => 'Excluded domains must not be proxied', + 'https://INTRANET.example/a.png' => 'Excluded domains must be matched case-insensitively', + 'http://images.intranet.example/a.png' => 'Subdomains of excluded domains must not be proxied', + 'http://cdn.example/a.png' => 'Wildcard entries must match the domain itself', + 'http://img.cdn.example/a.png' => 'Wildcard entries must match subdomains', + 'http://img.dot.example/a.png' => 'Entries with a leading dot must match subdomains', + 'http://192.168.1.10:8080/a.png' => 'Excluded IP addresses must not be proxied, whatever the port', + 'http://[::1]/a.png' => 'Excluded IPv6 addresses must not be proxied', + '//intranet.example/a.png' => 'Protocol-relative URLs of excluded domains must not be proxied', + ]; + foreach ($notProxied as $url => $message) { + $this->assertSame($url, ImageProxyExtension::getProxyImageUri($url), $message); + } + + $proxied = [ + 'http://example/a.png' => 'Parent domains of excluded domains must be proxied', + 'http://myintranet.example/a.png' => 'Domains merely ending with an excluded domain must be proxied', + 'http://intranet.example.org/a.png' => 'Domains merely starting with an excluded domain must be proxied', + 'http://192.168.1.100/a.png' => 'Other IP addresses must be proxied', + 'http://images.example/intranet.example.png' => 'Only the host must be compared to excluded domains', + ]; + foreach ($proxied as $url => $message) { + $this->assertSame(self::PROXY_URL . $url, ImageProxyExtension::getProxyImageUri($url), $message); + } + + $images = $this->images(ImageProxyExtension::swapUris( + '')); + $this->assertSame('http://intranet.example/a.png', $images[0]->getAttribute('src'), 'Images of excluded domains must keep their src'); + $this->assertSame( + 'http://intranet.example/b.png 1x, ' . self::PROXY_URL . 'http://images.example/c.png 2x', + $images[0]->getAttribute('srcset'), + 'Only srcset candidates of non-excluded domains must be proxied', + ); + } + private function textContent(string $html): string { $doc = $this->parseFragment($html); $body = $doc->getElementsByTagName('body')->item(0); diff --git a/xExtension-ImageProxy/README.md b/xExtension-ImageProxy/README.md index 81ae273e..8468c889 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.1.0 Add a list of domains that are not proxied * 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+ @@ -27,6 +28,10 @@ To use it, upload this entire directory to the FreshRSS `./extensions` directory * `url_encode` (default: `1`): whether to URL-encode (RFC 3986) the proxied URL +* `excluded_domains` (default: empty): domains whose images are never proxied, one per line or separated by commas, e.g. `intranet.example, 192.168.1.10`; + subdomains are matched too, so `example.org` also covers `images.example.org`. + This is useful for images served from internal hosts that the proxy cannot reach, or from domains that the proxy refuses to serve + ## Proxy Settings By default this extension will use the [wsrv.nl](https://wsrv.nl) image caching and resizing proxy, but instead you can supply your own proxy URL in the settings. An example URL would look like ``https://images.example.com/?url=``. diff --git a/xExtension-ImageProxy/configure.phtml b/xExtension-ImageProxy/configure.phtml index 1042e30e..9828ef00 100644 --- a/xExtension-ImageProxy/configure.phtml +++ b/xExtension-ImageProxy/configure.phtml @@ -52,6 +52,15 @@ attributeBool('image_proxy_url_encode') ? 'checked' : '' ?>> +
+ +
+ +

+
+
diff --git a/xExtension-ImageProxy/extension.php b/xExtension-ImageProxy/extension.php index 4b35a07f..cd633e7c 100644 --- a/xExtension-ImageProxy/extension.php +++ b/xExtension-ImageProxy/extension.php @@ -10,6 +10,7 @@ final class ImageProxyExtension extends Minz_Extension { private const SCHEME_DEFAULT = 'auto'; private const SCHEME_INCLUDE = false; private const URL_ENCODE = true; + private const EXCLUDED_DOMAINS = ''; /** * @throws FreshRSS_Context_Exception @@ -46,6 +47,10 @@ public function init(): void { FreshRSS_Context::userConf()->_attribute('image_proxy_url_encode', self::URL_ENCODE); $save = true; } + if (FreshRSS_Context::userConf()->attributeString('image_proxy_excluded_domains') === null) { + FreshRSS_Context::userConf()->_attribute('image_proxy_excluded_domains', self::EXCLUDED_DOMAINS); + $save = true; + } if ($save) { FreshRSS_Context::userConf()->save(); } @@ -66,15 +71,39 @@ public function handleConfigureAction(): void { Minz_Request::paramString('image_proxy_scheme_default', plaintext: true) ?: self::SCHEME_DEFAULT); FreshRSS_Context::userConf()->_attribute('image_proxy_scheme_include', Minz_Request::paramBoolean('image_proxy_scheme_include')); FreshRSS_Context::userConf()->_attribute('image_proxy_url_encode', Minz_Request::paramBoolean('image_proxy_url_encode')); + FreshRSS_Context::userConf()->_attribute('image_proxy_excluded_domains', Minz_Request::paramString('image_proxy_excluded_domains', plaintext: true)); FreshRSS_Context::userConf()->save(); } } + /** + * Whether the host is one of the domains excluded from proxying, or a subdomain of one of them. + * @throws FreshRSS_Context_Exception + */ + private static function isExcludedHost(string $host): bool { + $host = trim(strtolower($host), '[].'); + if ($host === '') { + return false; + } + $excludedDomains = strtolower(FreshRSS_Context::userConf()->attributeString('image_proxy_excluded_domains') ?? ''); + $domains = preg_split('/[\s,]+/', $excludedDomains, flags: PREG_SPLIT_NO_EMPTY) ?: []; + foreach ($domains as $domain) { + $domain = trim($domain, '*[].'); // Accept `*.example.org`, `.example.org`, and `[::1]` + if ($domain !== '' && ($host === $domain || str_ends_with($host, '.' . $domain))) { + return true; + } + } + return false; + } + /** * @throws FreshRSS_Context_Exception */ public static function getProxyImageUri(string $url): string { $parsed_url = parse_url($url); + if (isset($parsed_url['host']) && self::isExcludedHost($parsed_url['host'])) { + return $url; + } $scheme = $parsed_url['scheme'] ?? ''; if ($scheme === 'http') { if (!FreshRSS_Context::userConf()->attributeBool('image_proxy_scheme_http')) { diff --git a/xExtension-ImageProxy/i18n/de/ext.php b/xExtension-ImageProxy/i18n/de/ext.php index 5edfd73a..47c117b9 100644 --- a/xExtension-ImageProxy/i18n/de/ext.php +++ b/xExtension-ImageProxy/i18n/de/ext.php @@ -7,6 +7,8 @@ 'scheme_https' => 'HTTPS-Proxy', 'scheme_default' => 'Proxy protokoll-relative URL', 'scheme_include' => 'http*:// in die URL einfügen', - 'url_encode' => 'URL-Prozentkodierung' + 'url_encode' => 'URL-Prozentkodierung', + 'excluded_domains' => 'Diese Domains nicht über den Proxy laden', + 'excluded_domains_help' => 'Eine Domain pro Zeile (oder durch Kommas getrennt). Ihre Subdomains werden ebenfalls nicht über den Proxy geladen: example.org gilt zum Beispiel auch für images.example.org.', ), ); diff --git a/xExtension-ImageProxy/i18n/en/ext.php b/xExtension-ImageProxy/i18n/en/ext.php index 1bca58ac..a7f1d872 100644 --- a/xExtension-ImageProxy/i18n/en/ext.php +++ b/xExtension-ImageProxy/i18n/en/ext.php @@ -7,6 +7,8 @@ 'scheme_https' => 'Proxy HTTPS', 'scheme_default' => 'Proxy protocol-relative URL', 'scheme_include' => 'Include http*:// in URL', - 'url_encode' => 'Encode the URL' + 'url_encode' => 'Encode the URL', + 'excluded_domains' => 'Do not proxy these domains', + 'excluded_domains_help' => 'One domain per line (or separated by commas). Their subdomains are not proxied either: for instance, example.org also matches images.example.org.', ), ); diff --git a/xExtension-ImageProxy/i18n/fr/ext.php b/xExtension-ImageProxy/i18n/fr/ext.php index a04583ff..7ec3c988 100644 --- a/xExtension-ImageProxy/i18n/fr/ext.php +++ b/xExtension-ImageProxy/i18n/fr/ext.php @@ -7,6 +7,8 @@ 'scheme_https' => 'Proxy HTTPS', 'scheme_default' => 'Proxy URLs sans protocole', 'scheme_include' => 'Inclure http*:// dans l\'URL', - 'url_encode' => 'Encoder l\'URL' + 'url_encode' => 'Encoder l\'URL', + 'excluded_domains' => 'Ne pas utiliser le proxy pour ces domaines', + 'excluded_domains_help' => 'Un domaine par ligne (ou séparés par des virgules). Leurs sous-domaines ne passent pas non plus par le proxy : par exemple, example.org correspond aussi à images.example.org.', ), ); diff --git a/xExtension-ImageProxy/i18n/nl/ext.php b/xExtension-ImageProxy/i18n/nl/ext.php index 5c113151..926013b6 100644 --- a/xExtension-ImageProxy/i18n/nl/ext.php +++ b/xExtension-ImageProxy/i18n/nl/ext.php @@ -7,6 +7,8 @@ 'scheme_https' => 'Https proxyen', 'scheme_default' => 'Protocol-relatieve url’s proxyen', 'scheme_include' => 'http*:// in url opnemen', - 'url_encode' => 'Url encoderen' + 'url_encode' => 'Url encoderen', + 'excluded_domains' => 'Deze domeinen niet proxyen', + 'excluded_domains_help' => 'Eén domein per regel (of gescheiden door komma’s). Hun subdomeinen worden ook niet geproxyd: example.org geldt bijvoorbeeld ook voor images.example.org.', ), ); diff --git a/xExtension-ImageProxy/i18n/tr/ext.php b/xExtension-ImageProxy/i18n/tr/ext.php index 184645b4..81c25653 100644 --- a/xExtension-ImageProxy/i18n/tr/ext.php +++ b/xExtension-ImageProxy/i18n/tr/ext.php @@ -8,5 +8,7 @@ 'scheme_default' => 'Belirtilmemiş Vekil URL Şeması', 'scheme_include' => 'Bağlantıya http*:// ekle', 'url_encode' => 'Bağlantıyı kodla', + 'excluded_domains' => 'Do not proxy these domains', // TODO + 'excluded_domains_help' => 'One domain per line (or separated by commas). Their subdomains are not proxied either: for instance, example.org also matches images.example.org.', // TODO ), ); diff --git a/xExtension-ImageProxy/metadata.json b/xExtension-ImageProxy/metadata.json index 0663a117..1d755b1c 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.4", + "version": "1.1.0", "entrypoint": "ImageProxy", "type": "user" } From f09fe8d9fe0d2d2ca2bec4fcece62545df8af64c Mon Sep 17 00:00:00 2001 From: NopeCharon <115794254+NopeCharon@users.noreply.github.com> Date: Wed, 11 Nov 2026 20:06:47 +0530 Subject: [PATCH 2/6] [xExtension-ImageProxy] Reword Dutch help text to satisfy the spell check --- xExtension-ImageProxy/i18n/nl/ext.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xExtension-ImageProxy/i18n/nl/ext.php b/xExtension-ImageProxy/i18n/nl/ext.php index 926013b6..e3bc68d8 100644 --- a/xExtension-ImageProxy/i18n/nl/ext.php +++ b/xExtension-ImageProxy/i18n/nl/ext.php @@ -9,6 +9,6 @@ 'scheme_include' => 'http*:// in url opnemen', 'url_encode' => 'Url encoderen', 'excluded_domains' => 'Deze domeinen niet proxyen', - 'excluded_domains_help' => 'Eén domein per regel (of gescheiden door komma’s). Hun subdomeinen worden ook niet geproxyd: example.org geldt bijvoorbeeld ook voor images.example.org.', + 'excluded_domains_help' => 'Eén domein per regel (of gescheiden door het teken «,»). Hun subdomeinen worden ook niet geproxyd: example.org geldt bijvoorbeeld ook voor images.example.org.', ), ); From 5f1285e57007add65ed37b99630d5d3b02c8728f Mon Sep 17 00:00:00 2001 From: NopeCharon <115794254+NopeCharon@users.noreply.github.com> Date: Wed, 11 Nov 2026 23:14:32 +0530 Subject: [PATCH 3/6] [xExtension-ImageProxy] Exclude nl translations from spell check instead of rewording Restore the original Dutch help text and skip the nl i18n folder in typos, like the other non-English translations. --- .typos.toml | 1 + xExtension-ImageProxy/i18n/nl/ext.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.typos.toml b/.typos.toml index ebf23717..46ce411e 100644 --- a/.typos.toml +++ b/.typos.toml @@ -17,6 +17,7 @@ extend-exclude = [ "*/i18n/az", "*/i18n/de", "*/i18n/fr", + "*/i18n/nl", "*/i18n/pl", "bin/", "node_modules/", diff --git a/xExtension-ImageProxy/i18n/nl/ext.php b/xExtension-ImageProxy/i18n/nl/ext.php index e3bc68d8..926013b6 100644 --- a/xExtension-ImageProxy/i18n/nl/ext.php +++ b/xExtension-ImageProxy/i18n/nl/ext.php @@ -9,6 +9,6 @@ 'scheme_include' => 'http*:// in url opnemen', 'url_encode' => 'Url encoderen', 'excluded_domains' => 'Deze domeinen niet proxyen', - 'excluded_domains_help' => 'Eén domein per regel (of gescheiden door het teken «,»). Hun subdomeinen worden ook niet geproxyd: example.org geldt bijvoorbeeld ook voor images.example.org.', + 'excluded_domains_help' => 'Eén domein per regel (of gescheiden door komma’s). Hun subdomeinen worden ook niet geproxyd: example.org geldt bijvoorbeeld ook voor images.example.org.', ), ); From 923477aefcab22c636c8764b843f42c1d2c56e21 Mon Sep 17 00:00:00 2001 From: NopeCharon <115794254+NopeCharon@users.noreply.github.com> Date: Thu, 12 Nov 2026 00:02:25 +0530 Subject: [PATCH 4/6] [xExtension-ImageProxy] Only split excluded domains on whitespace Domain names cannot contain whitespace, so newlines and spaces are enough to separate entries and commas are not needed. --- tests/ImageProxyTest.php | 2 +- xExtension-ImageProxy/README.md | 2 +- xExtension-ImageProxy/extension.php | 2 +- xExtension-ImageProxy/i18n/de/ext.php | 2 +- xExtension-ImageProxy/i18n/en/ext.php | 2 +- xExtension-ImageProxy/i18n/fr/ext.php | 2 +- xExtension-ImageProxy/i18n/nl/ext.php | 2 +- xExtension-ImageProxy/i18n/tr/ext.php | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/ImageProxyTest.php b/tests/ImageProxyTest.php index 1aae4ac0..7d0ddc6b 100644 --- a/tests/ImageProxyTest.php +++ b/tests/ImageProxyTest.php @@ -213,7 +213,7 @@ private function testUriSchemes(): void { /** @throws FreshRSS_Context_Exception */ private function testExcludedDomains(): void { - $this->configure(excludedDomains: " Intranet.example,\r\n*.cdn.example 192.168.1.10\n.dot.example,[::1],,\n"); + $this->configure(excludedDomains: " Intranet.example\r\n*.cdn.example 192.168.1.10\n.dot.example [::1]\n\n"); $notProxied = [ 'http://intranet.example/a.png' => 'Excluded domains must not be proxied', 'https://INTRANET.example/a.png' => 'Excluded domains must be matched case-insensitively', diff --git a/xExtension-ImageProxy/README.md b/xExtension-ImageProxy/README.md index 8468c889..2a7bbce3 100644 --- a/xExtension-ImageProxy/README.md +++ b/xExtension-ImageProxy/README.md @@ -28,7 +28,7 @@ To use it, upload this entire directory to the FreshRSS `./extensions` directory * `url_encode` (default: `1`): whether to URL-encode (RFC 3986) the proxied URL -* `excluded_domains` (default: empty): domains whose images are never proxied, one per line or separated by commas, e.g. `intranet.example, 192.168.1.10`; +* `excluded_domains` (default: empty): domains whose images are never proxied, one per line, e.g. `intranet.example` and `192.168.1.10`; subdomains are matched too, so `example.org` also covers `images.example.org`. This is useful for images served from internal hosts that the proxy cannot reach, or from domains that the proxy refuses to serve diff --git a/xExtension-ImageProxy/extension.php b/xExtension-ImageProxy/extension.php index cd633e7c..de44b473 100644 --- a/xExtension-ImageProxy/extension.php +++ b/xExtension-ImageProxy/extension.php @@ -86,7 +86,7 @@ private static function isExcludedHost(string $host): bool { return false; } $excludedDomains = strtolower(FreshRSS_Context::userConf()->attributeString('image_proxy_excluded_domains') ?? ''); - $domains = preg_split('/[\s,]+/', $excludedDomains, flags: PREG_SPLIT_NO_EMPTY) ?: []; + $domains = preg_split('/\s+/', $excludedDomains, flags: PREG_SPLIT_NO_EMPTY) ?: []; foreach ($domains as $domain) { $domain = trim($domain, '*[].'); // Accept `*.example.org`, `.example.org`, and `[::1]` if ($domain !== '' && ($host === $domain || str_ends_with($host, '.' . $domain))) { diff --git a/xExtension-ImageProxy/i18n/de/ext.php b/xExtension-ImageProxy/i18n/de/ext.php index 47c117b9..b5929869 100644 --- a/xExtension-ImageProxy/i18n/de/ext.php +++ b/xExtension-ImageProxy/i18n/de/ext.php @@ -9,6 +9,6 @@ 'scheme_include' => 'http*:// in die URL einfügen', 'url_encode' => 'URL-Prozentkodierung', 'excluded_domains' => 'Diese Domains nicht über den Proxy laden', - 'excluded_domains_help' => 'Eine Domain pro Zeile (oder durch Kommas getrennt). Ihre Subdomains werden ebenfalls nicht über den Proxy geladen: example.org gilt zum Beispiel auch für images.example.org.', + 'excluded_domains_help' => 'Eine Domain pro Zeile. Ihre Subdomains werden ebenfalls nicht über den Proxy geladen: example.org gilt zum Beispiel auch für images.example.org.', ), ); diff --git a/xExtension-ImageProxy/i18n/en/ext.php b/xExtension-ImageProxy/i18n/en/ext.php index a7f1d872..d96f98c0 100644 --- a/xExtension-ImageProxy/i18n/en/ext.php +++ b/xExtension-ImageProxy/i18n/en/ext.php @@ -9,6 +9,6 @@ 'scheme_include' => 'Include http*:// in URL', 'url_encode' => 'Encode the URL', 'excluded_domains' => 'Do not proxy these domains', - 'excluded_domains_help' => 'One domain per line (or separated by commas). Their subdomains are not proxied either: for instance, example.org also matches images.example.org.', + 'excluded_domains_help' => 'One domain per line. Their subdomains are not proxied either: for instance, example.org also matches images.example.org.', ), ); diff --git a/xExtension-ImageProxy/i18n/fr/ext.php b/xExtension-ImageProxy/i18n/fr/ext.php index 7ec3c988..288c962d 100644 --- a/xExtension-ImageProxy/i18n/fr/ext.php +++ b/xExtension-ImageProxy/i18n/fr/ext.php @@ -9,6 +9,6 @@ 'scheme_include' => 'Inclure http*:// dans l\'URL', 'url_encode' => 'Encoder l\'URL', 'excluded_domains' => 'Ne pas utiliser le proxy pour ces domaines', - 'excluded_domains_help' => 'Un domaine par ligne (ou séparés par des virgules). Leurs sous-domaines ne passent pas non plus par le proxy : par exemple, example.org correspond aussi à images.example.org.', + 'excluded_domains_help' => 'Un domaine par ligne. Leurs sous-domaines ne passent pas non plus par le proxy : par exemple, example.org correspond aussi à images.example.org.', ), ); diff --git a/xExtension-ImageProxy/i18n/nl/ext.php b/xExtension-ImageProxy/i18n/nl/ext.php index 926013b6..3696dc4f 100644 --- a/xExtension-ImageProxy/i18n/nl/ext.php +++ b/xExtension-ImageProxy/i18n/nl/ext.php @@ -9,6 +9,6 @@ 'scheme_include' => 'http*:// in url opnemen', 'url_encode' => 'Url encoderen', 'excluded_domains' => 'Deze domeinen niet proxyen', - 'excluded_domains_help' => 'Eén domein per regel (of gescheiden door komma’s). Hun subdomeinen worden ook niet geproxyd: example.org geldt bijvoorbeeld ook voor images.example.org.', + 'excluded_domains_help' => 'Eén domein per regel. Hun subdomeinen worden ook niet geproxyd: example.org geldt bijvoorbeeld ook voor images.example.org.', ), ); diff --git a/xExtension-ImageProxy/i18n/tr/ext.php b/xExtension-ImageProxy/i18n/tr/ext.php index 81c25653..628f0dee 100644 --- a/xExtension-ImageProxy/i18n/tr/ext.php +++ b/xExtension-ImageProxy/i18n/tr/ext.php @@ -9,6 +9,6 @@ 'scheme_include' => 'Bağlantıya http*:// ekle', 'url_encode' => 'Bağlantıyı kodla', 'excluded_domains' => 'Do not proxy these domains', // TODO - 'excluded_domains_help' => 'One domain per line (or separated by commas). Their subdomains are not proxied either: for instance, example.org also matches images.example.org.', // TODO + 'excluded_domains_help' => 'One domain per line. Their subdomains are not proxied either: for instance, example.org also matches images.example.org.', // TODO ), ); From 67ed4b1d6d7305cdd60d3978337b6515a70ef090 Mon Sep 17 00:00:00 2001 From: NopeCharon <115794254+NopeCharon@users.noreply.github.com> Date: Thu, 12 Nov 2026 11:36:51 +0530 Subject: [PATCH 5/6] [xExtension-ImageProxy] Only strip wildcards from the left of excluded domains --- tests/ImageProxyTest.php | 3 ++- xExtension-ImageProxy/extension.php | 2 +- xExtension-ImageProxy/i18n/en/ext.php | 2 +- xExtension-ImageProxy/i18n/tr/ext.php | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/ImageProxyTest.php b/tests/ImageProxyTest.php index 7d0ddc6b..ad07f6fa 100644 --- a/tests/ImageProxyTest.php +++ b/tests/ImageProxyTest.php @@ -213,7 +213,7 @@ private function testUriSchemes(): void { /** @throws FreshRSS_Context_Exception */ private function testExcludedDomains(): void { - $this->configure(excludedDomains: " Intranet.example\r\n*.cdn.example 192.168.1.10\n.dot.example [::1]\n\n"); + $this->configure(excludedDomains: " Intranet.example\r\n*.cdn.example 192.168.1.10\n.dot.example [::1] star.example.*\n\n"); $notProxied = [ 'http://intranet.example/a.png' => 'Excluded domains must not be proxied', 'https://INTRANET.example/a.png' => 'Excluded domains must be matched case-insensitively', @@ -233,6 +233,7 @@ private function testExcludedDomains(): void { 'http://example/a.png' => 'Parent domains of excluded domains must be proxied', 'http://myintranet.example/a.png' => 'Domains merely ending with an excluded domain must be proxied', 'http://intranet.example.org/a.png' => 'Domains merely starting with an excluded domain must be proxied', + 'http://star.example/a.png' => 'A trailing wildcard is not supported and must not match', 'http://192.168.1.100/a.png' => 'Other IP addresses must be proxied', 'http://images.example/intranet.example.png' => 'Only the host must be compared to excluded domains', ]; diff --git a/xExtension-ImageProxy/extension.php b/xExtension-ImageProxy/extension.php index de44b473..d7d97fa6 100644 --- a/xExtension-ImageProxy/extension.php +++ b/xExtension-ImageProxy/extension.php @@ -88,7 +88,7 @@ private static function isExcludedHost(string $host): bool { $excludedDomains = strtolower(FreshRSS_Context::userConf()->attributeString('image_proxy_excluded_domains') ?? ''); $domains = preg_split('/\s+/', $excludedDomains, flags: PREG_SPLIT_NO_EMPTY) ?: []; foreach ($domains as $domain) { - $domain = trim($domain, '*[].'); // Accept `*.example.org`, `.example.org`, and `[::1]` + $domain = ltrim(trim($domain, '[]'), '*.'); // Accept `*.example.org`, `.example.org`, and `[::1]` if ($domain !== '' && ($host === $domain || str_ends_with($host, '.' . $domain))) { return true; } diff --git a/xExtension-ImageProxy/i18n/en/ext.php b/xExtension-ImageProxy/i18n/en/ext.php index d96f98c0..a2c6f322 100644 --- a/xExtension-ImageProxy/i18n/en/ext.php +++ b/xExtension-ImageProxy/i18n/en/ext.php @@ -9,6 +9,6 @@ 'scheme_include' => 'Include http*:// in URL', 'url_encode' => 'Encode the URL', 'excluded_domains' => 'Do not proxy these domains', - 'excluded_domains_help' => 'One domain per line. Their subdomains are not proxied either: for instance, example.org also matches images.example.org.', + 'excluded_domains_help' => 'One domain per line. Subdomains are included as well: for instance, example.org also matches images.example.org.', ), ); diff --git a/xExtension-ImageProxy/i18n/tr/ext.php b/xExtension-ImageProxy/i18n/tr/ext.php index 628f0dee..16cc015f 100644 --- a/xExtension-ImageProxy/i18n/tr/ext.php +++ b/xExtension-ImageProxy/i18n/tr/ext.php @@ -9,6 +9,6 @@ 'scheme_include' => 'Bağlantıya http*:// ekle', 'url_encode' => 'Bağlantıyı kodla', 'excluded_domains' => 'Do not proxy these domains', // TODO - 'excluded_domains_help' => 'One domain per line. Their subdomains are not proxied either: for instance, example.org also matches images.example.org.', // TODO + 'excluded_domains_help' => 'One domain per line. Subdomains are included as well: for instance, example.org also matches images.example.org.', // TODO ), ); From 1de0780e0450ac555ec77c6b0363fed1e8ff8a4d Mon Sep 17 00:00:00 2001 From: NopeCharon <115794254+NopeCharon@users.noreply.github.com> Date: Thu, 12 Nov 2026 14:08:21 +0530 Subject: [PATCH 6/6] [xExtension-ImageProxy] Align excluded domains help translations with English wording --- xExtension-ImageProxy/i18n/de/ext.php | 2 +- xExtension-ImageProxy/i18n/fr/ext.php | 2 +- xExtension-ImageProxy/i18n/nl/ext.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/xExtension-ImageProxy/i18n/de/ext.php b/xExtension-ImageProxy/i18n/de/ext.php index b5929869..b1363978 100644 --- a/xExtension-ImageProxy/i18n/de/ext.php +++ b/xExtension-ImageProxy/i18n/de/ext.php @@ -9,6 +9,6 @@ 'scheme_include' => 'http*:// in die URL einfügen', 'url_encode' => 'URL-Prozentkodierung', 'excluded_domains' => 'Diese Domains nicht über den Proxy laden', - 'excluded_domains_help' => 'Eine Domain pro Zeile. Ihre Subdomains werden ebenfalls nicht über den Proxy geladen: example.org gilt zum Beispiel auch für images.example.org.', + 'excluded_domains_help' => 'Eine Domain pro Zeile. Subdomains sind ebenfalls eingeschlossen: example.org gilt zum Beispiel auch für images.example.org.', ), ); diff --git a/xExtension-ImageProxy/i18n/fr/ext.php b/xExtension-ImageProxy/i18n/fr/ext.php index 288c962d..a7ef066c 100644 --- a/xExtension-ImageProxy/i18n/fr/ext.php +++ b/xExtension-ImageProxy/i18n/fr/ext.php @@ -9,6 +9,6 @@ 'scheme_include' => 'Inclure http*:// dans l\'URL', 'url_encode' => 'Encoder l\'URL', 'excluded_domains' => 'Ne pas utiliser le proxy pour ces domaines', - 'excluded_domains_help' => 'Un domaine par ligne. Leurs sous-domaines ne passent pas non plus par le proxy : par exemple, example.org correspond aussi à images.example.org.', + 'excluded_domains_help' => 'Un domaine par ligne. Les sous-domaines sont également inclus : par exemple, example.org correspond aussi à images.example.org.', ), ); diff --git a/xExtension-ImageProxy/i18n/nl/ext.php b/xExtension-ImageProxy/i18n/nl/ext.php index 3696dc4f..7f4d5622 100644 --- a/xExtension-ImageProxy/i18n/nl/ext.php +++ b/xExtension-ImageProxy/i18n/nl/ext.php @@ -9,6 +9,6 @@ 'scheme_include' => 'http*:// in url opnemen', 'url_encode' => 'Url encoderen', 'excluded_domains' => 'Deze domeinen niet proxyen', - 'excluded_domains_help' => 'Eén domein per regel. Hun subdomeinen worden ook niet geproxyd: example.org geldt bijvoorbeeld ook voor images.example.org.', + 'excluded_domains_help' => 'Eén domein per regel. Subdomeinen zijn ook inbegrepen: example.org geldt bijvoorbeeld ook voor images.example.org.', ), );