mirror of https://github.com/CIRCL/lookyloo
Merge pull request #929 from jeroengui/removecapturewithapi
add new endpoint to remove capturepull/937/head
commit
736b8717cf
|
@ -786,6 +786,21 @@ class CaptureHide(Resource): # type: ignore[misc]
|
||||||
return {'info': f'Capture {capture_uuid} successfully hidden.'}
|
return {'info': f'Capture {capture_uuid} successfully hidden.'}
|
||||||
|
|
||||||
|
|
||||||
|
@api.route('/admin/<string:capture_uuid>/remove')
|
||||||
|
@api.doc(description='Remove the capture from the index.',
|
||||||
|
params={'capture_uuid': 'The UUID of the capture'},
|
||||||
|
security='apikey')
|
||||||
|
class CaptureRemove(Resource): # type: ignore[misc]
|
||||||
|
method_decorators = [api_auth_check]
|
||||||
|
|
||||||
|
def post(self, capture_uuid: str) -> dict[str, str] | tuple[dict[str, str], int]:
|
||||||
|
try:
|
||||||
|
lookyloo.remove_capture(capture_uuid)
|
||||||
|
except Exception as e:
|
||||||
|
return {'error': f'Unable to remove the tree: {e}'}, 400
|
||||||
|
return {'info': f'Capture {capture_uuid} successfully removed.'}
|
||||||
|
|
||||||
|
|
||||||
@api.route('/json/recent_captures')
|
@api.route('/json/recent_captures')
|
||||||
@api.route('/json/recent_captures/<string:timestamp>')
|
@api.route('/json/recent_captures/<string:timestamp>')
|
||||||
@api.doc(description='Get uuids of the most recent captures.',
|
@api.doc(description='Get uuids of the most recent captures.',
|
||||||
|
|
Loading…
Reference in New Issue