mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2025-11-14 05:26:09 +00:00
Compare commits
4 Commits
sort-colum
...
ticket-16-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
487967de29 | ||
|
|
304ef746e4 | ||
|
|
b9222e3243 | ||
|
|
1d92d9461a |
@@ -272,7 +272,7 @@ def changedetection_app(config=None, datastore_o=None):
|
|||||||
@app.route("/rss", methods=['GET'])
|
@app.route("/rss", methods=['GET'])
|
||||||
@login_required
|
@login_required
|
||||||
def rss():
|
def rss():
|
||||||
|
from . import diff
|
||||||
limit_tag = request.args.get('tag')
|
limit_tag = request.args.get('tag')
|
||||||
|
|
||||||
# Sort by last_changed and add the uuid which is usually the key..
|
# 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')
|
fg.link(href='https://changedetection.io')
|
||||||
|
|
||||||
for watch in sorted_watches:
|
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']:
|
if not watch['viewed']:
|
||||||
# Re #239 - GUID needs to be individual for each event
|
# 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)
|
# @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']))}
|
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.link(link=diff_link)
|
||||||
fe.title(title=watch['url'])
|
|
||||||
|
|
||||||
# @todo in the future <description><![CDATA[<html><body>Any code html is valid.</body></html>]]></description>
|
# @todo watch should be a getter - watch.get('title') (internally if URL else..)
|
||||||
fe.description(description=watch['url'])
|
|
||||||
|
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="</br>")
|
||||||
|
fe.description(description="<![CDATA[<html><body><h4>{}</h4>{}</body></html>".format(watch_title, html_diff))
|
||||||
|
|
||||||
fe.guid(guid, permalink=False)
|
fe.guid(guid, permalink=False)
|
||||||
dt = datetime.datetime.fromtimestamp(int(watch['newest_history_key']))
|
dt = datetime.datetime.fromtimestamp(int(watch['newest_history_key']))
|
||||||
|
|||||||
@@ -70,6 +70,11 @@ def test_check_basic_change_detection_functionality(client, live_server):
|
|||||||
res = client.get(url_for("rss"))
|
res = client.get(url_for("rss"))
|
||||||
expected_url = url_for('test_endpoint', _external=True)
|
expected_url = url_for('test_endpoint', _external=True)
|
||||||
assert b'<rss' in res.data
|
assert b'<rss' in res.data
|
||||||
|
|
||||||
|
# re #16 should have the diff in here too
|
||||||
|
assert b'(into ) which has this one new line' in res.data
|
||||||
|
assert b'CDATA' in res.data
|
||||||
|
|
||||||
assert expected_url.encode('utf-8') in res.data
|
assert expected_url.encode('utf-8') in res.data
|
||||||
|
|
||||||
# Following the 'diff' link, it should no longer display as 'unviewed' even after we recheck it a few times
|
# Following the 'diff' link, it should no longer display as 'unviewed' even after we recheck it a few times
|
||||||
|
|||||||
Reference in New Issue
Block a user