[mirotalksfu] - fix host_protection

هذا الالتزام موجود في:
Miroslav Pejic
2024-03-24 09:45:37 +01:00
الأصل 8333a0be89
التزام 92c9870a54

عرض الملف

@@ -308,8 +308,13 @@ function startServer() {
// main page
app.get(['/'], (req, res) => {
if (hostCfg.protected) {
hostCfg.authenticated = false;
res.sendFile(views.login);
let ip = getIP(req);
if (allowedIP(ip)) {
res.sendFile(views.landing);
} else {
hostCfg.authenticated = false;
res.sendFile(views.login);
}
} else {
res.sendFile(views.landing);
}
@@ -1978,6 +1983,8 @@ function startServer() {
return req.headers['x-forwarded-for'] || req.socket.remoteAddress;
}
function allowedIP(ip) {
const allowedIPs = authHost.getAuthorizedIPs();
log.info('Allowed IPs', { ip: ip, allowedIPs: allowedIPs });
return authHost != null && authHost.isAuthorizedIP(ip);
}
function removeIP(socket) {