mirror of
https://github.com/owncast/owncast.git
synced 2024-10-10 19:16:02 +00:00
Override default protocol if one is set in settings (#1226)
* Default to http but use the protocol set in settings if available * Add missing instance of the protocol
This commit is contained in:
parent
44d6a36b77
commit
4715598d7e
@ -75,11 +75,19 @@ func IndexHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
func handleScraperMetadataPage(w http.ResponseWriter, r *http.Request) {
|
func handleScraperMetadataPage(w http.ResponseWriter, r *http.Request) {
|
||||||
tmpl := template.Must(template.ParseFiles(path.Join("static", "metadata.html")))
|
tmpl := template.Must(template.ParseFiles(path.Join("static", "metadata.html")))
|
||||||
|
|
||||||
fullURL, err := url.Parse(fmt.Sprintf("//%s%s", r.Host, r.URL.Path))
|
scheme := "http"
|
||||||
|
|
||||||
|
if siteUrl := data.GetServerURL(); siteUrl != "" {
|
||||||
|
if parsed, err := url.Parse(siteUrl); err == nil && parsed.Scheme != "" {
|
||||||
|
scheme = parsed.Scheme
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fullURL, err := url.Parse(fmt.Sprintf("%s://%s%s", scheme, r.Host, r.URL.Path))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Panicln(err)
|
log.Panicln(err)
|
||||||
}
|
}
|
||||||
imageURL, err := url.Parse(fmt.Sprintf("//%s%s", r.Host, "/logo"))
|
imageURL, err := url.Parse(fmt.Sprintf("%s://%s%s", scheme, r.Host, "/logo"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Panicln(err)
|
log.Panicln(err)
|
||||||
}
|
}
|
||||||
@ -89,7 +97,7 @@ func handleScraperMetadataPage(w http.ResponseWriter, r *http.Request) {
|
|||||||
// If the thumbnail does not exist or we're offline then just use the logo image
|
// If the thumbnail does not exist or we're offline then just use the logo image
|
||||||
var thumbnailURL string
|
var thumbnailURL string
|
||||||
if status.Online && utils.DoesFileExists(filepath.Join(config.WebRoot, "thumbnail.jpg")) {
|
if status.Online && utils.DoesFileExists(filepath.Join(config.WebRoot, "thumbnail.jpg")) {
|
||||||
thumbnail, err := url.Parse(fmt.Sprintf("//%s%s", r.Host, "/thumbnail.jpg"))
|
thumbnail, err := url.Parse(fmt.Sprintf("%s//%s%s", scheme, r.Host, "/thumbnail.jpg"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorln(err)
|
log.Errorln(err)
|
||||||
thumbnailURL = imageURL.String()
|
thumbnailURL = imageURL.String()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user