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

pull/197/head
Zef Hemel 2022-12-15 12:59:31 +01:00
parent 1d3ae7c822
commit b6c0349203
1 changed files with 17 additions and 11 deletions

View File

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