controller: Tier-3 rename — customer-facing 'NAS-mentés' branding becomes 'Távoli mentés' (backups page, offbox flashes, quota copy); manual-target form generalized to any SFTP target; offbox_rename_gate.py enforces zero regressions

Claude-Session: https://claude.ai/code/session_01GzammAMzsJTgpQHqxwM2bC
This commit is contained in:
2026-07-13 08:23:43 +02:00
parent 8987ce0f67
commit a00afcc79d
4 changed files with 83 additions and 26 deletions
+11 -11
View File
@@ -44,7 +44,7 @@ func (s *Server) offboxConfigHandler(w http.ResponseWriter, r *http.Request) {
knownHosts := r.FormValue("known_hosts")
if host == "" || user == "" || repoPath == "" {
offboxRedirect(w, r, "A NAS címe, a felhasználó és a tárhely útvonala kötelező.", true)
offboxRedirect(w, r, "A cél címe, a felhasználó és a tárhely útvonala kötelező.", true)
return
}
if !strings.HasPrefix(repoPath, "/") {
@@ -60,7 +60,7 @@ func (s *Server) offboxConfigHandler(w http.ResponseWriter, r *http.Request) {
// First-time config requires the SSH key + a pinned known-host line (no blind TOFU).
existing := s.backupMgr.OffboxConfigured()
if !existing && (strings.TrimSpace(sshKey) == "" || strings.TrimSpace(knownHosts) == "") {
offboxRedirect(w, r, "Az első beállításhoz az SSH privát kulcs és a NAS ismert-host sora is kötelező.", true)
offboxRedirect(w, r, "Az első beállításhoz az SSH privát kulcs és a célgép ismert-host sora is kötelező.", true)
return
}
@@ -105,7 +105,7 @@ func (s *Server) offboxConfigHandler(w http.ResponseWriter, r *http.Request) {
return
}
s.logger.Printf("[INFO] [web] off-box target configured: %s@%s:%s (port %d, enabled=%v, escrow=%s)", user, host, repoPath, port, tgt.Enabled, tgt.EscrowState)
offboxRedirect(w, r, "A NAS mentési cél elmentve."+stageErr, stageErr != "")
offboxRedirect(w, r, "A távoli mentési cél elmentve."+stageErr, stageErr != "")
}
// offboxConfirmEscrowHandler marks the offsite repo password as escrowed under R (fork-4).
@@ -115,7 +115,7 @@ func (s *Server) offboxConfigHandler(w http.ResponseWriter, r *http.Request) {
// no restic_pw_sha256 and can never auto-confirm; the operator vouches by hand after a verified ceremony.
func (s *Server) offboxConfirmEscrowHandler(w http.ResponseWriter, r *http.Request) {
if s.backupMgr == nil || !s.backupMgr.OffboxConfigured() {
offboxRedirect(w, r, "A NAS mentési cél nincs beállítva.", true)
offboxRedirect(w, r, "A távoli mentési cél nincs beállítva.", true)
return
}
if err := s.settings.UpdateOffboxStatus(func(o *settings.OffboxTarget) { o.EscrowState = "escrowed" }); err != nil {
@@ -129,7 +129,7 @@ func (s *Server) offboxConfirmEscrowHandler(w http.ResponseWriter, r *http.Reque
if err := s.wipeStagedEscrow(r.Context()); err != nil {
s.logger.Printf("[ERROR] [web] escrow confirmed but the agent-staged secret was NOT wiped (re-confirm to retry): %v", err)
}
offboxRedirect(w, r, "A kulcs letétbe helyezése megerősítve — a NAS-mentés mostantól futhat.", false)
offboxRedirect(w, r, "A kulcs letétbe helyezése megerősítve — a távoli mentés mostantól futhat.", false)
}
// wipeStagedEscrow calls the injected seam (tests), else the agent's DELETE /escrow/stage-secret over the
@@ -183,18 +183,18 @@ func (s *Server) offboxToggleHandler(w http.ResponseWriter, r *http.Request) {
offboxRedirect(w, r, "A beállítás mentése sikertelen.", true)
return
}
offboxRedirect(w, r, "A NAS-mentés beállítása frissítve.", false)
offboxRedirect(w, r, "A távoli mentés beállítása frissítve.", false)
}
// offboxRunHandler triggers an off-box backup now (async — it can run for minutes).
func (s *Server) offboxRunHandler(w http.ResponseWriter, r *http.Request) {
if s.backupMgr == nil || !s.backupMgr.OffboxConfigured() {
offboxRedirect(w, r, "A NAS mentési cél nincs beállítva.", true)
offboxRedirect(w, r, "A távoli mentési cél nincs beállítva.", true)
return
}
// fork-4 atomicity: refuse the run until the repo password is escrowed under R.
if !s.backupMgr.OffboxRunnable() {
offboxRedirect(w, r, "A NAS-mentés a kulcs letétbe helyezésére vár.", true)
offboxRedirect(w, r, "A távoli mentés a kulcs letétbe helyezésére vár.", true)
return
}
go func() {
@@ -204,14 +204,14 @@ func (s *Server) offboxRunHandler(w http.ResponseWriter, r *http.Request) {
s.logger.Printf("[WARN] [web] manual off-box backup failed: %v", err)
}
}()
offboxRedirect(w, r, "A NAS-mentés elindult (a futás után az állapot frissül).", false)
offboxRedirect(w, r, "A távoli mentés elindult (a futás után az állapot frissül).", false)
}
// offboxRestoreHandler restores an app's off-box data to a scratch dir (non-destructive — does NOT
// overwrite live data; the operator inspects the restored files).
func (s *Server) offboxRestoreHandler(w http.ResponseWriter, r *http.Request) {
if s.backupMgr == nil || !s.backupMgr.OffboxConfigured() {
offboxRedirect(w, r, "A NAS mentési cél nincs beállítva.", true)
offboxRedirect(w, r, "A távoli mentési cél nincs beállítva.", true)
return
}
_ = r.ParseForm()
@@ -240,5 +240,5 @@ func (s *Server) offboxRestoreHandler(w http.ResponseWriter, r *http.Request) {
s.logger.Printf("[INFO] [web] off-box restore %s completed (async) → %s", app, dest)
s.backupMgr.EndRestoreOp(true, "A(z) "+app+" visszaállítva ide (ellenőrzésre): "+dest)
}()
offboxRedirect(w, r, "A NAS-visszaállítás elindult — az állapot itt frissül.", false)
offboxRedirect(w, r, "A távoli visszaállítás elindult — az állapot itt frissül.", false)
}