feat: add chromium for windows

pull/121/head
ᴍᴏᴏɴD4ʀᴋ 3 years ago
parent 53656a8726
commit a499c3ca0f
  1. 3
      go.mod
  2. 7
      go.sum
  3. 12
      internal/browser/browser.go
  4. 124
      internal/browser/browser_windows.go

@ -4,8 +4,10 @@ go 1.18
require (
github.com/gocarina/gocsv v0.0.0-20211203214250-4735fba0c1d9
github.com/godbus/dbus v4.1.0+incompatible
github.com/json-iterator/go v1.1.12
github.com/mattn/go-sqlite3 v1.14.9
github.com/ppacher/go-dbus-keyring v1.0.1
github.com/tidwall/gjson v1.9.3
github.com/urfave/cli/v2 v2.4.0
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3
@ -13,6 +15,7 @@ require (
require (
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect

@ -6,6 +6,11 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/gocarina/gocsv v0.0.0-20211203214250-4735fba0c1d9 h1:ptTza/LLPmfRtmz77X+6J61Wyf5e1hz5xYMvRk/hkE4=
github.com/gocarina/gocsv v0.0.0-20211203214250-4735fba0c1d9/go.mod h1:5YoVOkjYAQumqlV356Hj3xeYh4BdZuLE0/nRkf2NKkI=
github.com/godbus/dbus v4.1.0+incompatible h1:WqqLRTsQic3apZUK9qC5sGNfXthmPXzUZ7nQPrNITa4=
github.com/godbus/dbus v4.1.0+incompatible/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw=
github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
@ -18,6 +23,8 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/ppacher/go-dbus-keyring v1.0.1 h1:dM4dMfP5w9MxY+foFHCQiN7izEGpFdKr3tZeMGmvqD0=
github.com/ppacher/go-dbus-keyring v1.0.1/go.mod h1:JEmkRwBVPBFkOHedAsoZALWmhNJxR/R/ykkFpbEHtGE=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=

@ -72,6 +72,7 @@ func pickFirefox(name string) []Browser {
if name == "all" || name == "firefox" {
for _, v := range firefoxList {
multiFirefox, err := firefox.New(v.name, v.storage, v.profilePath, v.items)
// TODO: Handle error
if err != nil {
panic(err)
}
@ -105,11 +106,6 @@ const (
chromeBetaName = "Chrome Beta"
chromiumName = "Chromium"
edgeName = "Microsoft Edge"
firefoxName = "Firefox"
firefoxBetaName = "Firefox Beta"
firefoxDevName = "Firefox Dev"
firefoxNightlyName = "Firefox Nightly"
firefoxESRName = "Firefox ESR"
speed360Name = "360speed"
qqBrowserName = "QQ"
braveName = "Brave"
@ -118,4 +114,10 @@ const (
vivaldiName = "Vivaldi"
coccocName = "CocCoc"
yandexName = "Yandex"
firefoxName = "Firefox"
firefoxBetaName = "Firefox Beta"
firefoxDevName = "Firefox Dev"
firefoxNightlyName = "Firefox Nightly"
firefoxESRName = "Firefox ESR"
)

@ -3,70 +3,104 @@
package browser
import (
item2 "hack-browser-data/internal/item"
"hack-browser-data/internal/item"
)
var (
chromiumList = map[string]struct {
browserInfo *browserInfo
items []item2.Item
name string
profilePath string
storage string
items []item.Item
}{
"chrome": {
browserInfo: chromeInfo,
items: defaultChromiumItems,
name: chromeName,
profilePath: chromeProfilePath,
items: item.DefaultChromium,
},
"edge": {
browserInfo: edgeInfo,
items: defaultChromiumItems,
name: edgeName,
profilePath: edgeProfilePath,
items: item.DefaultChromium,
},
"chromium": {
name: chromiumName,
profilePath: chromiumProfilePath,
items: item.DefaultChromium,
},
"chrome-beta": {
name: chromeBetaName,
profilePath: chromeBetaProfilePath,
items: item.DefaultChromium,
},
"opera": {
name: operaName,
profilePath: operaProfilePath,
items: item.DefaultChromium,
},
"opera-gx": {
name: operaGXName,
profilePath: operaGXProfilePath,
items: item.DefaultChromium,
},
"vivaldi": {
name: vivaldiName,
profilePath: vivaldiProfilePath,
items: item.DefaultChromium,
},
"coccoc": {
name: coccocName,
profilePath: coccocProfilePath,
items: item.DefaultChromium,
},
"brave": {
name: braveName,
profilePath: braveProfilePath,
items: item.DefaultChromium,
},
"yandex": {
browserInfo: yandexInfo,
items: defaultYandexItems,
name: yandexName,
profilePath: yandexProfilePath,
items: item.DefaultYandex,
},
"360": {
name: speed360Name,
profilePath: speed360ProfilePath,
items: item.DefaultChromium,
},
"qq": {
name: qqBrowserName,
profilePath: qqBrowserProfilePath,
items: item.DefaultChromium,
},
}
firefoxList = map[string]struct {
browserInfo *browserInfo
items []item2.Item
name string
storage string
profilePath string
items []item.Item
}{
"firefox": {
browserInfo: firefoxInfo,
items: defaultFirefoxItems,
},
}
)
var (
chromeInfo = &browserInfo{
name: chromeName,
profilePath: chromeProfilePath,
}
edgeInfo = &browserInfo{
name: edgeName,
profilePath: edgeProfilePath,
}
yandexInfo = &browserInfo{
name: yandexName,
profilePath: edgeProfilePath,
}
firefoxInfo = &browserInfo{
name: firefoxName,
profilePath: firefoxProfilePath,
items: item.DefaultFirefox,
},
}
)
const (
chromeProfilePath = "/AppData/Local/Google/Chrome/User Data/"
chromeBetaProfilePath = "/AppData/Local/Google/Chrome Beta/User Data/"
chromiumProfilePath = "/AppData/Local/Chromium/User Data/"
edgeProfilePath = "/AppData/Local/Microsoft/Edge/User Data/"
braveProfilePath = "/AppData/Local/BraveSoftware/Brave-Browser/User Data/"
speed360ProfilePath = "/AppData/Local/360chrome/Chrome/User Data/"
qqBrowserProfilePath = "/AppData/Local/Tencent/QQBrowser/User Data/"
operaProfilePath = "/AppData/Roaming/Opera Software/Opera Stable/"
operaGXProfilePath = "/AppData/Roaming/Opera Software/Opera GX Stable/"
vivaldiProfilePath = "/AppData/Local/Vivaldi/User Data/Default/"
coccocProfilePath = "/AppData/Local/CocCoc/Browser/User Data/Default/"
yandexProfilePath = "/AppData/Local/Yandex/YandexBrowser/User Data/Default"
var (
chromeProfilePath = homeDir + "/AppData/Local/Google/Chrome/User Data/"
chromeBetaProfilePath = homeDir + "/AppData/Local/Google/Chrome Beta/User Data/"
chromiumProfilePath = homeDir + "/AppData/Local/Chromium/User Data/"
edgeProfilePath = homeDir + "/AppData/Local/Microsoft/Edge/User Data/"
braveProfilePath = homeDir + "/AppData/Local/BraveSoftware/Brave-Browser/User Data/"
speed360ProfilePath = homeDir + "/AppData/Local/360chrome/Chrome/User Data/"
qqBrowserProfilePath = homeDir + "/AppData/Local/Tencent/QQBrowser/User Data/"
operaProfilePath = homeDir + "/AppData/Roaming/Opera Software/Opera Stable/"
operaGXProfilePath = homeDir + "/AppData/Roaming/Opera Software/Opera GX Stable/"
vivaldiProfilePath = homeDir + "/AppData/Local/Vivaldi/User Data/Default/"
coccocProfilePath = homeDir + "/AppData/Local/CocCoc/Browser/User Data/Default/"
yandexProfilePath = homeDir + "/AppData/Local/Yandex/YandexBrowser/User Data/Default"
firefoxProfilePath = "/AppData/Roaming/Mozilla/Firefox/Profiles"
firefoxProfilePath = homeDir + "/AppData/Roaming/Mozilla/Firefox/Profiles/"
)

Loading…
Cancel
Save