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