Fix masqr (thanks blumiere)

This commit is contained in:
rift 2024-02-08 22:08:21 -06:00
parent 521c2b8cdf
commit d36fc0fceb

View file

@ -85,9 +85,10 @@ app.register(cookieParser);
await app.register(import("@fastify/compress"));
// Uncomment if you wish to add masqr.
/* app.addHook("preHandler", async (req, reply) => {
/*
app.addHook("preHandler", async (req, reply) => {
if (req.cookies["authcheck"]) {
return;
return reply;
}
const authheader = req.headers.authorization;
@ -97,7 +98,7 @@ await app.register(import("@fastify/compress"));
.setCookie("refreshcheck", "true", { maxAge: 10000 })
.type("text/html")
.send(failureFile);
return;
return reply;
}
if (!authheader) {
@ -106,7 +107,7 @@ await app.register(import("@fastify/compress"));
.header("WWW-Authenticate", "Basic")
.type("text/html")
.send(failureFile);
return;
return reply;
}
const auth = Buffer.from(authheader.split(" ")[1], "base64")
@ -126,10 +127,11 @@ await app.register(import("@fastify/compress"));
if (licenseCheck === "License valid") {
reply.setCookie("authcheck", "true");
return;
return reply;
}
reply.type("text/html").send(failureFile);
return reply;
}); */
app.register(fastifyStatic, {