diff --git a/project/project.go b/project/project.go
index 3d654a2..cdd0baf 100644
--- a/project/project.go
+++ b/project/project.go
@@ -46,8 +46,10 @@ func GetReleases(dbConn *sql.DB, mu *sync.Mutex, proj Project) (Project, error)
return proj, err
}
+ // TODO: figure out a clean way to remove this so the home page loads
+ // immediately.
if len(ret) == 0 {
- return fetchReleases(dbConn, mu, proj)
+ return proj, nil
}
for _, row := range ret {
diff --git a/ws/static/home.html b/ws/static/home.html
index 0a91a6d..e1d41fd 100644
--- a/ws/static/home.html
+++ b/ws/static/home.html
@@ -21,11 +21,12 @@
- {{- range . -}}
+ {{- range .Projects -}}
{{- if ne .Running (index .Releases 0).Tag -}}
Outdated projects
{{- break -}}
@@ -43,13 +44,13 @@
{{- end -}}
- {{- range . -}}
+ {{- range .Projects -}}
{{- if eq .Running (index .Releases 0).Tag -}}
Up-to-date projects
{{- break -}}
{{- end -}}
{{- end -}}
- {{- range . -}}
+ {{- range .Projects -}}
{{- if eq .Running (index .Releases 0).Tag -}}
Release notes
- {{- range . -}}
+ {{- range .Projects -}}
{{- if eq .Forge "github" "gitea" "forgejo" -}}
diff --git a/ws/ws.go b/ws/ws.go
index 8ca5050..0cb15ee 100644
--- a/ws/ws.go
+++ b/ws/ws.go
@@ -29,6 +29,12 @@ type Handler struct {
Mu *sync.Mutex
}
+type page struct {
+ Projects []project.Project
+ Message string
+ MessageType string
+}
+
//go:embed static
var fs embed.FS
@@ -51,7 +57,12 @@ func (h Handler) RootHandler(w http.ResponseWriter, r *http.Request) {
return
}
tmpl := template.Must(template.ParseFS(fs, "static/home.html"))
- if err := tmpl.Execute(w, data); err != nil {
+ p := page{
+ Projects: data,
+ Message: "Hello world",
+ MessageType: "info",
+ }
+ if err := tmpl.Execute(w, p); err != nil {
fmt.Println(err)
}
}