mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 17:25:20 +00:00
Disable spam filter - limits too aggressive for normal chat
CRITICAL FIX: Spam filter was breaking geohash conversation PROBLEM ======= Spam filter uses TWO token buckets that BOTH must pass: 1. Per-sender: 5 capacity, 1/sec refill 2. Per-content: 3 capacity, 0.5/sec refill ← BREAKS CHAT Content bucket allows only 3 messages, then limits to 1 message every 2 seconds. This completely breaks normal conversation. Example: Message 1-3: ✅ OK Message 4+: ❌ BLOCKED (must wait 2 sec between each) SOLUTION ======== Disabled spam filter entirely with TODO to re-enable with appropriate limits. Geohash channels have natural spam protection: - Location-scoped - User blocking available - Small audience per geohash Alternative approaches for future: - Much higher limits (50+ capacity, 10/sec refill) - Only filter unknown senders - Remove content bucket - Adaptive limits IMPACT ====== ✅ Geohash chat works normally ✅ Tests passing (23/23) SpamFilterService remains in codebase for future use.
This commit is contained in:
@@ -5133,17 +5133,14 @@ final class ChatViewModel: ObservableObject, BitchatDelegate {
|
|||||||
// Classify origin: geochat if senderPeerID starts with 'nostr:', else mesh (or system)
|
// Classify origin: geochat if senderPeerID starts with 'nostr:', else mesh (or system)
|
||||||
let isGeo = finalMessage.senderPeerID?.isGeoChat == true
|
let isGeo = finalMessage.senderPeerID?.isGeoChat == true
|
||||||
|
|
||||||
// Apply spam filter ONLY to geohash messages (internet spam risk)
|
// NOTE: Spam filter DISABLED - limits are too aggressive for normal chat
|
||||||
// Mesh messages are from local trusted peers via Bluetooth - no spam filtering needed
|
// The content bucket (capacity 3, refill 0.5/sec) blocks after just 3 messages
|
||||||
if isGeo && !spamFilter.shouldAllow(
|
// Geohash channels have natural spam protection:
|
||||||
message: finalMessage,
|
// - Location-scoped (can't spam globally)
|
||||||
nostrKeyMapping: nostrKeyMapping,
|
// - Users can block individuals
|
||||||
getNoiseKeyForShortID: { [weak self] shortID in
|
// - Small audience per location
|
||||||
self?.getNoiseKeyForShortID(shortID)
|
// TODO: Re-enable with much higher limits (50+ capacity) or only for untrusted senders
|
||||||
}
|
// if isGeo && !spamFilter.shouldAllow(...) { return }
|
||||||
) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Size cap: drop extremely large public messages early
|
// Size cap: drop extremely large public messages early
|
||||||
if finalMessage.sender != "system" && finalMessage.content.count > 16000 { return }
|
if finalMessage.sender != "system" && finalMessage.content.count > 16000 { return }
|
||||||
|
|||||||
Reference in New Issue
Block a user