forked from browserutils/kooky
-
Notifications
You must be signed in to change notification settings - Fork 0
/
find.go
42 lines (35 loc) · 961 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 netscape
import (
"github.com/etng/kooky"
"github.com/etng/kooky/internal/cookies"
"github.com/etng/kooky/internal/firefox/find"
"github.com/etng/kooky/internal/netscape"
)
type netscapeFinder struct{}
var _ kooky.CookieStoreFinder = (*netscapeFinder)(nil)
func init() {
kooky.RegisterFinder(`netscape`, &netscapeFinder{})
}
func (f *netscapeFinder) FindCookieStores() ([]kooky.CookieStore, error) {
files, err := find.FindCookieStoreFiles(netscapeRoots, `netscape`, `cookies.txt`)
if err != nil {
return nil, err
}
var ret []kooky.CookieStore
for _, file := range files {
ret = append(
ret,
&cookies.CookieJar{
CookieStore: &netscape.CookieStore{
DefaultCookieStore: cookies.DefaultCookieStore{
BrowserStr: file.Browser,
ProfileStr: file.Profile,
IsDefaultProfileBool: file.IsDefaultProfile,
FileNameStr: file.Path,
},
},
},
)
}
return ret, nil
}