feat: add GET/PATCH /api/settings endpoints

This commit is contained in:
Brian Krabach
2026-03-29 22:47:53 -07:00
parent 85d3bb1312
commit 6c72bd05cc
2 changed files with 80 additions and 0 deletions
+14
View File
@@ -57,6 +57,7 @@ from muxplex.state import (
save_state,
state_lock,
)
from muxplex.settings import load_settings, patch_settings
from muxplex.ttyd import kill_orphan_ttyd, kill_ttyd, spawn_ttyd, TTYD_PORT
# ---------------------------------------------------------------------------
@@ -426,6 +427,19 @@ async def setup_hooks() -> dict:
return {"ok": False, "error": str(e)}
@app.get("/api/settings")
async def get_settings() -> dict:
"""Return the current settings."""
return load_settings()
@app.patch("/api/settings")
async def update_settings(request: Request) -> dict:
"""Merge known keys from the request body into settings and return updated settings."""
body = await request.json()
return patch_settings(body)
# ---------------------------------------------------------------------------
# WebSocket proxy — bridges browser to ttyd (eliminates Caddy dependency)
# ---------------------------------------------------------------------------