new(all): Web log.
This commit is contained in:
parent
28a6f33700
commit
c508019ca0
1 changed files with 8 additions and 6 deletions
|
@ -206,11 +206,13 @@ export class GBServer {
|
|||
// ... some not authenticated middlewares
|
||||
|
||||
server.use((req, res, next) => {
|
||||
if (req.originalUrl.startsWith('/logs')) {
|
||||
var user = auth(req);
|
||||
if (!user || !admins[user.name] || admins[user.name].password !== user.pass) {
|
||||
res.set('WWW-Authenticate', 'Basic realm="example"');
|
||||
return res.status(401).send();
|
||||
}
|
||||
}
|
||||
return next();
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue