feat(cli): add archive command for cross-host data transport

Bundles each browser's decryption-relevant files + Local State into a <browser-key>/<User Data> zip (forward-slash entries) for cross-host restore.
This commit is contained in:
moonD4rk
2026-06-06 20:45:06 +08:00
parent f1219e49ab
commit 96ed041fa0
10 changed files with 420 additions and 15 deletions
+5 -2
View File
@@ -55,6 +55,7 @@ func NewBrowser(cfg types.BrowserConfig) (*Browser, error) {
func (b *Browser) SetRetrievers(r masterkey.Retrievers) { b.retrievers = r }
func (b *Browser) BrowserName() string { return b.cfg.Name }
func (b *Browser) BrowserKey() string { return b.cfg.Key }
func (b *Browser) UserDataDir() string { return b.cfg.UserDataDir }
// Profiles returns the identity of every profile in this installation.
@@ -204,9 +205,11 @@ func hasAnySource(sources map[types.Category][]sourcePath, dir string) bool {
return false
}
// resolvedPath holds the absolute path and type for a discovered source.
// resolvedPath holds the absolute path, the slash-relative source path, and the type of a discovered
// source. rel is retained (not just absPath) so archive can reproduce the User Data layout.
type resolvedPath struct {
absPath string
rel string
isDir bool
}
@@ -222,7 +225,7 @@ func resolveSourcePaths(sources map[types.Category][]sourcePath, profileDir stri
continue
}
if sp.isDir == info.IsDir() {
resolved[cat] = resolvedPath{abs, sp.isDir}
resolved[cat] = resolvedPath{absPath: abs, rel: sp.rel, isDir: sp.isDir}
break
}
}