commit
This commit is contained in:
@@ -52,6 +52,13 @@ const FALLBACK_WORDS = [
|
||||
// Politics
|
||||
'颠覆国家', '推翻政权', '分裂国家', '恐怖组织', '极端主义',
|
||||
'法轮', '法轮功', '台独', '藏独', '疆独',
|
||||
'习近平', '刁近平', '习大大', '习主席', '习总',
|
||||
'XiJinping', 'xijinping', '习近', '近平',
|
||||
'李强', '王岐山', '栗战书', '汪洋', '韩正',
|
||||
'李克强', '胡锦涛', '江泽民', '温家宝', '朱镕基',
|
||||
'邓小平', '毛泽东', '周恩来', '刘少奇', '彭德怀',
|
||||
'薄熙来', '周永康', '徐才厚', '郭伯雄', '令计划',
|
||||
'孙政才', '赵乐际', '王沪宁', '丁薛祥', '蔡奇',
|
||||
// Pornography
|
||||
'色情', '淫秽', '裸体', '卖淫', '嫖娼',
|
||||
'约炮', '援交', '一夜情', '黄色视频',
|
||||
@@ -130,13 +137,24 @@ class ContentSecurityManager {
|
||||
|
||||
const startTime = Date.now();
|
||||
const lowerContent = content.toLowerCase();
|
||||
// Strip common evasion characters (punctuation, spaces, zero-width chars) for split-char detection
|
||||
const strippedContent = content.replace(/[\s\u3000.,;:!?·…—\-_\|\\/~~`@#$%^&*+=<>()\[\]{}""''「」『』【】()〈〕\u200b\u200c\u200d\ufeff]/g, '').toLowerCase();
|
||||
const matchedWords = [];
|
||||
|
||||
for (let i = 0; i < this._words.length; i++) {
|
||||
const word = this._words[i];
|
||||
if (word && lowerContent.includes(word.toLowerCase())) {
|
||||
if (!word) continue;
|
||||
const lowerWord = word.toLowerCase();
|
||||
// Direct match
|
||||
if (lowerContent.includes(lowerWord)) {
|
||||
matchedWords.push(word);
|
||||
if (matchedWords.length >= 3) break;
|
||||
continue;
|
||||
}
|
||||
// Split-char evasion match: check if word chars appear in order with evasion chars between
|
||||
// Only for multi-char words (length >= 2)
|
||||
if (word.length >= 2 && strippedContent.includes(lowerWord)) {
|
||||
matchedWords.push(word);
|
||||
// Early exit if we find violations (performance optimization)
|
||||
if (matchedWords.length >= 3) break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user