From 4087fe13a8717026b44cf8b8d97a43e73648f4c2 Mon Sep 17 00:00:00 2001 From: ClaraCrazy Date: Sat, 28 Sep 2024 01:49:06 +0200 Subject: [PATCH] design changes --- infrastructure/web/routes/inbox.js | 40 ++++++++++++++++++++++++++++-- infrastructure/web/views/mail.twig | 13 +++++----- 2 files changed, 45 insertions(+), 8 deletions(-) diff --git a/infrastructure/web/routes/inbox.js b/infrastructure/web/routes/inbox.js index 1e02b73..0c1eb19 100644 --- a/infrastructure/web/routes/inbox.js +++ b/infrastructure/web/routes/inbox.js @@ -36,7 +36,7 @@ router.get( // Emails are immutable, cache if found res.set('Cache-Control', 'private, max-age=600') res.render('mail', { - title: req.params.address, + title: mail.subject + " | " + req.params.address, address: req.params.address, mail, uid: req.params.uid, @@ -62,7 +62,7 @@ router.get( ) router.get( - '^/:address/:uid([0-9]+$)/delete', + '^/:address/:uid/delete', sanitizeAddress, async (req, res, next) => { try { @@ -76,4 +76,40 @@ router.get( } ) +router.get( + '^/:address/:uid/raw', + sanitizeAddress, + async (req, res, next) => { + try { + const mailProcessingService = req.app.get('mailProcessingService') + const mail = await mailProcessingService.getOneFullMail( + req.params.address, + req.params.uid + ) + if (mail && mail != "womp womp") { + // Emails are immutable, cache if found + res.set('Cache-Control', 'private, max-age=600') + res.render('raw', { + title: mail.subject + " | raw | " + req.params.address, + mail + }) + } else { + res.render( + 'error', + { + address: req.params.address, + message: 'This mail could not be found. It either does not exist or has been deleted from our servers!', + madeby: config.http.branding[1], + madebysite: config.http.branding[2], + } + ) + } + } catch (error) { + console.error('error while fetching one email', error) + next(error) + } + } +) + + module.exports = router diff --git a/infrastructure/web/views/mail.twig b/infrastructure/web/views/mail.twig index 37dfc86..09604bf 100644 --- a/infrastructure/web/views/mail.twig +++ b/infrastructure/web/views/mail.twig @@ -13,8 +13,13 @@ Logout
-
-

{{ mail.subject }}

+
+

+ {{ mail.subject }} + + From: {{ mail.from.text }} at {{ mail.date| date }} + +

{% if mail.html %}
@@ -48,8 +53,4 @@
{% endif %} - -

{{ mail.from.text }} | {{ mail.date| date }}

- - {% endblock %}