kopia lustrzana https://github.com/dgtlmoon/changedetection.io
Re #264 - fixing clone watch operation
rodzic
a8e92e2226
commit
4bbb7d99b6
|
@ -778,9 +778,9 @@ def changedetection_app(config=None, datastore_o=None):
|
|||
@app.route("/api/clone", methods=['GET'])
|
||||
@login_required
|
||||
def api_clone():
|
||||
|
||||
uuid = request.args.get('uuid')
|
||||
datastore.clone(uuid)
|
||||
new_uuid = datastore.clone(uuid)
|
||||
update_q.put(new_uuid)
|
||||
flash('Cloned.')
|
||||
|
||||
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.
|
||||
for uuid, watch in copied_datastore.data['watching'].items():
|
||||
|
||||
# If they supplied an individual entry minutes to threshold.
|
||||
if 'minutes_between_check' in watch and watch['minutes_between_check'] is not None:
|
||||
# Cast to int just incase
|
||||
|
|
|
@ -251,24 +251,10 @@ class ChangeDetectionStore:
|
|||
|
||||
# Clone a watch by UUID
|
||||
def clone(self, uuid):
|
||||
with self.lock:
|
||||
new_uuid = str(uuid_builder.uuid4())
|
||||
_clone = deepcopy(self.data['watching'][uuid])
|
||||
_clone.update({'uuid': 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
|
||||
url = self.data['watching'][uuid]['url']
|
||||
tag = self.data['watching'][uuid]['tag']
|
||||
new_uuid = self.add_watch(url=url, tag=tag)
|
||||
return new_uuid
|
||||
|
||||
def url_exists(self, url):
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue