-
Notifications
You must be signed in to change notification settings - Fork 0
/
find.go
42 lines (35 loc) · 964 Bytes
/
find.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package firefox
import (
"github.com/dvgamerr-app/go-kooky"
"github.com/dvgamerr-app/go-kooky/internal/cookies"
"github.com/dvgamerr-app/go-kooky/internal/firefox"
"github.com/dvgamerr-app/go-kooky/internal/firefox/find"
)
type firefoxFinder struct{}
var _ kooky.CookieStoreFinder = (*firefoxFinder)(nil)
func init() {
kooky.RegisterFinder(`firefox`, &firefoxFinder{})
}
func (f *firefoxFinder) FindCookieStores() ([]kooky.CookieStore, error) {
files, err := find.FindFirefoxCookieStoreFiles()
if err != nil {
return nil, err
}
var ret []kooky.CookieStore
for _, file := range files {
ret = append(
ret,
&cookies.CookieJar{
CookieStore: &firefox.CookieStore{
DefaultCookieStore: cookies.DefaultCookieStore{
BrowserStr: file.Browser,
ProfileStr: file.Profile,
IsDefaultProfileBool: file.IsDefaultProfile,
FileNameStr: file.Path,
},
},
},
)
}
return ret, nil
}