Allow BaseURL to contain full server url, including scheme and host. Fix #2183

This commit is contained in:
Deluan
2023-02-15 21:13:38 -05:00
parent aac6e2cb07
commit 10108c63c9
8 changed files with 102 additions and 17 deletions
+2 -2
View File
@@ -41,7 +41,7 @@ func serveIndex(ds model.DataStore, fs fs.FS, shareInfo *model.Share) http.Handl
"version": consts.Version,
"firstTime": firstTime,
"variousArtistsId": consts.VariousArtistsID,
"baseURL": utils.SanitizeText(strings.TrimSuffix(conf.Server.BaseURL, "/")),
"baseURL": utils.SanitizeText(strings.TrimSuffix(conf.Server.BasePath, "/")),
"loginBackgroundURL": utils.SanitizeText(conf.Server.UILoginBackgroundURL),
"welcomeMessage": utils.SanitizeText(conf.Server.UIWelcomeMessage),
"maxSidebarPlaylists": conf.Server.MaxSidebarPlaylists,
@@ -68,7 +68,7 @@ func serveIndex(ds model.DataStore, fs fs.FS, shareInfo *model.Share) http.Handl
"defaultDownsamplingFormat": conf.Server.DefaultDownsamplingFormat,
}
if strings.HasPrefix(conf.Server.UILoginBackgroundURL, "/") {
appConfig["loginBackgroundURL"] = path.Join(conf.Server.BaseURL, conf.Server.UILoginBackgroundURL)
appConfig["loginBackgroundURL"] = path.Join(conf.Server.BasePath, conf.Server.UILoginBackgroundURL)
}
auth := handleLoginFromHeaders(ds, r)
if auth != nil {