hibiscus/info.go

31 lines
647 B
Go
Raw Normal View History

2024-05-07 13:27:11 +03:00
package main
import (
"html/template"
"log/slog"
"net/http"
)
var infoTemplate = template.Must(template.New("").Funcs(templateFuncs).ParseFiles("./pages/base.html", "./pages/info.html"))
type HibiscusInfo struct {
Version string
SourceLink string
}
// Info contains app information
var Info = HibiscusInfo{
2024-05-07 14:55:11 +03:00
Version: "0.2.0",
2024-05-07 13:27:11 +03:00
SourceLink: "https://git.a71.su/Andrew71/hibiscus",
}
// GetInfo renders the info page
func GetInfo(w http.ResponseWriter, r *http.Request) {
err := infoTemplate.ExecuteTemplate(w, "base", Info)
if err != nil {
slog.Error("error executing template", "error", err)
InternalError(w, r)
return
}
}