mirror of
https://github.com/Crazyco-xyz/48hr.email.git
synced 2025-12-14 13:56:32 +01:00
get mailcount on footer
This commit is contained in:
parent
31e7594b2f
commit
21a6e760e5
5 changed files with 49 additions and 16 deletions
|
|
@ -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`)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ body {
|
|||
min-height: 100vh;
|
||||
background-color: #131516;
|
||||
color: #cccccc;
|
||||
|
||||
}
|
||||
|
||||
body::-webkit-scrollbar {
|
||||
|
|
@ -14,8 +13,10 @@ body::-webkit-scrollbar {
|
|||
}
|
||||
|
||||
main {
|
||||
flex: 1; /* keep footer at the bottom */
|
||||
flex: 1;
|
||||
/* keep footer at the bottom */
|
||||
}
|
||||
|
||||
a {
|
||||
color: #cccccc;
|
||||
}
|
||||
|
|
@ -60,11 +61,23 @@ 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;
|
||||
}
|
||||
|
||||
|
|
@ -76,7 +89,8 @@ input, textarea, select, select:active, select:focus, select:hover {
|
|||
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,7 +153,7 @@ input, textarea, select, select:active, select:focus, select:hover {
|
|||
|
||||
.mail_attachments {
|
||||
width: 80%;
|
||||
padding-left:10%
|
||||
padding-left: 10%
|
||||
}
|
||||
|
||||
label {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,8 @@
|
|||
{% block footer %}
|
||||
<section class="container footer">
|
||||
<hr>
|
||||
<h4>{{ branding[0] }} offered by <a href="{{ branding[2] }}" style="text-decoration:underline" target="_blank">{{ branding[1] }}</a> | All Emails will be deleted after {{ purgeTime | raw }} | This project is <a href="https://github.com/crazyco-xyz/48hr.email" style="text-decoration:underline" target="_blank">open-source ♥</a></h4>
|
||||
<h4>{{ branding[0] }} offered by <a href="{{ branding[2] }}" style="text-decoration:underline" target="_blank">{{ branding[1] }}</a> | All Emails will be deleted after {{ purgeTime | raw }} | Currently handling <u><i>{{ count }}</i></u> Emails</h4>
|
||||
<h4 class="container footer-two"> This project is <a href="https://github.com/crazyco-xyz/48hr.email" style="text-decoration:underline" target="_blank">open-source ♥</a></h4>
|
||||
</section>
|
||||
{% endblock %}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue