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

Function OpenURL

internal/browser/browser.go:23–37  ·  view source on GitHub ↗

OpenURL opens the specified URL in the default web browser. It first attempts to use a platform-agnostic library and falls back to platform-specific commands if that fails. Parameters: - url: The URL to open. Returns: - An error if the URL cannot be opened, otherwise nil.

(url string)

Source from the content-addressed store, hash-verified

21// Returns:
22// - An error if the URL cannot be opened, otherwise nil.
23func OpenURL(url string) error {
24 fmt.Printf("Attempting to open URL in browser: %s\n", url)
25
26 // Try using the open-golang library first
27 err := open.Run(url)
28 if err == nil {
29 log.Debug("Successfully opened URL using open-golang library")
30 return nil
31 }
32
33 log.Debugf("open-golang failed: %v, trying platform-specific commands", err)
34
35 // Fallback to platform-specific commands
36 return openURLPlatformSpecific(url)
37}
38
39// openURLPlatformSpecific is a helper function that opens a URL using OS-specific commands.
40// This serves as a fallback mechanism for OpenURL.

Callers 6

LoginMethod · 0.92
LoginMethod · 0.92
LoginMethod · 0.92
LoginMethod · 0.92
loginWithDeviceFlowMethod · 0.92
LoginMethod · 0.92

Calls 2

openURLPlatformSpecificFunction · 0.85
RunMethod · 0.80

Tested by

no test coverage detected