@fsvreddit/bot-bouncer-evaluation 0.7.42 → 0.7.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -79,24 +79,7 @@ class EvaluateBioText extends UserEvaluatorBase_js_1.UserEvaluatorBase {
|
|
|
79
79
|
return this.getCompiledRegexes().some(regex => user.userDescription && regex.test(user.userDescription));
|
|
80
80
|
}
|
|
81
81
|
evaluate(user) {
|
|
82
|
-
|
|
83
|
-
if (this.verboseLogging) {
|
|
84
|
-
matchedRegex = this.getCompiledRegexes().find((regex) => {
|
|
85
|
-
if (!user.userDescription) {
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
const start = Date.now();
|
|
89
|
-
const result = regex.test(user.userDescription);
|
|
90
|
-
const end = Date.now();
|
|
91
|
-
if (end - start > this.regexWarnThreshold) {
|
|
92
|
-
console.log(`${this.name}: Regex took ${end - start}ms for regex: ${regex.source}`);
|
|
93
|
-
}
|
|
94
|
-
return result;
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
matchedRegex = this.getCompiledRegexes().find(regex => user.userDescription && regex.test(user.userDescription));
|
|
99
|
-
}
|
|
82
|
+
const matchedRegex = this.getCompiledRegexes().find(regex => user.userDescription && regex.test(user.userDescription));
|
|
100
83
|
if (matchedRegex) {
|
|
101
84
|
this.canAutoBan = true;
|
|
102
85
|
this.addHitReason(`Bio text matched regex: ${(0, markdown_escape_1.default)(matchedRegex.source)}`);
|
|
@@ -479,20 +479,7 @@ class EvaluateBotGroupAdvanced extends UserEvaluatorBase_js_1.UserEvaluatorBase
|
|
|
479
479
|
return compiledRegex;
|
|
480
480
|
}
|
|
481
481
|
anyRegexMatches(input, regexes) {
|
|
482
|
-
|
|
483
|
-
return regexes.some((regex) => {
|
|
484
|
-
const start = Date.now();
|
|
485
|
-
const result = this.getCompiledRegex(regex).test(input);
|
|
486
|
-
const end = Date.now();
|
|
487
|
-
if (end - start > this.regexWarnThreshold) {
|
|
488
|
-
console.warn(`Evaluation: Regex took ${end - start}ms: ${regex}`);
|
|
489
|
-
}
|
|
490
|
-
return result;
|
|
491
|
-
});
|
|
492
|
-
}
|
|
493
|
-
else {
|
|
494
|
-
return regexes.some(regex => this.getCompiledRegex(regex).test(input));
|
|
495
|
-
}
|
|
482
|
+
return regexes.some(regex => this.getCompiledRegex(regex).test(input));
|
|
496
483
|
}
|
|
497
484
|
getBotGroups() {
|
|
498
485
|
const groups = this.getAllVariables("group");
|
|
@@ -767,9 +754,6 @@ class EvaluateBotGroupAdvanced extends UserEvaluatorBase_js_1.UserEvaluatorBase
|
|
|
767
754
|
continue;
|
|
768
755
|
}
|
|
769
756
|
if (!group.criteria) {
|
|
770
|
-
if (this.verboseLogging) {
|
|
771
|
-
console.log(`Pre-evaluation: Comment ${comment.comment.id} for ${comment.author.name} matches bot group with no criteria ${group.name}`);
|
|
772
|
-
}
|
|
773
757
|
return true;
|
|
774
758
|
}
|
|
775
759
|
;
|
|
@@ -78,21 +78,7 @@ class EvaluatePostTitle extends UserEvaluatorBase_js_1.UserEvaluatorBase {
|
|
|
78
78
|
if (nonMatchingTitles.has(title)) {
|
|
79
79
|
continue;
|
|
80
80
|
}
|
|
81
|
-
|
|
82
|
-
if (this.verboseLogging) {
|
|
83
|
-
matchedBanRegex = regexes.find((regex) => {
|
|
84
|
-
const start = Date.now();
|
|
85
|
-
const result = regex.test(title);
|
|
86
|
-
const end = Date.now();
|
|
87
|
-
if (end - start > this.regexWarnThreshold) {
|
|
88
|
-
console.warn(`Evaluation: Regex took ${end - start}ms: ${regex.source}`);
|
|
89
|
-
}
|
|
90
|
-
return result;
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
matchedBanRegex = regexes.find(regex => regex.test(title));
|
|
95
|
-
}
|
|
81
|
+
const matchedBanRegex = regexes.find(regex => regex.test(title));
|
|
96
82
|
if (!matchedBanRegex) {
|
|
97
83
|
nonMatchingTitles.add(title);
|
|
98
84
|
continue;
|
package/package.json
CHANGED