diff --git a/backend/backend.py b/backend/backend.py index 248c58b7..fb4d1db5 100644 --- a/backend/backend.py +++ b/backend/backend.py @@ -117,6 +117,35 @@ def main_page(): messages = [] return output +@app.route("/scrub", methods=['GET', 'POST']) +def scrub_page(): + from pathlib import Path + + global messages + + if request.method == 'POST': + confirmtext = request.form.get('confirmtext') + + if confirmtext == 'scrub': + + for txt_file_path in Path('/datastore').rglob('*.txt'): + os.unlink(txt_file_path) + + for uuid, watch in datastore.data['watching'].items(): + watch['last_checked'] = 0 + watch['last_changed'] = 0 + watch['previous_md5'] = None + watch['history'] = {} + + datastore.needs_write = True + messages.append({'class': 'ok', 'message': 'Cleaned all version history.'}) + else: + messages.append({'class': 'error', 'message': 'Wrong confirm text.'}) + + return redirect(url_for('main_page')) + + return render_template("scrub.html") + @app.route("/edit", methods=['GET', 'POST']) def edit_page(): diff --git a/backend/templates/scrub.html b/backend/templates/scrub.html new file mode 100644 index 00000000..12a140ba --- /dev/null +++ b/backend/templates/scrub.html @@ -0,0 +1,43 @@ +{% extends 'base.html' %} + +{% block content %} +
+ + +
+
+
+ This will remove all version snapshots/data, but keep your list of URLs.
+ You may like to use the BACKUP link first.
+ + Type in the word scrub to confirm that you understand! +
+ +
+ +
+
+
+ +
+ + +
+ + +
+ +
+
+
+ Cancel +
+ + +
+
+ + +
+ +{% endblock %} diff --git a/backend/templates/settings.html b/backend/templates/settings.html index c6b2e665..8e1e6967 100644 --- a/backend/templates/settings.html +++ b/backend/templates/settings.html @@ -14,13 +14,15 @@ +

- Cancel + Back + Reset all version data