23 lines
528 B
Go
23 lines
528 B
Go
package handlers
|
|
|
|
import (
|
|
"html/template"
|
|
"net/http"
|
|
|
|
"lash"
|
|
)
|
|
|
|
type ShareData struct {
|
|
Version string
|
|
FileName string
|
|
}
|
|
|
|
func (h *ShareData) Handler(w http.ResponseWriter, r *http.Request) {
|
|
// Although `Must` can fail since `Templates` is embeded these files will always exist.
|
|
tmpl := template.Must(template.ParseFS(lash.Templates, "templates/share.html"))
|
|
|
|
if err := tmpl.ExecuteTemplate(w, "share.html", h); err != nil {
|
|
http.Error(w, "template render error: "+err.Error(), http.StatusInternalServerError)
|
|
}
|
|
}
|