feat(web): C2 Parts 2+3 — POST /backup/tier2/restore + "Fájlok visszaállítása" button
- Endpoint next to /backup/restore; handler mirrors backupRestoreHandler (ParseForm → validStackName → backupMgr guard → WARN with RemoteAddr → RestoreTier2Files → flash). Flash strings: "<stack>: N fájl visszaállítva a másodlagos másolatból." / "Nincs hiányzó fájl — minden fájl megvan a helyén." / "Fájl-visszaállítás sikertelen: <err>" (refusals carry the Hungarian reasons from the engine). - backups.html: the button on the healthy Tier-2 layer row only (the Tier2Configured branch already excludes disconnected/inactive; additionally gated on Tier2LastRun), inline POST form with CSRF + confirm dialog naming the additive-only semantics and the last-copy timestamp. Template gates (id + emoji) green. - Handler guard test (C6): traversal/empty → exact Hungarian flash, no work started (nil backupMgr would panic if reached). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PSK5g6qYLknKj8u3QAFEr6
This commit is contained in:
@@ -299,6 +299,9 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
http.Redirect(w, r, "/storage/attach", http.StatusMovedPermanently)
|
||||
case path == "/backup/restore" && r.Method == http.MethodPost:
|
||||
s.backupRestoreHandler(w, r)
|
||||
// C2: in-place, additive-only file restore from the Tier-2 copy (class-C user files)
|
||||
case path == "/backup/tier2/restore" && r.Method == http.MethodPost:
|
||||
s.backupTier2RestoreHandler(w, r)
|
||||
// Off-box (NAS) restic-SFTP backup (Part B)
|
||||
case path == "/backup/offbox/config" && r.Method == http.MethodPost:
|
||||
s.offboxConfigHandler(w, r)
|
||||
|
||||
Reference in New Issue
Block a user