|
|
@ -14,38 +14,38 @@ import ( |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
const ( |
|
|
|
const ( |
|
|
|
chromeDir = "/AppData/Local/Google/Chrome/User Data/*/" |
|
|
|
chromeProfilePath = "/AppData/Local/Google/Chrome/User Data/*/" |
|
|
|
chromeKeyFile = "/AppData/Local/Google/Chrome/User Data/Local State" |
|
|
|
chromeKeyPath = "/AppData/Local/Google/Chrome/User Data/Local State" |
|
|
|
edgeDir = "/AppData/Local/Microsoft/Edge/User Data/*/" |
|
|
|
edgeProfilePath = "/AppData/Local/Microsoft/Edge/User Data/*/" |
|
|
|
edgeKeyFile = "/AppData/Local/Microsoft/Edge/User Data/Local State" |
|
|
|
edgeKeyPath = "/AppData/Local/Microsoft/Edge/User Data/Local State" |
|
|
|
speed360Dir = "/AppData/Local/360chrome/Chrome/User Data/*/" |
|
|
|
speed360ProfilePath = "/AppData/Local/360chrome/Chrome/User Data/*/" |
|
|
|
speed360KeyFile = "" |
|
|
|
speed360KeyPath = "" |
|
|
|
qqBrowserDir = "/AppData/Local/Tencent/QQBrowser/User Data/*/" |
|
|
|
qqBrowserProfilePath = "/AppData/Local/Tencent/QQBrowser/User Data/*/" |
|
|
|
qqBrowserKeyFile = "" |
|
|
|
qqBrowserKeyPath = "" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
var ( |
|
|
|
var ( |
|
|
|
chromeKey []byte |
|
|
|
chromeKey []byte |
|
|
|
|
|
|
|
|
|
|
|
browserList = map[string]struct { |
|
|
|
browserList = map[string]struct { |
|
|
|
Dir string |
|
|
|
ProfilePath string |
|
|
|
Key string |
|
|
|
KeyPath string |
|
|
|
}{ |
|
|
|
}{ |
|
|
|
"chrome": { |
|
|
|
"chrome": { |
|
|
|
chromeDir, |
|
|
|
chromeProfilePath, |
|
|
|
chromeKeyFile, |
|
|
|
chromeKeyPath, |
|
|
|
}, |
|
|
|
}, |
|
|
|
"edge": { |
|
|
|
"edge": { |
|
|
|
edgeDir, |
|
|
|
edgeProfilePath, |
|
|
|
edgeKeyFile, |
|
|
|
edgeKeyPath, |
|
|
|
}, |
|
|
|
}, |
|
|
|
"360speed": { |
|
|
|
"360speed": { |
|
|
|
speed360Dir, |
|
|
|
speed360ProfilePath, |
|
|
|
speed360KeyFile, |
|
|
|
speed360KeyPath, |
|
|
|
}, |
|
|
|
}, |
|
|
|
"qq": { |
|
|
|
"qq": { |
|
|
|
qqBrowserDir, |
|
|
|
qqBrowserProfilePath, |
|
|
|
qqBrowserKeyFile, |
|
|
|
qqBrowserKeyPath, |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
) |
|
|
|
) |
|
|
@ -53,10 +53,10 @@ var ( |
|
|
|
func PickBrowser(name string) (browserDir, key string, err error) { |
|
|
|
func PickBrowser(name string) (browserDir, key string, err error) { |
|
|
|
name = strings.ToLower(name) |
|
|
|
name = strings.ToLower(name) |
|
|
|
if choice, ok := browserList[name]; ok { |
|
|
|
if choice, ok := browserList[name]; ok { |
|
|
|
if choice.Key != "" { |
|
|
|
if choice.KeyPath != "" { |
|
|
|
return os.Getenv("USERPROFILE") + choice.Dir, os.Getenv("USERPROFILE") + choice.Key, nil |
|
|
|
return os.Getenv("USERPROFILE") + choice.ProfilePath, os.Getenv("USERPROFILE") + choice.KeyPath, nil |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return os.Getenv("USERPROFILE") + choice.Dir, "", nil |
|
|
|
return os.Getenv("USERPROFILE") + choice.ProfilePath, "", nil |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return "", "", errBrowserNotSupported |
|
|
|
return "", "", errBrowserNotSupported |
|
|
|