Re #264 - fixing clone watch operation

pull/272/head
dgtlmoon 3 years ago
parent a8e92e2226
commit 4bbb7d99b6

@ -778,9 +778,9 @@ def changedetection_app(config=None, datastore_o=None):
@app.route("/api/clone", methods=['GET']) @app.route("/api/clone", methods=['GET'])
@login_required @login_required
def api_clone(): def api_clone():
uuid = request.args.get('uuid') uuid = request.args.get('uuid')
datastore.clone(uuid) new_uuid = datastore.clone(uuid)
update_q.put(new_uuid)
flash('Cloned.') flash('Cloned.')
return redirect(url_for('index')) return redirect(url_for('index'))
@ -902,7 +902,6 @@ def ticker_thread_check_time_launch_checks():
# Check for watches outside of the time threshold to put in the thread queue. # Check for watches outside of the time threshold to put in the thread queue.
for uuid, watch in copied_datastore.data['watching'].items(): for uuid, watch in copied_datastore.data['watching'].items():
# If they supplied an individual entry minutes to threshold. # If they supplied an individual entry minutes to threshold.
if 'minutes_between_check' in watch and watch['minutes_between_check'] is not None: if 'minutes_between_check' in watch and watch['minutes_between_check'] is not None:
# Cast to int just incase # Cast to int just incase

@ -251,24 +251,10 @@ class ChangeDetectionStore:
# Clone a watch by UUID # Clone a watch by UUID
def clone(self, uuid): def clone(self, uuid):
with self.lock: url = self.data['watching'][uuid]['url']
new_uuid = str(uuid_builder.uuid4()) tag = self.data['watching'][uuid]['tag']
_clone = deepcopy(self.data['watching'][uuid]) new_uuid = self.add_watch(url=url, tag=tag)
_clone.update({'uuid': new_uuid}) return new_uuid
attributes_to_reset = [
'last_checked',
'last_changed',
'last_viewed',
'newest_history_key',
'previous_md5',
'history'
]
for attribute in attributes_to_reset:
_clone.update({attribute: self.generic_definition[attribute]})
self.data['watching'][new_uuid] = _clone
self.needs_write = True
def url_exists(self, url): def url_exists(self, url):

Loading…
Cancel
Save