Fix prevent zalgo-text (Issue #23)

This commit is contained in:
object 2022-08-06 01:16:30 +00:00
parent 2fa3662860
commit d5361ef5b3

View File

@ -89,6 +89,15 @@ export const ChatInputView: FC<{}> = props =>
if(text.length <= maxChatLength)
{
const re = /%CC%/g
const hasZalgo = txt => re.test(encodeURIComponent(txt));
if (hasZalgo(text))
{
setChatValue('');
return;
}
setChatValue('');
sendChat(text, chatType, recipientName, chatStyleId);
}