add a page for tickets from gitea

This commit is contained in:
Blake Ridgway
2026-04-11 13:15:22 -05:00
parent 5bc3050dd4
commit 0ba2f7af4e
11 changed files with 471 additions and 6 deletions

View File

@@ -12,6 +12,7 @@ import (
"time"
"ridgwaysystems.org/website/internal/blog"
"ridgwaysystems.org/website/internal/gitea"
"ridgwaysystems.org/website/internal/newsletter"
"ridgwaysystems.org/website/internal/ratelimit"
"ridgwaysystems.org/website/internal/status"
@@ -27,6 +28,10 @@ type Handler struct {
contactEmail string
devMode bool
postLimit *ratelimit.Limiter // rate-limits contact + newsletter POSTs
gitea *gitea.Client
giteaOwner string
giteaRepo string
giteaLabel string
}
// New creates a Handler. dataDir is the path to the data/ directory.
@@ -39,6 +44,12 @@ func New(store *blog.Store, news *newsletter.Store, dataDir string) *Handler {
contactEmail: getenv("CONTACT_EMAIL", "hire@ridgwaysystems.org"),
devMode: os.Getenv("DEV") == "1",
postLimit: ratelimit.New(10*time.Minute, 5),
giteaOwner: getenv("GITEA_OWNER", ""),
giteaRepo: getenv("GITEA_REPO", ""),
giteaLabel: getenv("GITEA_LABEL", "planned-outage"),
}
if url := os.Getenv("GITEA_URL"); url != "" {
h.gitea = gitea.New(url, os.Getenv("GITEA_TOKEN"))
}
if !h.devMode {
h.templates = mustLoadTemplates()
@@ -95,6 +106,7 @@ func mustLoadTemplates() map[string]*template.Template {
{"admin-newsletter", "templates/admin/newsletter.html"},
{"admin-changelog", "templates/admin/changelog.html"},
{"admin-changelog-editor", "templates/admin/changelog-editor.html"},
{"admin-outages", "templates/admin/outages.html"},
}
for _, p := range pages {