MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / GetPlatformInfo

Function GetPlatformInfo

internal/browser/browser.go:119–146  ·  view source on GitHub ↗

GetPlatformInfo returns a map containing details about the current platform's browser opening capabilities, including the OS, architecture, and available commands. Returns: - A map with platform-specific browser support information.

()

Source from the content-addressed store, hash-verified

117// Returns:
118// - A map with platform-specific browser support information.
119func GetPlatformInfo() map[string]interface{} {
120 info := map[string]interface{}{
121 "os": runtime.GOOS,
122 "arch": runtime.GOARCH,
123 "available": IsAvailable(),
124 }
125
126 switch runtime.GOOS {
127 case "darwin":
128 info["default_command"] = "open"
129 case "windows":
130 info["default_command"] = "rundll32"
131 case "linux":
132 browsers := []string{"xdg-open", "x-www-browser", "www-browser", "firefox", "chromium", "google-chrome"}
133 var availableBrowsers []string
134 for _, browser := range browsers {
135 if _, err := exec.LookPath(browser); err == nil {
136 availableBrowsers = append(availableBrowsers, browser)
137 }
138 }
139 info["available_browsers"] = availableBrowsers
140 if len(availableBrowsers) > 0 {
141 info["default_command"] = availableBrowsers[0]
142 }
143 }
144
145 return info
146}

Callers

nothing calls this directly

Calls 1

IsAvailableFunction · 0.85

Tested by

no test coverage detected