0

link assets under the same protocol for bots (#1187)

* link assets under the same protocol

* use // for metadata  urls
This commit is contained in:
Meisam 2021-07-18 05:28:20 +02:00 committed by GitHub
parent 19514f2a62
commit 617156b18d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -75,11 +75,11 @@ 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("http://%s%s", r.Host, r.URL.Path)) fullURL, err := url.Parse(fmt.Sprintf("//%s%s", r.Host, r.URL.Path))
if err != nil { if err != nil {
log.Panicln(err) log.Panicln(err)
} }
imageURL, err := url.Parse(fmt.Sprintf("http://%s%s", r.Host, "/logo")) imageURL, err := url.Parse(fmt.Sprintf("//%s%s", r.Host, "/logo"))
if err != nil { if err != nil {
log.Panicln(err) log.Panicln(err)
} }
@ -89,7 +89,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("http://%s%s", r.Host, "/thumbnail.jpg")) thumbnail, err := url.Parse(fmt.Sprintf("//%s%s", r.Host, "/thumbnail.jpg"))
if err != nil { if err != nil {
log.Errorln(err) log.Errorln(err)
thumbnailURL = imageURL.String() thumbnailURL = imageURL.String()