From 8bcc277310af17dee055e9621a8077601ec7ada3 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Mon, 21 Jun 2021 19:35:13 +1000 Subject: [PATCH] Re #92 - Re-use existing [preview] function for viewing current (#97) --- backend/__init__.py | 11 ++++++++--- backend/templates/base.html | 6 ++++++ backend/templates/diff.html | 1 + 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/backend/__init__.py b/backend/__init__.py index 3522b45f..ee11f2a4 100644 --- a/backend/__init__.py +++ b/backend/__init__.py @@ -584,6 +584,7 @@ def changedetection_app(config=None, datastore_o=None): previous=previous_version_file_contents, extra_stylesheets=extra_stylesheets, versions=dates[1:], + uuid=uuid, newest_version_timestamp=dates[0], current_previous_version=str(previous_version), current_diff_url=watch['url']) @@ -606,11 +607,15 @@ def changedetection_app(config=None, datastore_o=None): flash("No history found for the specified link, bad link?", "error") return redirect(url_for('index')) - print(watch) - with open(list(watch['history'].values())[-1], 'r') as f: + newest = list(watch['history'].keys())[-1] + with open(watch['history'][newest], 'r') as f: content = f.readlines() - output = render_template("preview.html", content=content, extra_stylesheets=extra_stylesheets) + output = render_template("preview.html", + content=content, + extra_stylesheets=extra_stylesheets, + current_diff_url=watch['url'], + uuid=uuid) return output diff --git a/backend/templates/base.html b/backend/templates/base.html index 3fb7106c..7fd21898 100644 --- a/backend/templates/base.html +++ b/backend/templates/base.html @@ -33,6 +33,7 @@