From 05c511848ab9e53536ed05c8c0765ed068f0c011 Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Sun, 19 Jul 2020 18:36:04 -0700 Subject: [PATCH] Use the thumbnail for opengraph if online --- controllers/index.go | 7 ++++--- static/metadata.html | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/controllers/index.go b/controllers/index.go index 40f6bb07b..4f5ba0a17 100644 --- a/controllers/index.go +++ b/controllers/index.go @@ -58,12 +58,13 @@ func handleScraperMetadataPage(w http.ResponseWriter, r *http.Request) { tmpl := template.Must(template.ParseFiles(path.Join("static", "metadata.html"))) fullURL, err := url.Parse(fmt.Sprintf("http://%s%s", r.Host, r.URL.Path)) - imageURL, err := url.Parse(fmt.Sprintf("http://%s%s", r.Host, config.Config.InstanceDetails.Logo["large"])) - // If the thumbnail does not exist then just use the logo image + status := core.GetStatus() + + // If the thumbnail does not exist or we're offline then just use the logo image var thumbnailURL string - if utils.DoesFileExists("webroot/thumbnail.jpg") { + if status.Online && utils.DoesFileExists("webroot/thumbnail.jpg") { thumbnail, err := url.Parse(fmt.Sprintf("http://%s%s", r.Host, "/thumbnail.jpg")) if err != nil { log.Errorln(err) diff --git a/static/metadata.html b/static/metadata.html index 574bed58a..bc95ab4c9 100644 --- a/static/metadata.html +++ b/static/metadata.html @@ -14,9 +14,9 @@ - - - + + +