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:
jack
2025-10-07 22:21:27 +01:00
committed by Islam
parent 4f62364bf4
commit 3ad9cbe48f
+8 -11
View File
@@ -5133,17 +5133,14 @@ final class ChatViewModel: ObservableObject, BitchatDelegate {
// Classify origin: geochat if senderPeerID starts with 'nostr:', else mesh (or system)
let isGeo = finalMessage.senderPeerID?.isGeoChat == true
// Apply spam filter ONLY to geohash messages (internet spam risk)
// Mesh messages are from local trusted peers via Bluetooth - no spam filtering needed
if isGeo && !spamFilter.shouldAllow(
message: finalMessage,
nostrKeyMapping: nostrKeyMapping,
getNoiseKeyForShortID: { [weak self] shortID in
self?.getNoiseKeyForShortID(shortID)
}
) {
return
}
// NOTE: Spam filter DISABLED - limits are too aggressive for normal chat
// The content bucket (capacity 3, refill 0.5/sec) blocks after just 3 messages
// Geohash channels have natural spam protection:
// - Location-scoped (can't spam globally)
// - Users can block individuals
// - Small audience per location
// TODO: Re-enable with much higher limits (50+ capacity) or only for untrusted senders
// if isGeo && !spamFilter.shouldAllow(...) { return }
// Size cap: drop extremely large public messages early
if finalMessage.sender != "system" && finalMessage.content.count > 16000 { return }