dev: one-command local calls stack (LiveKit + JWT issuer + voice-limit guard + https well-known) and a seeded voice room
CI / Build & Quality Checks (push) Successful in 1m42s
CI / Docker image build & smoke test (push) Skipped
CI / Secret scan (gitleaks) (push) Successful in 6s
CI / Trigger Desktop Build (push) Successful in 7s
CI / Playwright smoke (e2e) (push) Successful in 2m22s

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PPmy3tPq869XDW4njjVaKA
This commit is contained in:
2026-09-18 22:29:47 -04:00
co-authored by Claude Opus 5
parent 50b4e2c16c
commit da2d7a7d4f
5 changed files with 152 additions and 8 deletions
+24 -5
View File
@@ -1,11 +1,15 @@
#!/usr/bin/env python3
"""Seed the local dev homeserver (scripts/dev-homeserver.sh) with two users
and a busy unencrypted room: alice + bob, "Busy Room", N messages, one image
every 10th message. Idempotent for the users; every run creates a new room.
"""Seed the local dev homeserver (scripts/dev-homeserver.sh) with two users,
a busy unencrypted room and a voice room: alice + bob, "Busy Room" (N
messages, one image every 10th), "Voice Lounge" (org.matrix.msc3417.call with
the call-member power level Lotus applies). Makes alice a server admin (the
voice-limit guard reads room state through the admin API) and writes her
token to .dev-homeserver/admin.token for `dev-homeserver.sh calls`.
Idempotent for the users; every run creates new rooms.
python3 scripts/dev-seed.py [N=400]
"""
import json, struct, sys, time, urllib.error, urllib.parse, urllib.request, zlib
import json, os, sqlite3, struct, sys, time, urllib.error, urllib.parse, urllib.request, zlib
HS = "http://127.0.0.1:8008"
PASSWORD = "password123"
@@ -56,7 +60,22 @@ def main():
content = {"msgtype": "m.text", "body": f"message #{i}"}
txn += 1
req("PUT", f"/_matrix/client/v3/rooms/{urllib.parse.quote(room)}/send/m.room.message/{txn}", content, tok)
print(json.dumps({"room": room, "alice": alice["user_id"], "bob": bob["user_id"], "count": n}))
voice = req("POST", "/_matrix/client/v3/createRoom", {
"name": "Voice Lounge", "preset": "public_chat",
"creation_content": {"type": "org.matrix.msc3417.call"},
"initial_state": [{"type": "org.matrix.msc3401.call", "state_key": "", "content": {}}],
"power_level_content_override": {"events": {"org.matrix.msc3401.call.member": 0}},
}, ta)["room_id"]
req("POST", f"/_matrix/client/v3/join/{urllib.parse.quote(voice)}", {}, tb)
# admin flag for the guard (takes effect for tokens issued after a Synapse restart-free
# cache miss; the guard only needs it for the admin state API)
here = os.path.dirname(os.path.abspath(__file__))
db = os.path.join(here, "..", ".dev-homeserver", "homeserver.db")
if os.path.exists(db):
c = sqlite3.connect(db); c.execute("UPDATE users SET admin=1 WHERE name=?", (alice["user_id"],)); c.commit(); c.close()
with open(os.path.join(here, "..", ".dev-homeserver", "admin.token"), "w") as f:
f.write(ta)
print(json.dumps({"room": room, "voice_room": voice, "alice": alice["user_id"], "bob": bob["user_id"], "count": n}))
if __name__ == "__main__":