Ignore stream name case

This commit is contained in:
Yohann D'ANELLO 2021-02-25 17:43:37 +01:00
parent dc594d091c
commit f7cf187bac
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
1 changed files with 3 additions and 3 deletions

View File

@ -42,7 +42,7 @@ func viewerHandler(w http.ResponseWriter, r *http.Request) {
}
// Get stream ID from URL, or from domain name
path := r.URL.Path[1:]
path := strings.ToLower(r.URL.Path[1:])
host := r.Host
if strings.Contains(host, ":") {
realHost, _, err := net.SplitHostPort(r.Host)
@ -52,13 +52,13 @@ func viewerHandler(w http.ResponseWriter, r *http.Request) {
}
host = realHost
}
host = strings.ToLower(strings.Replace(host, ".", "-", -1))
host = strings.Replace(host, ".", "-", -1)
if streamID, ok := cfg.MapDomainToStream[host]; ok {
// Move home page to /about
if path == "about" {
path = ""
} else {
path = streamID
path = strings.ToLower(streamID)
}
}