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) {
|
func (c *HomeController) Index(w http.ResponseWriter, r *http.Request) {
|
||||||
hx := htmx.New(w, r)
|
hx := htmx.New(w, r)
|
||||||
|
isSecure := r.URL.Scheme == "https"
|
||||||
|
|
||||||
if hx.IsHtmxRequest() {
|
if hx.IsHtmxRequest() {
|
||||||
hx.PushUrl("/")
|
hx.PushUrl("/")
|
||||||
|
@ -40,6 +41,7 @@ func (c *HomeController) Index(w http.ResponseWriter, r *http.Request) {
|
||||||
"Version": version.Version,
|
"Version": version.Version,
|
||||||
"Build": version.Build,
|
"Build": version.Build,
|
||||||
"BinaryVersion": c.ytdl.Version(),
|
"BinaryVersion": c.ytdl.Version(),
|
||||||
|
"IsSecure": isSecure,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
app.Views.Render(w, "index", view.Data{
|
app.Views.Render(w, "index", view.Data{
|
||||||
|
@ -47,6 +49,7 @@ func (c *HomeController) Index(w http.ResponseWriter, r *http.Request) {
|
||||||
"Version": version.Version,
|
"Version": version.Version,
|
||||||
"Build": version.Build,
|
"Build": version.Build,
|
||||||
"BinaryVersion": c.ytdl.Version(),
|
"BinaryVersion": c.ytdl.Version(),
|
||||||
|
"IsSecure": isSecure,
|
||||||
}, "layouts/main")
|
}, "layouts/main")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
required
|
required
|
||||||
placeholder="Enter url here then click download"
|
placeholder="Enter url here then click download"
|
||||||
/>
|
/>
|
||||||
|
{{if .IsSecure}}
|
||||||
<button
|
<button
|
||||||
id="paste-button"
|
id="paste-button"
|
||||||
class="btn btn-outline-secondary"
|
class="btn btn-outline-secondary"
|
||||||
|
@ -48,6 +49,7 @@
|
||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-grid">
|
<div class="d-grid">
|
||||||
|
|
Loading…
Reference in New Issue