mirror of https://github.com/CIRCL/lookyloo
new: Support for notification in monitoring form
parent
a504facf5e
commit
1603c99d5e
|
@ -663,17 +663,19 @@ def monitor(tree_uuid: str):
|
|||
return redirect('https://www.youtube.com/watch?v=iwGFalTRHDA')
|
||||
|
||||
collection: str = request.form['collection'] if request.form.get('collection') else ''
|
||||
notification_email: str = request.form['notification'] if request.form.get('notification') else ''
|
||||
frequency: str = request.form['frequency'] if request.form.get('frequency') else 'daily'
|
||||
expire_at: Optional[float] = datetime.fromisoformat(request.form['expire_at']).timestamp() if request.form.get('expire_at') else None
|
||||
cache = lookyloo.capture_cache(tree_uuid)
|
||||
if cache:
|
||||
monitoring_uuid = lookyloo.monitoring.monitor({'url': cache.url, 'user_agent': cache.user_agent, 'listing': False},
|
||||
frequency=frequency, collection=collection, expire_at=expire_at)
|
||||
frequency=frequency, collection=collection, expire_at=expire_at,
|
||||
notification={'email': notification_email})
|
||||
flash(f"Sent to monitoring ({monitoring_uuid}).", 'success')
|
||||
if collection:
|
||||
flash(f"See monitored captures in the same collection here: {lookyloo.monitoring.root_url}/monitored/{collection}.", 'success')
|
||||
else:
|
||||
flash(f"Comparison available as soon as we have more than one capture: {lookyloo.monitoring.root_url}/changes_tracking/{collection}.", 'success')
|
||||
flash(f"Comparison available as soon as we have more than one capture: {lookyloo.monitoring.root_url}/changes_tracking/{monitoring_uuid}.", 'success')
|
||||
else:
|
||||
flash(f"Unable to send to monitoring, uuid {tree_uuid} not found in cache.", 'error')
|
||||
return redirect(url_for('tree', tree_uuid=tree_uuid))
|
||||
|
|
|
@ -787,6 +787,10 @@
|
|||
<input type="text" class="form-control" name="collection" id="collection" placeholder="Name of the collection">
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for=notification" class="form-label">Get notified when the capture changes (WiP)</label>
|
||||
<input type="email" class="form-control" name="notification" id="notification" placeholder="Email address to receive the notification">
|
||||
</div>
|
||||
<div class="mb-3 form-check">
|
||||
<input class="form-check-input" type="checkbox" name="confirm" onchange="document.getElementById('btn-notification-monitoring').disabled = !this.checked;"></input>
|
||||
<label for="force_push" class="form-check-label">{{ confirm_message }}</label>
|
||||
|
|
Loading…
Reference in New Issue