diff --git a/application/mail-processing-service.js b/application/mail-processing-service.js index 96c4977..6aa41ad 100644 --- a/application/mail-processing-service.js +++ b/application/mail-processing-service.js @@ -50,6 +50,10 @@ class MailProcessingService extends EventEmitter { return this.mailRepository.getAll() } + getCount() { + return this.mailRepository.mailCount() + } + onInitialLoadDone() { this.initialLoadDone = true console.log(`Initial load done, got ${this.mailRepository.mailCount()} mails`) diff --git a/infrastructure/web/public/stylesheets/custom.css b/infrastructure/web/public/stylesheets/custom.css index 7483505..ff040e9 100644 --- a/infrastructure/web/public/stylesheets/custom.css +++ b/infrastructure/web/public/stylesheets/custom.css @@ -6,7 +6,6 @@ body { min-height: 100vh; background-color: #131516; color: #cccccc; - } body::-webkit-scrollbar { @@ -14,18 +13,20 @@ body::-webkit-scrollbar { } main { - flex: 1; /* keep footer at the bottom */ + flex: 1; + /* keep footer at the bottom */ } + a { color: #cccccc; } h1 { - font-size: 3rem; + font-size: 3rem; } h3 { - font-size: 2rem; + font-size: 2rem; } a.no-link-color { @@ -60,23 +61,36 @@ text-muted { text-align: center } +.footer-two { + margin-top: -2rem +} + + /* Reset apple form styles */ -input, textarea, select, select:active, select:focus, select:hover { + +input, +textarea, +select, +select:active, +select:focus, +select:hover { -webkit-appearance: none; -moz-appearance: none; - appearance: none; border-radius: 0; + appearance: none; + border-radius: 0; background-image: none; } #login { - padding-top: 15vh; + padding-top: 15vh; display: flex; flex-direction: column; max-width: 600px; margin: auto; } -#login h1, #login h4 { +#login h1, +#login h4 { text-align: center; } @@ -97,7 +111,8 @@ input, textarea, select, select:active, select:focus, select:hover { z-index: 999; } -#login input[type="text"], #login select { +#login input[type="text"], +#login select { border-radius: 0.4rem; color: #cccccc; font-size: 1.6rem; @@ -130,7 +145,7 @@ input, textarea, select, select:active, select:focus, select:hover { flex-wrap: wrap; } -#login .buttons > * { +#login .buttons>* { width: 100%; flex: 1; font-size: 1.3rem; @@ -138,9 +153,9 @@ input, textarea, select, select:active, select:focus, select:hover { .mail_attachments { width: 80%; - padding-left:10% + padding-left: 10% } label { display: inline; -} +} \ No newline at end of file diff --git a/infrastructure/web/routes/inbox.js b/infrastructure/web/routes/inbox.js index db399fd..e253ce5 100644 --- a/infrastructure/web/routes/inbox.js +++ b/infrastructure/web/routes/inbox.js @@ -16,12 +16,14 @@ const sanitizeAddress = param('address').customSanitizer( } ) -router.get('^/:address([^@/]+@[^@/]+)', sanitizeAddress, (req, res, _next) => { +router.get('^/:address([^@/]+@[^@/]+)', sanitizeAddress, async(req, res, _next) => { const mailProcessingService = req.app.get('mailProcessingService') + const count = await mailProcessingService.getCount() res.render('inbox', { title: `${config.http.branding[0]} | ` + req.params.address, purgeTime: purgeTime, address: req.params.address, + count: count, mailSummaries: mailProcessingService.getMailSummaries(req.params.address), branding: config.http.branding, }) @@ -33,6 +35,7 @@ router.get( async(req, res, next) => { try { const mailProcessingService = req.app.get('mailProcessingService') + const count = await mailProcessingService.getCount() const mail = await mailProcessingService.getOneFullMail( req.params.address, req.params.uid @@ -49,6 +52,7 @@ router.get( title: mail.subject + " | " + req.params.address, purgeTime: purgeTime, address: req.params.address, + count: count, mail, uid: req.params.uid, branding: config.http.branding, @@ -58,6 +62,7 @@ router.get( 'error', { purgeTime: purgeTime, address: req.params.address, + count: count, message: 'This mail could not be found. It either does not exist or has been deleted from our servers!', branding: config.http.branding @@ -117,6 +122,7 @@ router.get( ) var index = mail.attachments.findIndex(attachment => attachment.checksum === req.params.checksum); const attachment = mail.attachments[index]; + const count = await mailProcessingService.getCount() if (attachment) { try { res.set('Content-Disposition', `attachment; filename=${attachment.filename}`); @@ -132,6 +138,7 @@ router.get( 'error', { purgeTime: purgeTime, address: req.params.address, + count: count, message: 'This attachment could not be found. It either does not exist or has been deleted from our servers!', branding: config.http.branding, } @@ -153,6 +160,7 @@ router.get( async(req, res, next) => { try { const mailProcessingService = req.app.get('mailProcessingService') + const count = await mailProcessingService.getCount() mail = await mailProcessingService.getOneFullMail( req.params.address, req.params.uid, @@ -171,6 +179,7 @@ router.get( 'error', { purgeTime: purgeTime, address: req.params.address, + count: count, message: 'This mail could not be found. It either does not exist or has been deleted from our servers!', branding: config.http.branding, } diff --git a/infrastructure/web/routes/login.js b/infrastructure/web/routes/login.js index 3aa644a..d652aeb 100644 --- a/infrastructure/web/routes/login.js +++ b/infrastructure/web/routes/login.js @@ -9,12 +9,14 @@ const helper = new(Helper) const purgeTime = helper.purgeTimeElemetBuilder() -router.get('/', (req, res, _next) => { +router.get('/', async(req, res, _next) => { + const count = await req.app.get('mailProcessingService').getCount() res.render('login', { title: `${config.http.branding[0]} | Your temporary Inbox`, username: randomWord(), purgeTime: purgeTime, domains: helper.getDomains(), + count: count, branding: config.http.branding, example: config.email.examples.account, }) @@ -38,8 +40,9 @@ router.post( check('username').isLength({ min: 1 }), check('domain').isIn(config.email.domains) ], - (req, res) => { + async(req, res) => { const errors = validationResult(req) + const count = await req.app.get('mailProcessingService').getCount() if (!errors.isEmpty()) { return res.render('login', { userInputError: true, @@ -47,6 +50,7 @@ router.post( purgeTime: purgeTime, username: randomWord(), domains: helper.getDomains(), + count: count, branding: config.http.branding, }) } diff --git a/infrastructure/web/views/layout.twig b/infrastructure/web/views/layout.twig index 79268d4..858eeb0 100644 --- a/infrastructure/web/views/layout.twig +++ b/infrastructure/web/views/layout.twig @@ -28,7 +28,8 @@ {% block footer %} {% endblock %}