feat(http): add imprint url

This commit is contained in:
2026-06-24 11:37:20 +02:00
parent 748b83f4a0
commit 959a4edc32
2 changed files with 17 additions and 5 deletions
+13 -4
View File
@@ -3,16 +3,14 @@ package http
import (
"net/http"
assets "tomatentum.net/outfit-voting-abi26"
"tomatentum.net/outfit-voting-abi26/internal/auth"
"tomatentum.net/outfit-voting-abi26/internal/http/vote"
)
var mux *http.ServeMux = http.NewServeMux()
func Start() error {
mux.Handle("/", auth.AuthMiddleware(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
}))
func Start(imprintURL string) error {
mux.HandleFunc("/api/auth/logout", auth.LogoutEndpoint)
mux.HandleFunc("GET /api/vote/locked", vote.VoteLockedEndpoint)
@@ -31,6 +29,17 @@ func Start() error {
mux.Handle("POST /api/vote", auth.AuthMiddleware(vote.AddVoteEntryEndpoint))
mux.Handle("POST /api/vote/bulk", auth.AuthMiddleware(vote.BulkVoteEntryEndpoint))
mux.HandleFunc("/impressum", func(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, imprintURL, http.StatusFound)
})
mux.Handle("/", assets.HttpServer())
mux.Handle("/admin", auth.AuthMiddleware(assets.ServeIndex))
mux.HandleFunc("/result", assets.ServeIndex)
mux.HandleFunc("/account", func(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, auth.IssuerBaseURL(), http.StatusFound)
})
auth.CallbackHandler(mux)
return http.ListenAndServe(":4000", corsMiddleware(mux))
}