Add frontend backup upload and list-based restore with validation.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-02 16:03:18 +08:00
parent 481086eddc
commit 9379bc4f4f
7 changed files with 726 additions and 68 deletions
+26
View File
@@ -0,0 +1,26 @@
# Copyright (c) 2025-2026 马建军. All rights reserved.
"""Detached restore worker — survives pm2 stop of the parent web process."""
from __future__ import annotations
import sys
from pathlib import Path
def main(argv: list[str] | None = None) -> int:
args = argv if argv is not None else sys.argv[1:]
if len(args) != 1:
print("usage: python -m modules.backup.restore_job <backup.tar.gz>", file=sys.stderr)
return 2
archive = Path(args[0]).resolve()
if not archive.is_file():
print(f"backup not found: {archive}", file=sys.stderr)
return 1
from modules.backup.db_backup import run_restore_job
run_restore_job(archive)
return 0
if __name__ == "__main__":
raise SystemExit(main())