Simplify: auto-deny all domains starting with digits
Replaced complex checks (digit-dash, all-digit hostname) with simple rule: deny any domain starting with a digit, except 1440.news. Database: denied 2,870,090 domains and 24,885 feeds. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -31,33 +31,10 @@ func shouldAutoDenyDomain(host string) bool {
|
||||
if strings.HasSuffix(host, "1440.news") || host == "1440.news" {
|
||||
return false
|
||||
}
|
||||
// Deny domains starting with digit followed by dash (e.g., "0-example.com")
|
||||
if len(host) >= 2 && host[0] >= '0' && host[0] <= '9' && host[1] == '-' {
|
||||
// Deny domains starting with a digit (spam pattern)
|
||||
if len(host) > 0 && host[0] >= '0' && host[0] <= '9' {
|
||||
return true
|
||||
}
|
||||
// Deny domains where hostname is all digits (e.g., "0000114.com")
|
||||
// Extract the part before the TLD
|
||||
dotIdx := strings.LastIndex(host, ".")
|
||||
if dotIdx > 0 {
|
||||
name := host[:dotIdx]
|
||||
// Remove any subdomain prefix (get last part before TLD)
|
||||
if lastDot := strings.LastIndex(name, "."); lastDot >= 0 {
|
||||
name = name[lastDot+1:]
|
||||
}
|
||||
// Check if it's all digits
|
||||
if len(name) > 0 {
|
||||
allDigits := true
|
||||
for _, c := range name {
|
||||
if c < '0' || c > '9' {
|
||||
allDigits = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if allDigits {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user