A community based topic aggregation platform built on atproto
1package routes
2
3import (
4 "net/http"
5
6 "github.com/go-chi/chi/v5"
7
8 "Coves/internal/atproto/oauth"
9 "Coves/internal/core/users"
10 "Coves/internal/web"
11)
12
13// RegisterWebRoutes registers all web page routes for the Coves frontend.
14// This includes the landing page, account deletion flow, and static assets.
15func RegisterWebRoutes(r chi.Router, oauthClient *oauth.OAuthClient, userService users.UserService) {
16 // Initialize templates
17 templates, err := web.NewTemplates()
18 if err != nil {
19 panic("failed to load web templates: " + err.Error())
20 }
21
22 // Create handlers
23 handlers := web.NewHandlers(templates, oauthClient, userService)
24
25 // Landing page
26 r.Get("/", handlers.LandingHandler)
27
28 // Account deletion flow
29 r.Get("/delete-account", handlers.DeleteAccountPageHandler)
30 r.Post("/delete-account", handlers.DeleteAccountSubmitHandler)
31 r.Get("/delete-account/success", handlers.DeleteAccountSuccessHandler)
32
33 // Legal pages
34 r.Get("/privacy", handlers.PrivacyHandler)
35
36 // Safety pages
37 r.Get("/safety/child-safety", handlers.ChildSafetyHandler)
38
39 // Static files (images, etc.)
40 r.Get("/static/*", func(w http.ResponseWriter, r *http.Request) {
41 // Serve from project's static directory
42 fs := http.StripPrefix("/static/", http.FileServer(http.Dir("static")))
43 fs.ServeHTTP(w, r)
44 })
45}