Feat: add VPS export functionality and import JSON feature in UI
All checks were successful
Build and Push Docker Images / docker (push) Successful in 28s

This commit is contained in:
jeanotx32
2026-06-02 19:23:54 -04:00
parent f2e5a24b37
commit 2a46fcd13a
7 changed files with 187 additions and 56 deletions

View File

@@ -727,6 +727,23 @@ def edit_vps(vps_id: str, body: VpsUpdateRequest, _: Annotated[dict, Depends(get
return {"status": "ok"}
@app.get("/api/vps/{vps_id}/export")
def export_vps(vps_id: str, _: Annotated[dict, Depends(get_current_user)]):
"""Exporte la configuration complète d'un VPS (y compris la clé API) pour import ailleurs."""
vps = next((v for v in load_vps() if v["id"] == vps_id), None)
if not vps:
raise HTTPException(status_code=404, detail="VPS introuvable")
return {
"id": vps["id"],
"name": vps["name"],
"host": vps["host"],
"port": vps["port"],
"api_key": vps["api_key"],
"description": vps.get("description", ""),
"tags": vps.get("tags", []),
}
@app.get("/api/vps/{vps_id}/stats")
def get_vps_stats(
vps_id: str,