File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -81,11 +81,17 @@ function create_chat_connection(channel_name = '') {
8181 return ;
8282 }
8383
84- // prevent xss attack from message
85- message = message . replace ( / [ ^ a - z A - Z а - я А - Я ё Ё 0 - 9 ] / g, '' ) ;
86- if ( message . length < 2 ) return ;
84+ // Приводим ЛЕД и ЛЁД к одному виду
85+ message = message . replace ( / ё / gi, 'е' ) ;
86+
87+ // prevent xss attack
88+ // числа убираем тоже, потому что апишка контекстно зачем-то считает валидными+однинаковыми и слово СТОЛ и СТОЛ12345 (бредик да)
89+ message = message . replace ( / [ ^ a - z A - Z а - я А - Я ] / g, '' ) ;
8790
88- message = message . replace ( / ё / g, 'е' ) ;
91+ // а можно вот так, останутся любые буквы любого языка. задел на мультиязычную версию.
92+ // message = message.replace(/[^\p{L}]/gu, '');
93+
94+ if ( message . length < 2 ) return ;
8995
9096 words_count ++ ;
9197 if ( words_count === 1 ) {
You can’t perform that action at this time.
0 commit comments