mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-18 18:04:17 +00:00
20 lines
486 B
Go
20 lines
486 B
Go
package install
|
|
|
|
import "strings"
|
|
|
|
func isGitHubLikeHost(host string) bool {
|
|
host = strings.ToLower(strings.TrimSpace(host))
|
|
return strings.Contains(host, "github") || strings.HasSuffix(host, ".ghe.com")
|
|
}
|
|
|
|
func gitHubAPIBaseForHost(host string) string {
|
|
host = strings.ToLower(strings.TrimSpace(host))
|
|
if host == "github.com" {
|
|
return "https://api.github.com"
|
|
}
|
|
if strings.HasSuffix(host, ".ghe.com") {
|
|
return "https://api." + host
|
|
}
|
|
return "https://" + host + "/api/v3"
|
|
}
|