mirror of https://github.com/CIRCL/lookyloo
new: trigger to hide a capture from the front page (admin only)
parent
d3fc553ab0
commit
2873773ee7
|
@ -444,6 +444,16 @@ class Lookyloo():
|
|||
self.redis.hmset(str(capture_dir), cache)
|
||||
self.redis.hset('lookup_dirs', uuid, str(capture_dir))
|
||||
|
||||
def hide_capture(self, capture_uuid: str) -> None:
|
||||
"""Add the capture in the hidden pool (not shown on the front page)
|
||||
NOTE: it won't remove the correlations until they are rebuilt.
|
||||
"""
|
||||
capture_dir = self.lookup_capture_dir(capture_uuid)
|
||||
if not capture_dir:
|
||||
raise MissingUUID(f'Unable to find UUID {capture_uuid} in the cache')
|
||||
self.redis.hset(str(capture_dir), 'no_index', 1)
|
||||
(capture_dir / 'no_index').touch()
|
||||
|
||||
@property
|
||||
def capture_uuids(self):
|
||||
return self.redis.hkeys('lookup_dirs')
|
||||
|
|
|
@ -355,6 +355,13 @@ def export(tree_uuid: str):
|
|||
as_attachment=True, attachment_filename='capture.zip')
|
||||
|
||||
|
||||
@app.route('/tree/<string:tree_uuid>/hide', methods=['GET'])
|
||||
@auth.login_required
|
||||
def hide_capture(tree_uuid: str):
|
||||
lookyloo.hide_capture(tree_uuid)
|
||||
return redirect(url_for('tree', tree_uuid=tree_uuid))
|
||||
|
||||
|
||||
@app.route('/redirects/<string:tree_uuid>', methods=['GET'])
|
||||
def redirects(tree_uuid: str):
|
||||
cache = lookyloo.capture_cache(tree_uuid)
|
||||
|
|
Loading…
Reference in New Issue