mirror of https://github.com/CIRCL/lookyloo
fix: Typing, make mypy happy
parent
78c0089413
commit
0eaea85204
|
@ -761,7 +761,7 @@ class Lookyloo():
|
|||
result.append(self.takedown_details(rendered_hostnode))
|
||||
return result
|
||||
|
||||
def send_mail(self, capture_uuid: str, /, email: str='', comment: str | None=None) -> True | dict[str, Any]:
|
||||
def send_mail(self, capture_uuid: str, /, email: str='', comment: str | None=None) -> bool | dict[str, Any]:
|
||||
'''Send an email notification regarding a specific capture'''
|
||||
if not get_config('generic', 'enable_mail_notification'):
|
||||
return {"error": "Unable to send mail: mail notification disabled"}
|
||||
|
|
|
@ -380,16 +380,17 @@ class CaptureCookies(Resource): # type: ignore[misc]
|
|||
def get(self, capture_uuid: str) -> dict[str, Any]:
|
||||
return json.loads(lookyloo.get_cookies(capture_uuid).read())
|
||||
|
||||
|
||||
@api.route('/json/<string:capture_uuid>/report')
|
||||
@api.doc(description='Reports the url by sending an email to the investigation team',
|
||||
params={'capture_uuid': 'The UUID of the capture'})
|
||||
class CaptureReport(Resource): # type: ignore[misc]
|
||||
@api.param('email', 'Email of the reporter, used by the analyst to get in touch.') # type: ignore[misc]
|
||||
@api.param('comment', 'Description of the URL, will be given to the analyst.') # type: ignore[misc]
|
||||
def post(self, capture_uuid) -> True | dict[str, Any]:
|
||||
def post(self, capture_uuid: str) -> bool | dict[str, Any]:
|
||||
parameters: dict[str, Any] = request.get_json(force=True)
|
||||
return lookyloo.send_mail(capture_uuid, parameters.get('email'), parameters.get('comment'))
|
||||
# Just text
|
||||
return lookyloo.send_mail(capture_uuid, parameters.get('email', ''), parameters.get('comment'))
|
||||
|
||||
|
||||
auto_report_model = api.model('AutoReportModel', {
|
||||
'email': fields.String(description="Email of the reporter, used by the analyst to get in touch.", example=''),
|
||||
|
|
Loading…
Reference in New Issue