mirror of
https://github.com/airlabspl/uptimemonitor.git
synced 2025-08-15 04:39:15 +02:00
version build
This commit is contained in:
4
.github/workflows/go.yml
vendored
4
.github/workflows/go.yml
vendored
@@ -14,10 +14,10 @@ jobs:
|
|||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: '1.24'
|
go-version: "1.24"
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o uptimemonitor ./cmd/uptimemonitor
|
run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o uptimemonitor -ldflags "-X version.Version=$(git describe --tags)" ./cmd/uptimemonitor
|
||||||
|
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
|
4
TODO.md
4
TODO.md
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
What's left to do:
|
What's left to do:
|
||||||
|
|
||||||
- [ ] Add sponsors badges (sponsors.uptimemonitor.dev api)
|
- [ ] Get app version from git tag
|
||||||
- [ ] Add documentation
|
- [ ] Add documentation
|
||||||
- [ ] Document how to install
|
- [ ] Document how to install
|
||||||
- [ ] Document webhook parsing and available variables
|
- [ ] Document webhook parsing and available variables
|
||||||
- [ ] Get app version from git tag
|
- [ ] Release 🎉
|
||||||
|
|
||||||
Optional:
|
Optional:
|
||||||
|
|
||||||
|
@@ -5,12 +5,14 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"uptimemonitor"
|
"uptimemonitor"
|
||||||
"uptimemonitor/html"
|
"uptimemonitor/html"
|
||||||
|
"uptimemonitor/pkg/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (h *Handler) HomePage() http.HandlerFunc {
|
func (h *Handler) HomePage() http.HandlerFunc {
|
||||||
tmpl := template.Must(template.ParseFS(html.FS, "layout.html", "app.html", "home.html"))
|
tmpl := template.Must(template.ParseFS(html.FS, "layout.html", "app.html", "home.html"))
|
||||||
|
|
||||||
type data struct {
|
type data struct {
|
||||||
|
Version string
|
||||||
User uptimemonitor.User
|
User uptimemonitor.User
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,6 +24,7 @@ func (h *Handler) HomePage() http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tmpl.Execute(w, data{
|
tmpl.Execute(w, data{
|
||||||
|
Version: version.Version,
|
||||||
User: getUserFromRequest(r),
|
User: getUserFromRequest(r),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@@ -7,6 +7,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"uptimemonitor"
|
"uptimemonitor"
|
||||||
"uptimemonitor/html"
|
"uptimemonitor/html"
|
||||||
|
"uptimemonitor/pkg/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (h *Handler) ListIncidents() http.HandlerFunc {
|
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"))
|
tmpl := template.Must(template.ParseFS(html.FS, "layout.html", "app.html", "incident.html"))
|
||||||
|
|
||||||
type data struct {
|
type data struct {
|
||||||
|
Version string
|
||||||
User uptimemonitor.User
|
User uptimemonitor.User
|
||||||
Incident uptimemonitor.Incident
|
Incident uptimemonitor.Incident
|
||||||
Monitor uptimemonitor.Monitor
|
Monitor uptimemonitor.Monitor
|
||||||
@@ -72,6 +74,7 @@ func (h *Handler) IncidentPage() http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tmpl.Execute(w, data{
|
tmpl.Execute(w, data{
|
||||||
|
Version: version.Version,
|
||||||
User: getUserFromRequest(r),
|
User: getUserFromRequest(r),
|
||||||
Incident: incident,
|
Incident: incident,
|
||||||
Monitor: incident.Monitor,
|
Monitor: incident.Monitor,
|
||||||
|
@@ -7,12 +7,14 @@ import (
|
|||||||
"uptimemonitor"
|
"uptimemonitor"
|
||||||
"uptimemonitor/form"
|
"uptimemonitor/form"
|
||||||
"uptimemonitor/html"
|
"uptimemonitor/html"
|
||||||
|
"uptimemonitor/pkg/version"
|
||||||
|
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (h *Handler) LoginPage() http.HandlerFunc {
|
func (h *Handler) LoginPage() http.HandlerFunc {
|
||||||
type data struct {
|
type data struct {
|
||||||
|
Version string
|
||||||
Form form.LoginForm
|
Form form.LoginForm
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -20,6 +22,7 @@ func (h *Handler) LoginPage() http.HandlerFunc {
|
|||||||
|
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
tmpl.Execute(w, data{
|
tmpl.Execute(w, data{
|
||||||
|
Version: version.Version,
|
||||||
Form: form.LoginForm{},
|
Form: form.LoginForm{},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@@ -8,6 +8,7 @@ import (
|
|||||||
"uptimemonitor"
|
"uptimemonitor"
|
||||||
"uptimemonitor/form"
|
"uptimemonitor/form"
|
||||||
"uptimemonitor/html"
|
"uptimemonitor/html"
|
||||||
|
"uptimemonitor/pkg/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (h *Handler) ListMonitors() http.HandlerFunc {
|
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"))
|
tmpl := template.Must(template.ParseFS(html.FS, "layout.html", "app.html", "new.html"))
|
||||||
|
|
||||||
type data struct {
|
type data struct {
|
||||||
|
Version string
|
||||||
Form form.MonitorForm
|
Form form.MonitorForm
|
||||||
User uptimemonitor.User
|
User uptimemonitor.User
|
||||||
}
|
}
|
||||||
|
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
tmpl.Execute(w, data{
|
tmpl.Execute(w, data{
|
||||||
|
Version: version.Version,
|
||||||
Form: form.MonitorForm{
|
Form: form.MonitorForm{
|
||||||
HttpHeaders: `{
|
HttpHeaders: `{
|
||||||
"Content-Type": "application/json"
|
"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"))
|
tmpl := template.Must(template.ParseFS(html.FS, "layout.html", "app.html", "monitor.html"))
|
||||||
|
|
||||||
type data struct {
|
type data struct {
|
||||||
|
Version string
|
||||||
Monitor uptimemonitor.Monitor
|
Monitor uptimemonitor.Monitor
|
||||||
Skeletons []int
|
Skeletons []int
|
||||||
User uptimemonitor.User
|
User uptimemonitor.User
|
||||||
@@ -137,6 +141,7 @@ func (h *Handler) MonitorPage() http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tmpl.Execute(w, data{
|
tmpl.Execute(w, data{
|
||||||
|
Version: version.Version,
|
||||||
Monitor: m,
|
Monitor: m,
|
||||||
Skeletons: make([]int, 60),
|
Skeletons: make([]int, 60),
|
||||||
User: getUserFromRequest(r),
|
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"))
|
tmpl := template.Must(template.ParseFS(html.FS, "layout.html", "app.html", "edit.html"))
|
||||||
|
|
||||||
type data struct {
|
type data struct {
|
||||||
|
Version string
|
||||||
Form form.MonitorForm
|
Form form.MonitorForm
|
||||||
User uptimemonitor.User
|
User uptimemonitor.User
|
||||||
Monitor uptimemonitor.Monitor
|
Monitor uptimemonitor.Monitor
|
||||||
@@ -255,6 +261,7 @@ func (h *Handler) EditMonitorPage() http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tmpl.Execute(w, data{
|
tmpl.Execute(w, data{
|
||||||
|
Version: version.Version,
|
||||||
Monitor: m,
|
Monitor: m,
|
||||||
Form: f,
|
Form: f,
|
||||||
User: getUserFromRequest(r),
|
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"))
|
tmpl := template.Must(template.ParseFS(html.FS, "layout.html", "app.html", "delete.html"))
|
||||||
|
|
||||||
type data struct {
|
type data struct {
|
||||||
|
Version string
|
||||||
User uptimemonitor.User
|
User uptimemonitor.User
|
||||||
Monitor uptimemonitor.Monitor
|
Monitor uptimemonitor.Monitor
|
||||||
}
|
}
|
||||||
@@ -375,6 +383,7 @@ func (h *Handler) DeleteMonitorPage() http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tmpl.Execute(w, data{
|
tmpl.Execute(w, data{
|
||||||
|
Version: version.Version,
|
||||||
User: getUserFromRequest(r),
|
User: getUserFromRequest(r),
|
||||||
Monitor: m,
|
Monitor: m,
|
||||||
})
|
})
|
||||||
|
@@ -7,12 +7,14 @@ import (
|
|||||||
"uptimemonitor"
|
"uptimemonitor"
|
||||||
"uptimemonitor/form"
|
"uptimemonitor/form"
|
||||||
"uptimemonitor/html"
|
"uptimemonitor/html"
|
||||||
|
"uptimemonitor/pkg/version"
|
||||||
|
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (h *Handler) SetupPage() http.HandlerFunc {
|
func (h *Handler) SetupPage() http.HandlerFunc {
|
||||||
type data struct {
|
type data struct {
|
||||||
|
Version string
|
||||||
Form form.SetupForm
|
Form form.SetupForm
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,6 +33,7 @@ func (h *Handler) SetupPage() http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tmpl.Execute(w, data{
|
tmpl.Execute(w, data{
|
||||||
|
Version: version.Version,
|
||||||
Form: form.SetupForm{},
|
Form: form.SetupForm{},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@@ -8,6 +8,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
"uptimemonitor"
|
"uptimemonitor"
|
||||||
"uptimemonitor/html"
|
"uptimemonitor/html"
|
||||||
|
"uptimemonitor/pkg/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
var initialSponsors = []uptimemonitor.Sponsor{
|
var initialSponsors = []uptimemonitor.Sponsor{
|
||||||
@@ -61,7 +62,11 @@ func (*Handler) ListSponsors() http.HandlerFunc {
|
|||||||
|
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
if r.Header.Get("HX-Request") != "true" {
|
if r.Header.Get("HX-Request") != "true" {
|
||||||
layout.ExecuteTemplate(w, "sponsors", nil)
|
layout.ExecuteTemplate(w, "sponsors", struct {
|
||||||
|
Version string
|
||||||
|
}{
|
||||||
|
Version: version.Version,
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -31,15 +31,15 @@
|
|||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
<span class="">
|
<span class="">
|
||||||
UM {{ template "version" . }}
|
UM
|
||||||
|
|
||||||
|
{{ with .Version }}
|
||||||
|
<span class="text-neutral-400 text-xs font-normal truncate">{{ . }}</span>
|
||||||
|
{{ end }}
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ define "version" }}
|
|
||||||
<span class="text-neutral-400 text-xs font-normal truncate">v0.5.0-alpha</span>
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ define "sponsors" }}
|
{{ define "sponsors" }}
|
||||||
<div hx-get="/sponsors" hx-trigger="intersect" hx-swap="outerHTML"></div>
|
<div hx-get="/sponsors" hx-trigger="intersect" hx-swap="outerHTML"></div>
|
||||||
{{ end }}
|
{{ end }}
|
3
pkg/version/version.go
Normal file
3
pkg/version/version.go
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
package version
|
||||||
|
|
||||||
|
var Version string = "dev"
|
Reference in New Issue
Block a user