From 2488cb9347e305f86466ffce11c24ae5b45dd86d Mon Sep 17 00:00:00 2001 From: NopeCharon <115794254+NopeCharon@users.noreply.github.com> Date: Tue, 27 Oct 2026 09:55:00 +0530 Subject: [PATCH] [Webhook] Keep the HTML of the {content} placeholder intact The `{content}` placeholder is documented as the article content in HTML format, but it was passed through `htmlspecialchars_decode()` like the plain-text placeholders. `FreshRSS_Entry::content()` already returns HTML, so decoding it turned escaped text into markup: an article about the `<b>` tag produced an unclosed `` element, escaped code samples such as `<script>` became live tags, `&` became a bare `&`, and `"` could end a double-quoted attribute early. Insert the content as is. The plain-text placeholders (`{title}`, `{author}`, `{url}`, ...) are still decoded, which is correct for them. Also fix the README, which documented `{date}`, `{date_timestamp}` and `{thumbnail_url}` placeholders that have never existed in the extension and are sent literally. Document `{date_published}`, `{date_received}`, `{date_modified}` and `{date_user_modified}` instead, like the configuration page does, and use them in the examples. Bump the extension version to 0.2.6. Fixes #560 --- xExtension-Webhook/README.md | 12 ++++++------ xExtension-Webhook/extension.php | 2 +- xExtension-Webhook/metadata.json | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/xExtension-Webhook/README.md b/xExtension-Webhook/README.md index 26113dca..a4f55743 100644 --- a/xExtension-Webhook/README.md +++ b/xExtension-Webhook/README.md @@ -63,8 +63,7 @@ Customize the webhook payload using placeholders: "feed": "{feed_name}", "url": "{url}", "content": "{content}", - "date": "{date}", - "timestamp": "{date_timestamp}", + "published": "{date_published}", "author": "{author}", "tags": "{tags}", "user": "{user}" @@ -78,12 +77,13 @@ Customize the webhook payload using placeholders: | `{title}` | Article title | | `{url}` | Article URL | | `{content}` | Article content (HTML) | -| `{date}` | Publication date (string) | -| `{date_timestamp}` | Publication date as Unix timestamp | +| `{date_published}` | Publication date (ISO 8601) | +| `{date_received}` | Date received by FreshRSS (ISO 8601) | +| `{date_modified}` | Last modified date (ISO 8601, `null` if never modified) | +| `{date_user_modified}` | Last user-modified date (ISO 8601, `null` if never modified) | | `{author}` | Article authors | | `{feed_name}` | Feed name | | `{feed_url}` | Feed URL | -| `{thumbnail_url}` | Thumbnail (image) URL | | `{tags}` | Article tags (separated by " #") | | `{user}` | Username in FreshRSS | @@ -129,7 +129,7 @@ Customize the webhook payload using placeholders: "title": "{title}", "url": "{url}", "feed": "{feed_name}", - "timestamp": "{date_timestamp}" + "published": "{date_published}" } } ``` diff --git a/xExtension-Webhook/extension.php b/xExtension-Webhook/extension.php index e21b5f8f..98b7ab9d 100644 --- a/xExtension-Webhook/extension.php +++ b/xExtension-Webhook/extension.php @@ -220,7 +220,7 @@ private function sendArticle(FreshRSS_Entry $entry): void { '{feed_name}' => htmlspecialchars_decode($entry->feed()?->name() ?? '', ENT_QUOTES), '{feed_url}' => htmlspecialchars_decode($entry->feed()?->url() ?? '', ENT_QUOTES), '{url}' => htmlspecialchars_decode($entry->link(), ENT_QUOTES), - '{content}' => htmlspecialchars_decode($entry->content(), ENT_QUOTES), + '{content}' => $entry->content(), '{date_published}' => timestampToMachineDate($entry->date(raw: true)), '{date_received}' => timestampToMachineDate($entry->dateAdded(raw: true)), '{date_modified}' => $entry->lastModified() === null ? null : timestampToMachineDate($entry->lastModified()), diff --git a/xExtension-Webhook/metadata.json b/xExtension-Webhook/metadata.json index 530bbb9b..7ab87a86 100644 --- a/xExtension-Webhook/metadata.json +++ b/xExtension-Webhook/metadata.json @@ -2,7 +2,7 @@ "name": "Webhook", "author": "Lukas Melega, Ryahn", "description": "Send custom webhook when new article appears (and matches custom criteria)", - "version": "0.2.5", + "version": "0.2.6", "entrypoint": "Webhook", "type": "user", "compatibility": "1.28.2"