1
0

Remove authentication on manifest.json file (and favicon just in case)

This commit is contained in:
Zef Hemel 2022-12-15 12:59:31 +01:00
parent 1d3ae7c822
commit b6c0349203

View File

@ -178,8 +178,10 @@ export class HttpServer {
} }
private addPasswordAuth(app: Application) { private addPasswordAuth(app: Application) {
const excludedPaths = ["/manifest.json", "/favicon.png"];
if (this.user) { if (this.user) {
app.use(async ({ request, response }, next) => { app.use(async ({ request, response }, next) => {
if (!excludedPaths.includes(request.url.pathname)) {
if ( if (
request.headers.get("Authorization") === request.headers.get("Authorization") ===
`Basic ${btoa(this.user!)}` `Basic ${btoa(this.user!)}`
@ -193,6 +195,10 @@ export class HttpServer {
); );
response.body = "Unauthorized"; response.body = "Unauthorized";
} }
} else {
// Unauthenticated access to excluded paths
await next();
}
}); });
} }
} }