From 66e2dfcead0b5b427af01dce5a33213410b6dba6 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Mon, 29 Jan 2024 16:26:14 +0100 Subject: [PATCH] RSS - Include link to the watched URL in the feed (#2139 #2131 and #327) --- changedetectionio/flask_app.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/changedetectionio/flask_app.py b/changedetectionio/flask_app.py index e0ee8b83..058651dd 100644 --- a/changedetectionio/flask_app.py +++ b/changedetectionio/flask_app.py @@ -13,7 +13,6 @@ from threading import Event import datetime import flask_login from loguru import logger -import sys import os import pytz import queue @@ -317,6 +316,8 @@ def changedetection_app(config=None, datastore_o=None): @app.route("/rss", methods=['GET']) def rss(): + from jinja2 import Environment, BaseLoader + jinja2_env = Environment(loader=BaseLoader) now = time.time() # Always requires token set app_rss_token = datastore.data['settings']['application'].get('rss_access_token') @@ -381,8 +382,12 @@ def changedetection_app(config=None, datastore_o=None): include_equal=False, line_feed_sep="
") - fe.content(content="

{}

{}".format(watch_title, html_diff), - type='CDATA') + # @todo Make this configurable and also consider html-colored markup + # @todo User could decide if goes to the diff page, or to the watch link + rss_template = "\n

{{watch_title}}

\n

{{html_diff}}

\n\n" + content = jinja2_env.from_string(rss_template).render(watch_title=watch_title, html_diff=html_diff, watch_url=watch.link) + + fe.content(content=content, type='CDATA') fe.guid(guid, permalink=False) dt = datetime.datetime.fromtimestamp(int(watch.newest_history_key))