feat: add Safari cookie extraction from BinaryCookies format (#566)

* feat: add Safari cookie extraction from BinaryCookies format
* fix: use expiry presence instead of current time for HasExpire
This commit is contained in:
Roger
2026-04-12 01:16:59 +08:00
committed by GitHub
parent 509cdc2468
commit 7bf1759dd9
7 changed files with 284 additions and 4 deletions
+7 -1
View File
@@ -13,11 +13,17 @@ type sourcePath struct {
isDir bool // true for directory targets
}
func file(rel string) sourcePath { return sourcePath{rel: filepath.FromSlash(rel), isDir: false} }
func file(rel string) sourcePath { return sourcePath{rel: filepath.FromSlash(rel)} }
// safariSources defines the Safari file layout.
// Each category maps to one or more candidate paths tried in priority order;
// the first existing path wins.
var safariSources = map[types.Category][]sourcePath{
types.History: {file("History.db")},
types.Cookie: {
// macOS 14+ (containerized Safari)
file("../Containers/com.apple.Safari/Data/Library/Cookies/Cookies.binarycookies"),
// macOS ≤13 (traditional path)
file("../Cookies/Cookies.binarycookies"),
},
}