diff options
Diffstat (limited to 'packages/meshbay-node/src/meshbay_node')
| -rw-r--r-- | packages/meshbay-node/src/meshbay_node/ui/app.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/packages/meshbay-node/src/meshbay_node/ui/app.py b/packages/meshbay-node/src/meshbay_node/ui/app.py index ef86ce3..130c59e 100644 --- a/packages/meshbay-node/src/meshbay_node/ui/app.py +++ b/packages/meshbay-node/src/meshbay_node/ui/app.py @@ -434,6 +434,33 @@ def create_ui_app(state: dict) -> FastAPI: raise HTTPException(400, "apps must be a non-empty list") return await _op(lambda: ops.set_enabled_apps(state, group_id, apps)) + # ── App directories (operator only, localhost) ──────────────────────── + # + # The loopback twin of the `app_directories` MNP op. One endpoint for every + # application, keyed by the app's own name, so adding one needs no route + # here — the same reason the op is generic. `ALLOWED_APPS` is checked on + # the MNP path; here the caller is already on localhost holding the run + # token, and `ops` refuses a directory outside the group's roots either + # way, so an unknown key writes one unread settings row and nothing else. + + @app.put("/api/groups/{group_id}/app-directories/{app_key}") + async def set_app_directories(group_id: str, app_key: str, payload: dict): + dirs = payload.get("directories") + if not isinstance(dirs, list): + raise HTTPException(400, "directories must be a list") + return await _op(lambda: ops.set_app_directories( + state, group_id, app_key, [str(d) for d in dirs])) + + @app.put("/api/groups/{group_id}/chat-directory") + async def set_chat_directory(group_id: str, payload: dict): + return await _op(lambda: ops.set_chat_directory( + state, group_id, str(payload.get("path") or ""))) + + @app.put("/api/groups/{group_id}/chat-link-preview") + async def set_chat_link_preview(group_id: str, payload: dict): + return await _op(lambda: ops.set_chat_link_preview( + state, group_id, bool(payload.get("enabled", True)))) + # ── Scan settings (operator only, localhost) ────────────────────────── @app.put("/api/groups/{group_id}/scan-settings") |