aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/src/meshbay_hub/api/groups.py
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-08-09 04:58:06 +0200
committerChristophe Besson <cbesson@gmail.com>2026-08-09 04:58:06 +0200
commitc9422eaf95090cde6411186c0d62b04286a8477c (patch)
tree558378df2af6869a86215bcfe53e893b79c756bd /packages/meshbay-hub/src/meshbay_hub/api/groups.py
parent9b503785afe10849f40a26735aa08e0af24a6efc (diff)
downloadmeshbay-c9422eaf95090cde6411186c0d62b04286a8477c.tar.gz
feat(hub): add web app + public group listing endpoint
webapp.py: serves / (HTML SPA) and /app.js (JS client). app.js: login, hub API calls, node HTTP API integration, file browser, HLS video streaming via <video> tag. groups.py: GET /v1/groups — public group listing (no auth). Deployed on https://meshbay.org — 200 OK. 47/47 tests. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/api/groups.py')
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/api/groups.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/api/groups.py b/packages/meshbay-hub/src/meshbay_hub/api/groups.py
index 942a88e..0092fbd 100644
--- a/packages/meshbay-hub/src/meshbay_hub/api/groups.py
+++ b/packages/meshbay-hub/src/meshbay_hub/api/groups.py
@@ -12,6 +12,35 @@ from meshbay_hub.db.models import GEKBundle, Group, GroupMember, IPLog, User
router = APIRouter(prefix="/v1/groups", tags=["groups"])
+@router.get("")
+async def list_public_groups(
+ db: AsyncSession = Depends(get_db),
+ limit: int = 50,
+ offset: int = 0,
+):
+ """List public groups — browsable without authentication."""
+ result = await db.execute(
+ select(Group)
+ .where(Group.visibility == "public", Group.status == "active")
+ .order_by(Group.created_at.desc())
+ .limit(limit)
+ .offset(offset)
+ )
+ groups = result.scalars().all()
+ return {
+ "groups": [
+ {
+ "id": g.id,
+ "name": g.name,
+ "join_policy": g.join_policy,
+ "created_at": g.created_at.isoformat(),
+ }
+ for g in groups
+ ],
+ "total": len(groups),
+ }
+
+
class GroupCreateRequest(BaseModel):
name: str
visibility: str = "private" # public|private