forked from browserutils/kooky
-
Notifications
You must be signed in to change notification settings - Fork 0
/
find.go
43 lines (33 loc) · 942 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
43
//go:build linux || freebsd || openbsd || netbsd || dragonfly || solaris
package dillo
import (
"os"
"path/filepath"
"github.com/jeremy-cxf/kooky"
"github.com/jeremy-cxf/kooky/internal/cookies"
"github.com/jeremy-cxf/kooky/internal/netscape"
)
type dilloFinder struct{}
var _ kooky.CookieStoreFinder = (*dilloFinder)(nil)
func init() {
kooky.RegisterFinder(`dillo`, &dilloFinder{})
}
func (f *dilloFinder) FindCookieStores() ([]kooky.CookieStore, error) {
// https://www.dillo.org/FAQ.html#q16
// https://www.dillo.org/Cookies.txt
home, err := os.UserHomeDir()
if err != nil {
return nil, err
}
var ret = []kooky.CookieStore{
&cookies.CookieJar{
CookieStore: &netscape.CookieStore{
DefaultCookieStore: cookies.DefaultCookieStore{
BrowserStr: `dillo`,
IsDefaultProfileBool: true,
FileNameStr: filepath.Join(home, `.dillo`, `cookies.txt`),
},
},
}}
return ret, nil
}