feat(static): ✨ Add privacy policy page and route
- Implement ServePrivacyPolicy handler to serve the privacy policy. - Update index.html to include a link to the privacy policy. - Add privacy-policy.html file with content outlining data handling practices.
This commit is contained in:
@@ -31,6 +31,20 @@ func (h *Handlers) ServeIndex(w http.ResponseWriter, r *http.Request) {
|
||||
writeBytes(w, content)
|
||||
}
|
||||
|
||||
// ServePrivacyPolicy serves the privacy policy page
|
||||
func (h *Handlers) ServePrivacyPolicy(w http.ResponseWriter, r *http.Request) {
|
||||
content, err := staticFiles.ReadFile("static/privacy-policy.html")
|
||||
if err != nil {
|
||||
logging.Error("Failed to read privacy-policy.html", "error", err)
|
||||
http.Error(w, "Internal Server Error", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
writeBytes(w, content)
|
||||
}
|
||||
|
||||
// ServeStatic serves static files (logo, etc.)
|
||||
func (h *Handlers) ServeStatic(w http.ResponseWriter, r *http.Request) {
|
||||
// Get the file path from URL
|
||||
@@ -53,6 +67,8 @@ func (h *Handlers) ServeStatic(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "image/jpeg")
|
||||
case ".svg":
|
||||
w.Header().Set("Content-Type", "image/svg+xml")
|
||||
case ".html":
|
||||
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||
case ".css":
|
||||
w.Header().Set("Content-Type", "text/css")
|
||||
case ".js":
|
||||
|
||||
Reference in New Issue
Block a user