1
0
mirror of https://gitlab.crans.org/nounous/ghostream.git synced 2024-12-22 11:32:19 +00:00

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

View File

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