browser

package
v0.26.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChromeKey            string = "CHROME"
	BraveKey             string = "BRAVE"
	EdgeKey              string = "EDGE"
	FirefoxKey           string = "FIREFOX"
	WaterfoxKey          string = "WATERFOX"
	ChromiumKey          string = "CHROMIUM"
	SafariKey            string = "SAFARI"
	StdoutKey            string = "STDOUT"
	FirefoxStdoutKey     string = "FIREFOX_STDOUT"
	ArcKey               string = "ARC"
	FirefoxDevEditionKey string = "FIREFOX_DEV"
	CommonFateKey        string = "COMMON_FATE"
)

A browser supported by Granted.

Variables

View Source
var ArcPathMac = []string{"/Applications/Arc.app/Contents/MacOS/Arc"}
View Source
var BravePathLinux = []string{`/usr/bin/brave-browser`, `/../../mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe`}
View Source
var BravePathMac = []string{"/Applications/Brave Browser.app/Contents/MacOS/Brave Browser"}
View Source
var BravePathWindows = []string{`\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe`}
View Source
var ChromePathLinux = []string{`/usr/bin/google-chrome`, `/../../mnt/c/Program Files/Google/Chrome/Application/chrome.exe`, `/../../mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe`}
View Source
var ChromePathMac = []string{"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"}

A few default paths to check for the browser

View Source
var ChromePathWindows = []string{`\Program Files\Google\Chrome\Application\chrome.exe`, `\Program Files (x86)\Google\Chrome\Application\chrome.exe`}
View Source
var ChromiumPathLinux = []string{`/usr/bin/chromium`, `/../../mnt/c/Program Files/Chromium/chromium.exe`}
View Source
var ChromiumPathMac = []string{"/Applications/Chromium.app/Contents/MacOS/Chromium"}
View Source
var ChromiumPathWindows = []string{`\Program Files\Chromium\chromium.exe`}
View Source
var EdgePathLinux = []string{`/usr/bin/edge`, `/../../mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe`}
View Source
var EdgePathMac = []string{"/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge"}
View Source
var EdgePathWindows = []string{`\Program Files (x86)\Microsoft\Edge\Application\msedge.exe`}
View Source
var FirefoxDevPathLinux = []string{`/usr/bin/firefox-developer`, `/../../mnt/c/Program Files/Firefox Developer Edition/firefox.exe`}
View Source
var FirefoxDevPathMac = []string{"/Applications/Firefox Developer Edition.app/Contents/MacOS/firefox"}
View Source
var FirefoxDevPathWindows = []string{`\Program Files\Firefox Developer Edition\firefox.exe`}
View Source
var FirefoxPathLinux = []string{`/usr/bin/firefox`, `/../../mnt/c/Program Files/Mozilla Firefox/firefox.exe`}
View Source
var FirefoxPathMac = []string{"/Applications/Firefox.app/Contents/MacOS/firefox"}
View Source
var FirefoxPathWindows = []string{`\Program Files\Mozilla Firefox\firefox.exe`}
View Source
var SafariPathMac = []string{"/Applications/Safari.app/Contents/MacOS/Safari"}
View Source
var WaterfoxPathLinux = []string{`/usr/bin/waterfox`, `/../../mnt/c/Program Files/Waterfox/waterfox.exe`}
View Source
var WaterfoxPathMac = []string{"/Applications/Waterfox.app/Contents/MacOS/waterfox"}
View Source
var WaterfoxPathWindows = []string{`\Program Files\Waterfox\waterfox.exe`}

Functions

func ArcPathDefaults added in v0.16.0

func ArcPathDefaults() ([]string, error)

func AskAndGetBrowserPath

func AskAndGetBrowserPath() (string, error)

func BravePathDefaults

func BravePathDefaults() ([]string, error)

func ChromePathDefaults

func ChromePathDefaults() ([]string, error)

func ChromiumPathDefaults

func ChromiumPathDefaults() ([]string, error)

func ConfigureBrowserSelection

func ConfigureBrowserSelection(browserName string, path string) error

ConfigureBrowserSelection will verify the existance of the browser executable and promot for a path if it cannot be found

func DetectInstallation

func DetectInstallation(browserKey string) (string, bool)

DetectInstallation checks if the default filepath exists for the browser executables on the current os returns the detected path

func EdgePathDefaults

func EdgePathDefaults() ([]string, error)

func Find

func Find() (string, error)

finds out which browser the user has as default

func FirefoxDevPathDefaults added in v0.16.0

func FirefoxDevPathDefaults() ([]string, error)

func FirefoxPathDefaults

func FirefoxPathDefaults() ([]string, error)

func GetBrowserKey

func GetBrowserKey(b string) string

func GrantedIntroduction

func GrantedIntroduction()

func HandleBrowserWizard

func HandleBrowserWizard(ctx *cli.Context) (string, error)

func HandleLinuxBrowserSearch

func HandleLinuxBrowserSearch() (string, error)

func HandleManualBrowserSelection

func HandleManualBrowserSelection() (string, error)

func HandleOSXBrowserSearch

func HandleOSXBrowserSearch() (string, error)

func HandleWindowsBrowserSearch

func HandleWindowsBrowserSearch() (string, error)

func OpenCommand added in v0.3.1

func OpenCommand() string

OpenCommand returns the terminal command to open a browser. This is system dependent - for MacOS we use 'open', whereas for Linux we use 'xdg-open', 'x-www-browser', or 'www-browser'.

func RunFirefoxExtensionPrompts

func RunFirefoxExtensionPrompts(browserPath string, browserName string) error

func SSOBrowser

func SSOBrowser(grantedDefaultBrowser string) error

func SafariPathDefaults added in v0.9.0

func SafariPathDefaults() ([]string, error)

func UserHasDefaultBrowser

func UserHasDefaultBrowser(ctx *cli.Context) (bool, error)

Checks the config to see if the user has already set up their default browser

func WaterfoxPathDefaults added in v0.19.0

func WaterfoxPathDefaults() ([]string, error)

Types

type Array

type Array struct {
	// XMLName xml.Name `xml:"array"`
	Dict Dict `xml:"dict"`
}

type Dict

type Dict struct {
	// XMLName xml.Name `xml:"dict"`
	Key     []string `xml:"key"`
	Dict    IntDict  `xml:"dict"`
	Strings []string `xml:"string"`
}

type IntDict

type IntDict struct {
	// XMLName xml.Name `xml:"dict"`
	Key     string `xml:"key"`
	Strings string `xml:"string"`
}

type Pdict

type Pdict struct {
	// XMLName xml.Name `xml:"dict"`
	Key   string `xml:"key"`
	Array Array  `xml:"array"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL