forum trust circle: trust-gated content exchange via subscription graph

readme: document trust circle design

readme: tone down trust circle language to match existing style

remove forum_enabled toggle: subscribing IS trusting, no intermediate state
This commit is contained in:
blankie 2026-06-17 19:10:32 +00:00
parent 6f700c213f
commit f680931c8c
5 changed files with 232 additions and 17 deletions

View file

@ -721,6 +721,7 @@ class ForumHandlers:
blocked = self._blocked_instances()
blocked.add(instance)
self.fdb.set_setting("blocked_instances", ",".join(blocked))
self.fdb.remove_by_hash(instance)
self._set_flash(f"Blocked {instance[:16]}...")
return self._redirect("/forum/moderation")
@ -744,6 +745,7 @@ class ForumHandlers:
self.fdb.clear_peer_block(instance)
else:
blocked.add(instance)
self.fdb.remove_by_hash(instance)
self.fdb.set_setting("blocked_instances", ",".join(blocked))
auto = set(h.strip() for h in self.fdb.get_setting("auto_blocked_instances", "").split(",") if h.strip())
auto.discard(instance)
@ -879,6 +881,10 @@ class ForumHandlers:
if scoped_query_tag and from_hash:
scoped_query_results = self.fdb.get_filtered_peers_by_tag(scoped_query_tag)
# Merge trust gossip from requester
if from_hash:
self.sync._merge_trust_gossip(data.get("trust_list", []), from_hash)
# Store peer's topics for future routing (backward compat)
if peer_topics and from_hash:
self.fdb.set_setting(f"peer_topics_{from_hash}", ",".join(peer_topics))
@ -920,7 +926,10 @@ class ForumHandlers:
# Merge incoming content, filtered by bloom and topics
if incoming_threads:
for t in incoming_threads:
if t.get("author_instance", "") in blocked:
author = t.get("author_instance", "")
if author in blocked:
continue
if author and not self.fdb.is_trusted(author):
continue
if peer_bloom and peer_bloom.might_contain(t["id"]):
continue
@ -932,7 +941,10 @@ class ForumHandlers:
self.fdb.merge_thread(t)
if incoming_posts:
for p in incoming_posts:
if p.get("author_instance", "") in blocked:
author = p.get("author_instance", "")
if author in blocked:
continue
if author and not self.fdb.is_trusted(author):
continue
if peer_bloom and peer_bloom.might_contain(p["id"]):
continue
@ -981,6 +993,13 @@ class ForumHandlers:
posts = [dict(r) for r in posts_list]
upvote_threads = up_list
# Filter outgoing content by requester's trust list
requester_trust = set(data.get("trust_list", []))
if requester_trust:
threads = [t for t in threads if t.get("author_instance", "") in requester_trust]
thread_ids = set(t["id"] for t in threads)
posts = [p for p in posts if p.get("thread_id") in thread_ids]
known_peers = [h for h in self.fdb.get_all_known_hashes() if h != from_hash]
peer_topics_map = {}
for ph in known_peers[:100]:
@ -1012,6 +1031,7 @@ class ForumHandlers:
"tag_bloom_size": peer_tag_bs,
"tag_bloom_hashes": peer_tag_bh,
"filter_table": filter_table_gossip,
"trust_list": self.fdb.get_all_trusted_hashes(),
"scoped_query_results": scoped_query_results,
}),
"headers": {},