additions or whateva
parent
75f3fee5f2
commit
22d7a3d666
|
@ -20,17 +20,19 @@ export default class Keys extends Route {
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.router.get('/x509/:userID', async (req, res) => {
|
this.router.get('/p/:type/x509/:userID', async (req, res) => {
|
||||||
const memberDoc = await this.server.client.db.Member.findOne({ userID: req.params.userID }).lean().exec();
|
const memberDoc = await this.server.client.db.Member.findOne({ userID: req.params.userID }).lean().exec();
|
||||||
const member = this.mainGuild.members.get(req.params.userID);
|
const member = this.mainGuild.members.get(req.params.userID);
|
||||||
if (!member || !memberDoc || !memberDoc?.x509) return res.status(404).json({ code: this.constants.codes.NOT_FOUND, message: this.constants.messages.NOT_FOUND });
|
if (!member || !memberDoc || !memberDoc?.x509) return res.status(404).json({ code: this.constants.codes.NOT_FOUND, message: this.constants.messages.NOT_FOUND });
|
||||||
|
if (req.params.type === 'download') res.contentType('application/x-x509-user-cert');
|
||||||
return res.status(200).send(memberDoc.x509);
|
return res.status(200).send(memberDoc.x509);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.router.get('/pgp/:userID', async (req, res) => {
|
this.router.get('/p/:type/pgp/:userID', async (req, res) => {
|
||||||
const memberDoc = await this.server.client.db.Member.findOne({ userID: req.params.userID }).lean().exec();
|
const memberDoc = await this.server.client.db.Member.findOne({ userID: req.params.userID }).lean().exec();
|
||||||
const member = this.mainGuild.members.get(req.params.userID);
|
const member = this.mainGuild.members.get(req.params.userID);
|
||||||
if (!member || !memberDoc || !memberDoc?.pgp) return res.status(404).json({ code: this.constants.codes.NOT_FOUND, message: this.constants.messages.NOT_FOUND });
|
if (!member || !memberDoc || !memberDoc?.pgp) return res.status(404).json({ code: this.constants.codes.NOT_FOUND, message: this.constants.messages.NOT_FOUND });
|
||||||
|
if (req.params.type === 'download') res.contentType('application/pgp-keys');
|
||||||
return res.status(200).send(memberDoc.pgp);
|
return res.status(200).send(memberDoc.pgp);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue