[mirotalksfu] - fix host_protection
هذا الالتزام موجود في:
@@ -308,8 +308,13 @@ function startServer() {
|
|||||||
// main page
|
// main page
|
||||||
app.get(['/'], (req, res) => {
|
app.get(['/'], (req, res) => {
|
||||||
if (hostCfg.protected) {
|
if (hostCfg.protected) {
|
||||||
hostCfg.authenticated = false;
|
let ip = getIP(req);
|
||||||
res.sendFile(views.login);
|
if (allowedIP(ip)) {
|
||||||
|
res.sendFile(views.landing);
|
||||||
|
} else {
|
||||||
|
hostCfg.authenticated = false;
|
||||||
|
res.sendFile(views.login);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
res.sendFile(views.landing);
|
res.sendFile(views.landing);
|
||||||
}
|
}
|
||||||
@@ -1978,6 +1983,8 @@ function startServer() {
|
|||||||
return req.headers['x-forwarded-for'] || req.socket.remoteAddress;
|
return req.headers['x-forwarded-for'] || req.socket.remoteAddress;
|
||||||
}
|
}
|
||||||
function allowedIP(ip) {
|
function allowedIP(ip) {
|
||||||
|
const allowedIPs = authHost.getAuthorizedIPs();
|
||||||
|
log.info('Allowed IPs', { ip: ip, allowedIPs: allowedIPs });
|
||||||
return authHost != null && authHost.isAuthorizedIP(ip);
|
return authHost != null && authHost.isAuthorizedIP(ip);
|
||||||
}
|
}
|
||||||
function removeIP(socket) {
|
function removeIP(socket) {
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم