MCPcopy Create free account
hub / github.com/browserwing/browserwing / fetchRemoteScripts

Function fetchRemoteScripts

backend/builtin/scripts.go:116–139  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

114}
115
116func fetchRemoteScripts() []models.Script {
117 client := &http.Client{Timeout: 10 * time.Second}
118
119 // Try index-based loading (split files, concurrent)
120 for _, base := range []string{githubBaseURL, giteeBaseURL} {
121 scripts, err := fetchFromIndex(client, base)
122 if err != nil {
123 log.Printf("[builtin] remote index unavailable (%s), trying next source...", base)
124 continue
125 }
126 return scripts
127 }
128
129 // Fallback to legacy single-file
130 for _, url := range []string{githubLegacyURL, giteeLegacyURL} {
131 scripts, err := fetchFromURL(client, url)
132 if err != nil {
133 log.Printf("[builtin] legacy source unavailable (%s), trying next...", url)
134 continue
135 }
136 return scripts
137 }
138 return nil
139}
140
141func fetchFromIndex(client *http.Client, baseURL string) ([]models.Script, error) {
142 indexURL := baseURL + "/index.json"

Callers 1

LoadBuiltinScriptsFunction · 0.85

Calls 2

fetchFromIndexFunction · 0.85
fetchFromURLFunction · 0.85

Tested by

no test coverage detected