converting to MP, just config in accessRights left

This commit is contained in:
STEINNI
2025-10-05 21:24:10 +00:00
parent 03af111d7f
commit 350d37e465
13 changed files with 283 additions and 796 deletions
+6 -19
View File
@@ -4,10 +4,10 @@ import {WssConnexion} from './wssConnexion.js'
export class wssServer {
constructor(configHelper, WSSServer, REDIScnx, debug) {
constructor(configHelper, WSSServer, allRediscnx, debug) {
this.debug = debug
if(this.debug) console.log('Starting WSSGateway...')
this.REDIScnx = REDIScnx
this.allRediscnx = allRediscnx
this.configHelper = configHelper
this.wssGatewayConfig = configHelper.config
this.AllWssConnections = {}
@@ -38,7 +38,7 @@ export class wssServer {
wssSrv: this,
debug: this.debug,
config: this.wssGatewayConfig,
rediscnx: this.REDIScnx,
allRediscnx: this.allRediscnx,
accessRights: this.accessRights,
userId: socket.session.userInfos.identity.uuid,
roles: socket.session.userInfos.roles,
@@ -47,23 +47,10 @@ export class wssServer {
if(!(wssCnx.userId in this.Users2uuids)) this.Users2uuids[wssCnx.userId] = new Set();
this.Users2uuids[wssCnx.userId].add(uuid);
this.OnlineUsers.add(wssCnx.userId);
this.REDIScnx.wssConnections[uuid] = wssCnx;
this.allRediscnx.forEach(cnx => { cnx.wssConnections[uuid] = wssCnx })
this.postLoginActions(wssCnx)
} else socket.close()
// wssCnx.doLogin().then(() => { // Things to execute only when successfuly logged-in
// if(!(wssCnx.userId in this.Users2uuids)) this.Users2uuids[wssCnx.userId] = new Set();
// this.Users2uuids[wssCnx.userId].add(uuid);
// this.OnlineUsers.add(wssCnx.userId);
// this.REDIScnx.wssConnections[uuid] = wssCnx;
// //}).then(() => {
// wssCnx.send(JSON.stringify({
// 'action': 'LOGIN',
// 'logged': true
// }))
// this.postLoginActions(wssCnx)
// })
}
postLoginActions(wssCnx) {
@@ -79,7 +66,7 @@ export class wssServer {
this.Users2uuids[userId].delete(uuid);
if(this.Users2uuids[userId].size == 0) this.OnlineUsers.delete(userId);
}
delete(this.REDIScnx.wssConnections[uuid]);
this.allRediscnx.forEach(cnx => delete cns.wssConnections[uuid])
this.fanoutOnlineUsers(this.getOnlineUsers());
}