summaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/src/meshbay_hub/api/signaling.py
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-08-20 22:21:24 +0200
committerChristophe Besson <cbesson@gmail.com>2026-08-20 22:21:24 +0200
commitae52b69b14a6997d01aad66f49fbea7b5ca2dfe6 (patch)
tree26f850a88565846a139868a4b85c715734751a41 /packages/meshbay-hub/src/meshbay_hub/api/signaling.py
parentc8af746c846b5dbc792f7e4f0d806647d513cc5c (diff)
parent2e9490ca27047ae03e495d397abbe1aec1b2273a (diff)
downloadmeshbay-ae52b69b14a6997d01aad66f49fbea7b5ca2dfe6.tar.gz
Merge feat/unified-group-management: wizard, public groups, activity sidebar
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/api/signaling.py')
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/api/signaling.py23
1 files changed, 16 insertions, 7 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/api/signaling.py b/packages/meshbay-hub/src/meshbay_hub/api/signaling.py
index cb00a67..84c1167 100644
--- a/packages/meshbay-hub/src/meshbay_hub/api/signaling.py
+++ b/packages/meshbay-hub/src/meshbay_hub/api/signaling.py
@@ -90,7 +90,9 @@ async def webrtc_offer(
if not ws:
raise HTTPException(status_code=404, detail="Node not connected")
- # The caller must share at least one active group with the target node.
+ # The caller must share at least one active group with the target node,
+ # OR the node must host at least one open-join group (public groups admit
+ # anyone — the node's MNP handshake handles authorization).
node_group_ids = set(_node_groups.get(node_id, []))
if node_group_ids:
result = await db.execute(
@@ -100,12 +102,19 @@ async def webrtc_offer(
))
shared = [gid for (gid,) in result.all()]
if not shared:
- raise HTTPException(status_code=403, detail="Not a member of any group on this node")
-
- active = await db.execute(
- select(Group.id).where(Group.id.in_(shared), Group.status == "active"))
- if not active.first():
- raise HTTPException(status_code=403, detail="Group is not active")
+ has_open = await db.execute(
+ select(Group.id).where(
+ Group.id.in_(node_group_ids),
+ Group.join_policy == "open",
+ Group.status == "active",
+ ))
+ if not has_open.first():
+ raise HTTPException(status_code=403, detail="Not a member of any group on this node")
+ else:
+ active = await db.execute(
+ select(Group.id).where(Group.id.in_(shared), Group.status == "active"))
+ if not active.first():
+ raise HTTPException(status_code=403, detail="Group is not active")
if _pending_per_user.get(current_user.id, 0) >= MAX_PENDING_PER_USER:
raise HTTPException(status_code=429, detail="Too many pending connections")