[mirotalksfu] - improve host protection mode

هذا الالتزام موجود في:
Miroslav Pejic
2024-04-27 22:47:57 +02:00
الأصل 8b87f6b3b0
التزام 7cae61ba85
2 ملفات معدلة مع 22 إضافات و4 حذوفات

عرض الملف

@@ -3,6 +3,7 @@
module.exports = class Host {
constructor() {
this.authorizedIPs = new Map();
this.roomActive = false;
}
/**
@@ -20,6 +21,7 @@ module.exports = class Host {
*/
setAuthorizedIP(ip, authorized) {
this.authorizedIPs.set(ip, authorized);
this.roomActive = true;
}
/**
@@ -31,12 +33,21 @@ module.exports = class Host {
return this.authorizedIPs.has(ip);
}
/**
* Host room active
* @returns boolean
*/
isRoomActive() {
return this.roomActive;
}
/**
* Delete ip from authorized IPs
* @param {string} ip
* @returns boolean
*/
deleteIP(ip) {
this.roomActive = false;
return this.authorizedIPs.delete(ip);
}
};