MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / buildOpenclawAllowedOrigin

Function buildOpenclawAllowedOrigin

agent/app/service/agents_utils.go:562–572  ·  view source on GitHub ↗
(scheme, host string, port int)

Source from the content-addressed store, hash-verified

560}
561
562func buildOpenclawAllowedOrigin(scheme, host string, port int) (string, error) {
563 scheme = strings.TrimSpace(strings.ToLower(scheme))
564 host = strings.TrimSpace(host)
565 if (scheme != "http" && scheme != "https") || host == "" || port <= 0 {
566 return "", fmt.Errorf("invalid openclaw allowed origin")
567 }
568 if strings.Contains(host, ":") && !strings.HasPrefix(host, "[") && strings.Count(host, ":") > 1 {
569 host = "[" + host + "]"
570 }
571 return normalizeAllowedOrigin(fmt.Sprintf("%s://%s:%d", scheme, host, port))
572}
573
574func checkAgentUpgradable(install model.AppInstall) bool {
575 if install.ID == 0 || install.Version == "" {

Calls 1

normalizeAllowedOriginFunction · 0.70

Tested by

no test coverage detected