diff --git a/index.js b/index.js index 708d197..532c218 100644 --- a/index.js +++ b/index.js @@ -247,7 +247,8 @@ app.post('/mininq/mbox/r', async (req, res) => { "url": mininq_pub.url } : { "name": `${mininq_pub.name} sent:` - } + }, + "timestamp": new Date(mininq_pub.time).toISOString() } ], "attachments": [] @@ -296,7 +297,8 @@ app.post('/mininq/mbox/r', async (req, res) => { "url": mininq.url } : { "name": `${mininq.name} sent:` - } + }, + "timestamp": new Date(mininq.time).toISOString() }, { "description": body.msg, @@ -415,7 +417,18 @@ app.post('/mininq/send', async (req, res) => { try { let publicKeyWorks = await checkPublicKey(body); - if (publicKeyWorks) newObject.url = body.pkeyurl; + if (publicKeyWorks) { + newObject.url = body.pkeyurl; + + const isUrlAlreadyMininq = await db + .selectFrom('mininq') + .select('url') + .where('url', '=', newObject.url) + .where('public', '=', 0) + .executeTakeFirst(); + + if (isUrlAlreadyMininq != null) return res.status(403).send("Pubkey is already in mailbox"); + } } catch (err) { // do nothing lol } diff --git a/views/components/mininq.ejs b/views/components/mininq.ejs index 94f6479..f16882d 100644 --- a/views/components/mininq.ejs +++ b/views/components/mininq.ejs @@ -11,4 +11,5 @@

sysadmin reply:

<%= mininq.reply %>

-<% } %> \ No newline at end of file +<% } %> +

<%= new Date(mininq.time).toLocaleString('en-us', { timeZone: "America/Chicago" }) %> Central Time

\ No newline at end of file