Skip to content

Commit

Permalink
fix: #618 违禁词的配置可以不用区分大小写
Browse files Browse the repository at this point in the history
  • Loading branch information
imaegoo committed Nov 24, 2023
1 parent 06e4351 commit d8e3fef
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/server/function/twikoo/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,11 @@ const fn = {
return true
} else if (config.FORBIDDEN_WORDS) {
// 违禁词检测
const commentLowerCase = comment.toLowerCase()
const nickLowerCase = nick.toLowerCase()
for (const forbiddenWord of config.FORBIDDEN_WORDS.split(',')) {
if (comment.indexOf(forbiddenWord.trim()) !== -1 || nick.indexOf(forbiddenWord.trim()) !== -1) {
const forbiddenWordLowerCase = forbiddenWord.trim().toLowerCase()
if (commentLowerCase.indexOf(forbiddenWordLowerCase) !== -1 || nickLowerCase.indexOf(forbiddenWordLowerCase) !== -1) {
logger.warn('包含违禁词,直接标记为垃圾评论~')
return true
}
Expand Down

0 comments on commit d8e3fef

Please sign in to comment.