2022-08-13 22:39:31 +00:00
|
|
|
package admin
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
2024-05-30 06:20:24 +00:00
|
|
|
"code.nonshy.com/nonshy/website/pkg/encryption/coldstorage"
|
2022-08-26 04:21:46 +00:00
|
|
|
"code.nonshy.com/nonshy/website/pkg/templates"
|
2022-08-13 22:39:31 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Admin dashboard or landing page (/admin).
|
|
|
|
func Dashboard() http.HandlerFunc {
|
|
|
|
tmpl := templates.Must("admin/dashboard.html")
|
|
|
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
2024-05-30 06:20:24 +00:00
|
|
|
var vars = map[string]interface{}{
|
|
|
|
"ColdStorageWarning": coldstorage.Warning(),
|
|
|
|
}
|
|
|
|
if err := tmpl.Execute(w, r, vars); err != nil {
|
2022-08-13 22:39:31 +00:00
|
|
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|