From 1d92d9461a2f83286847ce31d28ca64ec38ab88c Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Sat, 26 Mar 2022 15:35:56 +0100 Subject: [PATCH] WIP --- changedetectionio/__init__.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/changedetectionio/__init__.py b/changedetectionio/__init__.py index 02353778..6412ebf0 100644 --- a/changedetectionio/__init__.py +++ b/changedetectionio/__init__.py @@ -272,7 +272,7 @@ def changedetection_app(config=None, datastore_o=None): @app.route("/rss", methods=['GET']) @login_required def rss(): - + from . import diff limit_tag = request.args.get('tag') # Sort by last_changed and add the uuid which is usually the key.. @@ -301,6 +301,15 @@ def changedetection_app(config=None, datastore_o=None): fg.link(href='https://changedetection.io') for watch in sorted_watches: + + dates = list(watch['history'].keys()) + # Convert to int, sort and back to str again + # @todo replace datastore getter that does this automatically + dates = [int(i) for i in dates] + dates.sort(reverse=True) + dates = [str(i) for i in dates] + prev_fname = watch['history'][dates[1]] + if not watch['viewed']: # Re #239 - GUID needs to be individual for each event # @todo In the future make this a configurable link back (see work on BASE_URL https://github.com/dgtlmoon/changedetection.io/pull/228) @@ -316,12 +325,16 @@ def changedetection_app(config=None, datastore_o=None): diff_link = {'href': "{}{}".format(base_url, url_for('diff_history_page', uuid=watch['uuid']))} - # @todo use title if it exists fe.link(link=diff_link) - fe.title(title=watch['url']) - # @todo in the future Any code html is valid.]]> - fe.description(description=watch['url']) + # @todo watch should be a getter - watch.get('title') (internally if URL else..) + + watch_title = watch.get('title') if watch.get('title') else watch.get('url') + fe.title(title=watch_title) + latest_fname = watch['history'][dates[0]] + + html_diff = diff.render_diff(prev_fname, latest_fname, include_equal=False, line_feed_sep="
") + fe.description(description="

{}

{}".format(watch_title, html_diff)) fe.guid(guid, permalink=False) dt = datetime.datetime.fromtimestamp(int(watch['newest_history_key']))