kopia lustrzana https://github.com/dgtlmoon/changedetection.io
New [scrub] button when editing a watch - scrub single watch history (#672)
rodzic
1ab70f8e86
commit
cdcf4b353f
|
@ -458,6 +458,19 @@ def changedetection_app(config=None, datastore_o=None):
|
||||||
|
|
||||||
return 'OK'
|
return 'OK'
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/scrub/<string:uuid>", methods=['GET'])
|
||||||
|
@login_required
|
||||||
|
def scrub_watch(uuid):
|
||||||
|
try:
|
||||||
|
datastore.scrub_watch(uuid)
|
||||||
|
except KeyError:
|
||||||
|
flash('Watch not found', 'error')
|
||||||
|
else:
|
||||||
|
flash("Scrubbed watch {}".format(uuid))
|
||||||
|
|
||||||
|
return redirect(url_for('index'))
|
||||||
|
|
||||||
@app.route("/scrub", methods=['GET', 'POST'])
|
@app.route("/scrub", methods=['GET', 'POST'])
|
||||||
@login_required
|
@login_required
|
||||||
def scrub_page():
|
def scrub_page():
|
||||||
|
|
|
@ -254,12 +254,23 @@ class ChangeDetectionStore:
|
||||||
def scrub_watch(self, uuid):
|
def scrub_watch(self, uuid):
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
self.__data['watching'][uuid].update({'history': {}, 'last_checked': 0, 'last_changed': 0, 'previous_md5': False})
|
self.__data['watching'][uuid].update(
|
||||||
self.needs_write_urgent = True
|
{'last_checked': 0,
|
||||||
|
'last_changed': 0,
|
||||||
|
'last_viewed': 0,
|
||||||
|
'previous_md5': False,
|
||||||
|
'last_notification_error': False,
|
||||||
|
'last_error': False})
|
||||||
|
|
||||||
for item in pathlib.Path(self.datastore_path).rglob(uuid+"/*.txt"):
|
# JSON Data, Screenshots, Textfiles (history index and snapshots), HTML in the future etc
|
||||||
|
for item in pathlib.Path(os.path.join(self.datastore_path, uuid)).rglob("*.*"):
|
||||||
unlink(item)
|
unlink(item)
|
||||||
|
|
||||||
|
# Force the attr to recalculate
|
||||||
|
bump = self.__data['watching'][uuid].history
|
||||||
|
|
||||||
|
self.needs_write_urgent = True
|
||||||
|
|
||||||
def add_watch(self, url, tag="", extras=None, write_to_disk_now=True):
|
def add_watch(self, url, tag="", extras=None, write_to_disk_now=True):
|
||||||
|
|
||||||
if extras is None:
|
if extras is None:
|
||||||
|
|
|
@ -259,6 +259,8 @@ nav
|
||||||
|
|
||||||
<a href="{{url_for('form_delete', uuid=uuid)}}"
|
<a href="{{url_for('form_delete', uuid=uuid)}}"
|
||||||
class="pure-button button-small button-error ">Delete</a>
|
class="pure-button button-small button-error ">Delete</a>
|
||||||
|
<a href="{{url_for('scrub_watch', uuid=uuid)}}"
|
||||||
|
class="pure-button button-small button-error ">Scrub</a>
|
||||||
<a href="{{url_for('form_clone', uuid=uuid)}}"
|
<a href="{{url_for('form_clone', uuid=uuid)}}"
|
||||||
class="pure-button button-small ">Create Copy</a>
|
class="pure-button button-small ">Create Copy</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
Ładowanie…
Reference in New Issue