feat: add wildcard "*" to allow all hosts to connect via websocket

This commit is contained in:
micaelmz 2025-12-02 18:01:19 -03:00
parent df20c5fc93
commit abd0351f8f

View File

@ -33,7 +33,8 @@ export class WebsocketController extends EventController implements EventControl
const { remoteAddress } = req.socket;
const websocketConfig = configService.get<Websocket>('WEBSOCKET');
const allowedHosts = websocketConfig.ALLOWED_HOSTS || '127.0.0.1,::1,::ffff:127.0.0.1';
const isAllowedHost = allowedHosts
const allowAllHosts = allowedHosts.trim() === '*';
const isAllowedHost = allowAllHosts || allowedHosts
.split(',')
.map((h) => h.trim())
.includes(remoteAddress);