fix: Hide paste button when not connected via HTTPS
This commit is contained in:
parent
ffb35c3220
commit
9c98c333ad
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
required
|
||||
placeholder="Enter url here then click download"
|
||||
/>
|
||||
{{if .IsSecure}}
|
||||
<button
|
||||
id="paste-button"
|
||||
class="btn btn-outline-secondary"
|
||||
|
@ -48,6 +49,7 @@
|
|||
/>
|
||||
</svg>
|
||||
</button>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-grid">
|
||||
|
|
Loading…
Reference in New Issue