-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbrowser.go
More file actions
27 lines (24 loc) · 888 Bytes
/
Copy pathbrowser.go
File metadata and controls
27 lines (24 loc) · 888 Bytes
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
package sweetcookie
import (
"context"
"fmt"
)
func readFromBrowser(ctx context.Context, b Browser, origins []requestOrigin, opts Options) ([]Cookie, []string, error) {
profile := ""
if opts.Profiles != nil {
profile = opts.Profiles[b]
}
switch b {
case BrowserChrome, BrowserChromium, BrowserEdge, BrowserBrave, BrowserVivaldi, BrowserOpera,
BrowserArc, BrowserHelium, BrowserDia, BrowserComet, BrowserAtlas, BrowserWhale:
return readChromiumCookies(ctx, chromiumVendorForBrowser(b), profile, origins, opts)
case BrowserFirefox, BrowserZen, BrowserFloorp, BrowserWaterfox, BrowserLibreWolf:
return readFirefoxCookies(ctx, b, profile, origins, opts)
case BrowserSafari:
return readSafariCookies(ctx, profile, origins, opts)
case BrowserInline:
return nil, nil, nil
default:
return nil, []string{fmt.Sprintf("sweetcookie: unsupported browser %q", b)}, nil
}
}