d01228a21e
- gui/main.py: FastAPI app with Jinja2 templates and static files - gui/state.py: shared application state (runner, template env) - gui/services/pos_runner.py: abstracted command execution layer with subprocess, SSE streaming, and sudo support - gui/routes/: 8 route modules (dashboard, install, compose, network, vbox, system, media, ssh) - gui/templates/: Bulma-based layout with sidebar navigation + section templates for all routes - gui/static/css/style.css: dark theme styling - gui/requirements.txt: fastapi, uvicorn, jinja2, python-multipart - 1- Start_GUI.sh: entry point with sudo cache, pip install, uvicorn launch Architecture: routes delegate to pos_runner which shells out to actual pos-* scripts — no logic duplication. SSE streaming for real-time output (install, compose up/down/logs, network scan, media).
27 lines
671 B
Python
27 lines
671 B
Python
from fastapi import APIRouter, Request
|
|
from fastapi.responses import HTMLResponse
|
|
|
|
from gui.state import runner, templates
|
|
|
|
router = APIRouter(prefix="/ssh")
|
|
|
|
|
|
@router.get("", response_class=HTMLResponse)
|
|
async def ssh_page(request: Request):
|
|
code, out, err = await runner.run("pos ssh load-keys")
|
|
return templates.TemplateResponse(
|
|
"ssh/index.html",
|
|
{
|
|
"request": request,
|
|
"active": "ssh",
|
|
"output": out or err,
|
|
"code": code,
|
|
},
|
|
)
|
|
|
|
|
|
@router.post("/load")
|
|
async def ssh_load():
|
|
code, out, err = await runner.run("pos ssh load-keys")
|
|
return {"ok": code == 0, "output": out or err}
|