From f1a28fa171918031fbecdedec9a8c0af81b99b84 Mon Sep 17 00:00:00 2001 From: Matthew R Date: Wed, 14 Oct 2020 19:57:02 -0400 Subject: [PATCH] fixes --- src/api/loc.sh/routes/internal.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/loc.sh/routes/internal.ts b/src/api/loc.sh/routes/internal.ts index 00d3294..0a06342 100644 --- a/src/api/loc.sh/routes/internal.ts +++ b/src/api/loc.sh/routes/internal.ts @@ -202,7 +202,7 @@ export default class Internal extends Route { this.router.get('/id', async (req, res) => { try { - if (req.query?.auth.toString() !== this.server.client.config.internalKey) return res.status(401).json({ code: this.constants.codes.UNAUTHORIZED, message: this.constants.messages.UNAUTHORIZED }); + if (req.query?.auth?.toString() !== this.server.client.config.internalKey) return res.status(401).json({ code: this.constants.codes.UNAUTHORIZED, message: this.constants.messages.UNAUTHORIZED }); if (!req.query.pin) return res.status(400).json({ code: this.constants.codes.CLIENT_ERROR }); const args = req.query.pin.toString(); const user = await this.server.client.db.Score.findOne({ pin: [Number(args.split('-')[0]), Number(args.split('-')[1]), Number(args.split('-')[2])] }).lean().exec(); @@ -215,7 +215,7 @@ export default class Internal extends Route { this.router.get('/pin', async (req, res) => { try { - if (req.query?.auth.toString() !== this.server.client.config.internalKey) return res.status(401).json({ code: this.constants.codes.UNAUTHORIZED, message: this.constants.messages.UNAUTHORIZED }); + if (req.query?.auth?.toString() !== this.server.client.config.internalKey) return res.status(401).json({ code: this.constants.codes.UNAUTHORIZED, message: this.constants.messages.UNAUTHORIZED }); if (!req.query.id) return res.status(400).json({ code: this.constants.codes.CLIENT_ERROR }); const report = await this.server.client.db.Score.findOne({ userID: req.query.id.toString() });