pubkey check
This commit is contained in:
parent
d834f2aa6f
commit
303a09d18e
2 changed files with 18 additions and 4 deletions
19
index.js
19
index.js
|
@ -247,7 +247,8 @@ app.post('/mininq/mbox/r', async (req, res) => {
|
||||||
"url": mininq_pub.url
|
"url": mininq_pub.url
|
||||||
} : {
|
} : {
|
||||||
"name": `${mininq_pub.name} sent:`
|
"name": `${mininq_pub.name} sent:`
|
||||||
}
|
},
|
||||||
|
"timestamp": new Date(mininq_pub.time).toISOString()
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"attachments": []
|
"attachments": []
|
||||||
|
@ -296,7 +297,8 @@ app.post('/mininq/mbox/r', async (req, res) => {
|
||||||
"url": mininq.url
|
"url": mininq.url
|
||||||
} : {
|
} : {
|
||||||
"name": `${mininq.name} sent:`
|
"name": `${mininq.name} sent:`
|
||||||
}
|
},
|
||||||
|
"timestamp": new Date(mininq.time).toISOString()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": body.msg,
|
"description": body.msg,
|
||||||
|
@ -415,7 +417,18 @@ app.post('/mininq/send', async (req, res) => {
|
||||||
try {
|
try {
|
||||||
let publicKeyWorks = await checkPublicKey(body);
|
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) {
|
} catch (err) {
|
||||||
// do nothing lol
|
// do nothing lol
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,4 +11,5 @@
|
||||||
<h3>sysadmin reply:</h3>
|
<h3>sysadmin reply:</h3>
|
||||||
<p style="white-space: pre-line;"><%= mininq.reply %></p>
|
<p style="white-space: pre-line;"><%= mininq.reply %></p>
|
||||||
</section>
|
</section>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
<p style="opacity: 0.5;"><%= new Date(mininq.time).toLocaleString('en-us', { timeZone: "America/Chicago" }) %> Central Time</p>
|
Loading…
Reference in a new issue