Verificação de termos enviados
O servidor agora não irá permitir o envio de termos com caracteres que não sejam permitidos e, caso o filtro de temas adultos da sala esteja habilitado, irá proibir palavras filtradas também.
This commit is contained in:
parent
5c70dc6b87
commit
bcf698074b
13
index.js
13
index.js
|
@ -324,6 +324,19 @@ wss.on('connection', ws => {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Verificar termo via expressão regular.
|
||||||
|
let palavraRegexIlegal = new RegExp(vars["palavra.regex.caracteresIlegais"], 'g');
|
||||||
|
if (palavraRegexIlegal.test(resposta.extra.termo)){
|
||||||
|
ws.send(JSON.stringify(new Resposta("PEDIDO_CANCELADO", "SERVIDOR", "PALAVRA_OU_LETRA_PROIBIDO", { erroDescrição: "TERMO_CARACTERES_ILEGAIS" })));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verificar se o termo enviado possui termos filtrados CASO a sala tinha o filtro habilitado
|
||||||
|
if (salaObj.opções["filtro.temasAdultos.habilitado"] && Util.filtrarMensagem(resposta.extra.termo, filtros) !== resposta.extra.termo){
|
||||||
|
ws.send(JSON.stringify(new Resposta("PEDIDO_CANCELADO", "SERVIDOR", "PALAVRA_OU_LETRA_PROIBIDO", { erroDescrição: "TERMO_IMPRÓPRIO" })));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Verificar o tipo do termo enviado.
|
// Verificar o tipo do termo enviado.
|
||||||
let letra = resposta.extra.termo.length === 1;
|
let letra = resposta.extra.termo.length === 1;
|
||||||
let salaClientes = salaObj.clientes;
|
let salaClientes = salaObj.clientes;
|
||||||
|
|
Reference in New Issue