Fix masqr (thanks blumiere)
This commit is contained in:
parent
521c2b8cdf
commit
d36fc0fceb
1 changed files with 40 additions and 38 deletions
12
server.ts
12
server.ts
|
|
@ -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, {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue