From 87cd9c590f431bff5a64fe6beeefbfb771821766 Mon Sep 17 00:00:00 2001 From: Mystikfluu Date: Sun, 5 Feb 2023 18:04:03 +0100 Subject: [PATCH] allow auth tokens in get requests --- routes/api/all.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/routes/api/all.js b/routes/api/all.js index 1d2cf8a..e342548 100644 --- a/routes/api/all.js +++ b/routes/api/all.js @@ -11,6 +11,13 @@ export const setup = function (router, con, server) { res.set("Access-Control-Allow-Origin", "*"); //we'll allow it for now let unsigned; if (req.body.user == undefined || req.body.pass == undefined) { + if(typeof req.get("ipost-auth-token") === "string") { + try{ + req.body.auth = JSON.parse(req.get("ipost-auth-token")) + } catch(err) { + console.log("error parsing header",err) + } + } if(req.body.auth != undefined) { if(typeof req.body.auth === "string") { try{ @@ -18,7 +25,7 @@ export const setup = function (router, con, server) { } catch(err) { console.log("error parsing",err) } - } + } else if( typeof req.body.auth !== "object" || typeof req.body.auth.secret !== "string" ||