allow auth tokens in get requests

This commit is contained in:
Mystikfluu 2023-02-05 18:04:03 +01:00
parent e252f8e504
commit 87cd9c590f

View File

@ -11,6 +11,13 @@ export const setup = function (router, con, server) {
res.set("Access-Control-Allow-Origin", "*"); //we'll allow it for now res.set("Access-Control-Allow-Origin", "*"); //we'll allow it for now
let unsigned; let unsigned;
if (req.body.user == undefined || req.body.pass == undefined) { 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(req.body.auth != undefined) {
if(typeof req.body.auth === "string") { if(typeof req.body.auth === "string") {
try{ try{
@ -18,7 +25,7 @@ export const setup = function (router, con, server) {
} catch(err) { } catch(err) {
console.log("error parsing",err) console.log("error parsing",err)
} }
} } else
if( if(
typeof req.body.auth !== "object" || typeof req.body.auth !== "object" ||
typeof req.body.auth.secret !== "string" || typeof req.body.auth.secret !== "string" ||