feat: add GET/PATCH /api/settings endpoints
This commit is contained in:
@@ -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)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user