From 7d94ec0d18b46893e23680cf8438109a34cc2a10 Mon Sep 17 00:00:00 2001
From: Matthias Nott <mnott@mnsoft.org>
Date: Sun, 22 Feb 2026 16:55:03 +0100
Subject: [PATCH] feat: promote/sync/rebuild UI, operations page, bidirectional sync, lifecycle ops
---
app/routers/restore.py | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/app/routers/restore.py b/app/routers/restore.py
index d03428e..fc1e60f 100644
--- a/app/routers/restore.py
+++ b/app/routers/restore.py
@@ -21,6 +21,8 @@
env: str,
source: str,
dry_run: bool,
+ name: str | None = None,
+ mode: str = "full",
) -> AsyncGenerator[str, None]:
"""Async generator that drives the restore workflow and yields SSE events.
@@ -28,8 +30,20 @@
that use host Python venvs incompatible with the container's Python.
"""
base_args = ["restore", project, env]
+
+ # Pass the backup file path to avoid interactive selection prompt
+ if name:
+ backup_path = f"/opt/data/backups/{project}/{env}/{name}"
+ base_args.append(backup_path)
+
if dry_run:
base_args.append("--dry-run")
+
+ # Granular restore mode
+ if mode == "db":
+ base_args.append("--db-only")
+ elif mode == "wp":
+ base_args.append("--wp-only")
if source == "offsite":
# ops offsite restore <project> <env>
@@ -67,6 +81,8 @@
env: str,
source: Literal["local", "offsite"] = Query(default="local"),
dry_run: bool = Query(default=False, alias="dry_run"),
+ name: str | None = Query(default=None),
+ mode: Literal["full", "db", "wp"] = Query(default="full"),
_: str = Depends(verify_token),
) -> StreamingResponse:
"""
@@ -74,9 +90,11 @@
Uses Server-Sent Events (SSE) to stream real-time progress.
Runs on the host via nsenter for Python venv compatibility.
+
+ Modes: full (default), db (database only), wp (wp-content only).
"""
return StreamingResponse(
- _restore_generator(project, env, source, dry_run),
+ _restore_generator(project, env, source, dry_run, name, mode),
media_type="text/event-stream",
headers={
"Cache-Control": "no-cache",
--
Gitblit v1.3.1