fix(basic.gblib): update ChatServices.ts #420

Closed
eltociear wants to merge 2540 commits from patch-1 into main
Showing only changes of commit c508019ca0 - Show all commits

View file

@ -203,18 +203,20 @@ export class GBServer {
'admin': { password: process.env.ADMIN_PASS }, 'admin': { password: process.env.ADMIN_PASS },
}; };
// ... some not authenticated middlewares // ... some not authenticated middlewares
server.use((req, res, next) => { server.use((req, res, next) => {
var user = auth(req); if (req.originalUrl.startsWith('/logs')) {
if (!user || !admins[user.name] || admins[user.name].password !== user.pass) { var user = auth(req);
res.set('WWW-Authenticate', 'Basic realm="example"'); if (!user || !admins[user.name] || admins[user.name].password !== user.pass) {
return res.status(401).send(); res.set('WWW-Authenticate', 'Basic realm="example"');
return res.status(401).send();
}
} }
return next(); return next();
}); });
// If global log enabled, reorders transports adding web logging. // If global log enabled, reorders transports adding web logging.
const loggers = GBLog.getLogger(); const loggers = GBLog.getLogger();
require('winston-logs-display')(server, loggers[1]); require('winston-logs-display')(server, loggers[1]);