From 9c98c333ad640424eaf5de45ec13ae1eaced7a89 Mon Sep 17 00:00:00 2001 From: Evan Fiordeliso Date: Wed, 16 Aug 2023 11:33:15 -0400 Subject: [PATCH] fix: Hide paste button when not connected via HTTPS --- app/controllers/home.go | 3 +++ app/views/index.html | 2 ++ 2 files changed, 5 insertions(+) diff --git a/app/controllers/home.go b/app/controllers/home.go index e9392d5..8373805 100644 --- a/app/controllers/home.go +++ b/app/controllers/home.go @@ -31,6 +31,7 @@ func (c *HomeController) Router(r chi.Router) { func (c *HomeController) Index(w http.ResponseWriter, r *http.Request) { hx := htmx.New(w, r) + isSecure := r.URL.Scheme == "https" if hx.IsHtmxRequest() { hx.PushUrl("/") @@ -40,6 +41,7 @@ func (c *HomeController) Index(w http.ResponseWriter, r *http.Request) { "Version": version.Version, "Build": version.Build, "BinaryVersion": c.ytdl.Version(), + "IsSecure": isSecure, }) } else { app.Views.Render(w, "index", view.Data{ @@ -47,6 +49,7 @@ func (c *HomeController) Index(w http.ResponseWriter, r *http.Request) { "Version": version.Version, "Build": version.Build, "BinaryVersion": c.ytdl.Version(), + "IsSecure": isSecure, }, "layouts/main") } } diff --git a/app/views/index.html b/app/views/index.html index fc57eae..8a9385f 100644 --- a/app/views/index.html +++ b/app/views/index.html @@ -27,6 +27,7 @@ required placeholder="Enter url here then click download" /> + {{if .IsSecure}} + {{end}}