Merge pull request #929 from jeroengui/removecapturewithapi

add new endpoint to remove capture
main
Raphaël Vinot 2024-07-26 12:21:50 +02:00 committed by GitHub
commit 736b8717cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 0 deletions

View File

@ -784,6 +784,21 @@ class CaptureHide(Resource): # type: ignore[misc]
except Exception as e:
return {'error': f'Unable to hide the tree: {e}'}, 400
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')