[mirotalksfu] - Enable OIDC authentication in conjunction with Host protection mode
هذا الالتزام موجود في:
@@ -6,6 +6,15 @@ module.exports = class Host {
|
||||
this.roomActive = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get IP from req
|
||||
* @param {object} req
|
||||
* @returns string IP
|
||||
*/
|
||||
getIP(req) {
|
||||
return req.headers['x-forwarded-for'] || req.headers['X-Forwarded-For'] || req.socket.remoteAddress || req.ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get authorized IPs
|
||||
* @returns object
|
||||
@@ -21,7 +30,7 @@ module.exports = class Host {
|
||||
*/
|
||||
setAuthorizedIP(ip, authorized) {
|
||||
this.authorizedIPs.set(ip, authorized);
|
||||
this.roomActive = true;
|
||||
this.setRoomActive();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -34,20 +43,34 @@ module.exports = class Host {
|
||||
}
|
||||
|
||||
/**
|
||||
* Host room active
|
||||
* Host room status
|
||||
* @returns boolean
|
||||
*/
|
||||
isRoomActive() {
|
||||
return this.roomActive;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set host room activate
|
||||
*/
|
||||
setRoomActive() {
|
||||
this.roomActive = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set host room deactivate
|
||||
*/
|
||||
setRoomDeactivate() {
|
||||
this.roomActive = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete ip from authorized IPs
|
||||
* @param {string} ip
|
||||
* @returns boolean
|
||||
*/
|
||||
deleteIP(ip) {
|
||||
this.roomActive = false;
|
||||
this.setRoomDeactivate();
|
||||
return this.authorizedIPs.delete(ip);
|
||||
}
|
||||
};
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم