From 92158da5ea4ea66a48d30d92498908e31c65b126 Mon Sep 17 00:00:00 2001 From: inference-bot Date: Sat, 3 Oct 2026 10:48:18 -0600 Subject: [PATCH] =?UTF-8?q?Dashboard:=20Matrix=20chat=20card=20=E2=80=94?= =?UTF-8?q?=20self-serve=20one=20extra=20federated=20MXID=20below=20API=20?= =?UTF-8?q?keys?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/main.py | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/app/main.py b/app/main.py index 285260d..ee9e700 100644 --- a/app/main.py +++ b/app/main.py @@ -159,6 +159,30 @@ async def api_revoke_key(name: str, request: Request): return JSONResponse({"error": e.detail}, status_code=e.status_code) +@app.get("/api/matrix-mxid") +async def api_get_matrix_mxid(request: Request): + identity = get_user_identity(request) + if not identity: + return JSONResponse({"error": "unauthenticated"}, status_code=401) + try: + return await broker_get(identity, "/broker/matrix-mxid") + except HTTPException as e: + return JSONResponse({"error": e.detail}, status_code=e.status_code) + + +@app.post("/api/matrix-mxid") +async def api_set_matrix_mxid(request: Request): + identity = get_user_identity(request) + if not identity: + return JSONResponse({"error": "unauthenticated"}, status_code=401) + body = await request.json() + mxid = (body.get("matrix_mxid") or "").strip() + try: + return await broker_post(identity, "/broker/matrix-mxid", {"matrix_mxid": mxid}) + except HTTPException as e: + return JSONResponse({"error": e.detail}, status_code=e.status_code) + + # --------------------------------------------------------------------------- # OIDC routes — authorization-code flow against Cloudron's OIDC provider. # Active only when the `oidc` addon is configured (CLOUDRON_OIDC_* present). @@ -532,6 +556,16 @@ PAGE_HTML = """ + +
+

Matrix chat

+

You're invited to the co-op's Matrix space at your co-op account (@you:inference.coop). Prefer to use an existing account on another server instead? Add it below (one account).

+
+ + +
+
+