chg: Add initial URL in email notification

pull/79/head
Raphaël Vinot 2020-05-27 15:39:06 +02:00
parent 5ebb35c161
commit bed6b4e39e
2 changed files with 10 additions and 2 deletions

View File

@ -3,6 +3,8 @@ Dear {recipient},
Please have a look at this capture on lookyloo:
* https://{domain}/tree/{uuid}
Initial URL: {initial_url}
{redirects}
{comment}

View File

@ -257,12 +257,17 @@ class Lookyloo():
return
redirects = ''
initial_url = ''
capture_dir = self.lookup_capture_dir(capture_uuid)
if capture_dir:
cache = self.capture_cache(capture_dir)
if cache:
redirects = "Redirects:\n"
redirects += '\n'.join(cache['redirects'])
initial_url = cache['url']
if 'redirects' in cache and cache['redirects']:
redirects = "Redirects:\n"
redirects += '\n'.join(cache['redirects'])
else:
redirects = "No redirects."
email_config = self.get_config('email')
msg = EmailMessage()
@ -276,6 +281,7 @@ class Lookyloo():
recipient=msg['To'].addresses[0].display_name,
domain=email_config['domain'],
uuid=capture_uuid,
initial_url=initial_url,
redirects=redirects,
comment=comment,
sender=msg['From'].addresses[0].display_name,