mirror of
https://github.com/airlabspl/uptimemonitor.git
synced 2025-08-15 04:39:15 +02:00
version build
This commit is contained in:
@@ -5,13 +5,15 @@ import (
|
||||
"net/http"
|
||||
"uptimemonitor"
|
||||
"uptimemonitor/html"
|
||||
"uptimemonitor/pkg/version"
|
||||
)
|
||||
|
||||
func (h *Handler) HomePage() http.HandlerFunc {
|
||||
tmpl := template.Must(template.ParseFS(html.FS, "layout.html", "app.html", "home.html"))
|
||||
|
||||
type data struct {
|
||||
User uptimemonitor.User
|
||||
Version string
|
||||
User uptimemonitor.User
|
||||
}
|
||||
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -22,7 +24,8 @@ func (h *Handler) HomePage() http.HandlerFunc {
|
||||
}
|
||||
|
||||
tmpl.Execute(w, data{
|
||||
User: getUserFromRequest(r),
|
||||
Version: version.Version,
|
||||
User: getUserFromRequest(r),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@@ -7,6 +7,7 @@ import (
|
||||
"strconv"
|
||||
"uptimemonitor"
|
||||
"uptimemonitor/html"
|
||||
"uptimemonitor/pkg/version"
|
||||
)
|
||||
|
||||
func (h *Handler) ListIncidents() http.HandlerFunc {
|
||||
@@ -53,6 +54,7 @@ func (h *Handler) IncidentPage() http.HandlerFunc {
|
||||
tmpl := template.Must(template.ParseFS(html.FS, "layout.html", "app.html", "incident.html"))
|
||||
|
||||
type data struct {
|
||||
Version string
|
||||
User uptimemonitor.User
|
||||
Incident uptimemonitor.Incident
|
||||
Monitor uptimemonitor.Monitor
|
||||
@@ -72,6 +74,7 @@ func (h *Handler) IncidentPage() http.HandlerFunc {
|
||||
}
|
||||
|
||||
tmpl.Execute(w, data{
|
||||
Version: version.Version,
|
||||
User: getUserFromRequest(r),
|
||||
Incident: incident,
|
||||
Monitor: incident.Monitor,
|
||||
|
@@ -7,20 +7,23 @@ import (
|
||||
"uptimemonitor"
|
||||
"uptimemonitor/form"
|
||||
"uptimemonitor/html"
|
||||
"uptimemonitor/pkg/version"
|
||||
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
)
|
||||
|
||||
func (h *Handler) LoginPage() http.HandlerFunc {
|
||||
type data struct {
|
||||
Form form.LoginForm
|
||||
Version string
|
||||
Form form.LoginForm
|
||||
}
|
||||
|
||||
tmpl := template.Must(template.ParseFS(html.FS, "layout.html", "login.html"))
|
||||
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
tmpl.Execute(w, data{
|
||||
Form: form.LoginForm{},
|
||||
Version: version.Version,
|
||||
Form: form.LoginForm{},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@@ -8,6 +8,7 @@ import (
|
||||
"uptimemonitor"
|
||||
"uptimemonitor/form"
|
||||
"uptimemonitor/html"
|
||||
"uptimemonitor/pkg/version"
|
||||
)
|
||||
|
||||
func (h *Handler) ListMonitors() http.HandlerFunc {
|
||||
@@ -36,12 +37,14 @@ func (h *Handler) CreateMonitorPage() http.HandlerFunc {
|
||||
tmpl := template.Must(template.ParseFS(html.FS, "layout.html", "app.html", "new.html"))
|
||||
|
||||
type data struct {
|
||||
Form form.MonitorForm
|
||||
User uptimemonitor.User
|
||||
Version string
|
||||
Form form.MonitorForm
|
||||
User uptimemonitor.User
|
||||
}
|
||||
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
tmpl.Execute(w, data{
|
||||
Version: version.Version,
|
||||
Form: form.MonitorForm{
|
||||
HttpHeaders: `{
|
||||
"Content-Type": "application/json"
|
||||
@@ -124,6 +127,7 @@ func (h *Handler) MonitorPage() http.HandlerFunc {
|
||||
tmpl := template.Must(template.ParseFS(html.FS, "layout.html", "app.html", "monitor.html"))
|
||||
|
||||
type data struct {
|
||||
Version string
|
||||
Monitor uptimemonitor.Monitor
|
||||
Skeletons []int
|
||||
User uptimemonitor.User
|
||||
@@ -137,6 +141,7 @@ func (h *Handler) MonitorPage() http.HandlerFunc {
|
||||
}
|
||||
|
||||
tmpl.Execute(w, data{
|
||||
Version: version.Version,
|
||||
Monitor: m,
|
||||
Skeletons: make([]int, 60),
|
||||
User: getUserFromRequest(r),
|
||||
@@ -220,6 +225,7 @@ func (h *Handler) EditMonitorPage() http.HandlerFunc {
|
||||
tmpl := template.Must(template.ParseFS(html.FS, "layout.html", "app.html", "edit.html"))
|
||||
|
||||
type data struct {
|
||||
Version string
|
||||
Form form.MonitorForm
|
||||
User uptimemonitor.User
|
||||
Monitor uptimemonitor.Monitor
|
||||
@@ -255,6 +261,7 @@ func (h *Handler) EditMonitorPage() http.HandlerFunc {
|
||||
}
|
||||
|
||||
tmpl.Execute(w, data{
|
||||
Version: version.Version,
|
||||
Monitor: m,
|
||||
Form: f,
|
||||
User: getUserFromRequest(r),
|
||||
@@ -362,6 +369,7 @@ func (h *Handler) DeleteMonitorPage() http.HandlerFunc {
|
||||
tmpl := template.Must(template.ParseFS(html.FS, "layout.html", "app.html", "delete.html"))
|
||||
|
||||
type data struct {
|
||||
Version string
|
||||
User uptimemonitor.User
|
||||
Monitor uptimemonitor.Monitor
|
||||
}
|
||||
@@ -375,6 +383,7 @@ func (h *Handler) DeleteMonitorPage() http.HandlerFunc {
|
||||
}
|
||||
|
||||
tmpl.Execute(w, data{
|
||||
Version: version.Version,
|
||||
User: getUserFromRequest(r),
|
||||
Monitor: m,
|
||||
})
|
||||
|
@@ -7,13 +7,15 @@ import (
|
||||
"uptimemonitor"
|
||||
"uptimemonitor/form"
|
||||
"uptimemonitor/html"
|
||||
"uptimemonitor/pkg/version"
|
||||
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
)
|
||||
|
||||
func (h *Handler) SetupPage() http.HandlerFunc {
|
||||
type data struct {
|
||||
Form form.SetupForm
|
||||
Version string
|
||||
Form form.SetupForm
|
||||
}
|
||||
|
||||
tmpl := template.Must(template.ParseFS(html.FS, "layout.html", "setup.html"))
|
||||
@@ -31,7 +33,8 @@ func (h *Handler) SetupPage() http.HandlerFunc {
|
||||
}
|
||||
|
||||
tmpl.Execute(w, data{
|
||||
Form: form.SetupForm{},
|
||||
Version: version.Version,
|
||||
Form: form.SetupForm{},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@@ -8,6 +8,7 @@ import (
|
||||
"time"
|
||||
"uptimemonitor"
|
||||
"uptimemonitor/html"
|
||||
"uptimemonitor/pkg/version"
|
||||
)
|
||||
|
||||
var initialSponsors = []uptimemonitor.Sponsor{
|
||||
@@ -61,7 +62,11 @@ func (*Handler) ListSponsors() http.HandlerFunc {
|
||||
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Header.Get("HX-Request") != "true" {
|
||||
layout.ExecuteTemplate(w, "sponsors", nil)
|
||||
layout.ExecuteTemplate(w, "sponsors", struct {
|
||||
Version string
|
||||
}{
|
||||
Version: version.Version,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user