mirror of
https://github.com/binwiederhier/ntfy.git
synced 2024-11-01 01:21:15 +01:00
Fix text
This commit is contained in:
parent
e8ecd6b006
commit
9aeea4d9fa
1 changed files with 6 additions and 3 deletions
|
@ -605,8 +605,7 @@ func (s *Server) handleWebManifest(w http.ResponseWriter, _ *http.Request, _ *vi
|
||||||
{SRC: "/static/images/pwa-512x512.png", Sizes: "512x512", Type: "image/png"},
|
{SRC: "/static/images/pwa-512x512.png", Sizes: "512x512", Type: "image/png"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
w.Header().Set("Content-Type", "application/manifest+json")
|
return s.writeJSONWithContentType(w, response, "application/manifest+json")
|
||||||
return s.writeJSON(w, response)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// handleMetrics returns Prometheus metrics. This endpoint is only called if enable-metrics is set,
|
// handleMetrics returns Prometheus metrics. This endpoint is only called if enable-metrics is set,
|
||||||
|
@ -1963,7 +1962,11 @@ func (s *Server) visitor(ip netip.Addr, user *user.User) *visitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) writeJSON(w http.ResponseWriter, v any) error {
|
func (s *Server) writeJSON(w http.ResponseWriter, v any) error {
|
||||||
w.Header().Set("Content-Type", "application/json")
|
return s.writeJSONWithContentType(w, v, "application/json")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) writeJSONWithContentType(w http.ResponseWriter, v any, contentType string) error {
|
||||||
|
w.Header().Set("Content-Type", contentType)
|
||||||
w.Header().Set("Access-Control-Allow-Origin", s.config.AccessControlAllowOrigin) // CORS, allow cross-origin requests
|
w.Header().Set("Access-Control-Allow-Origin", s.config.AccessControlAllowOrigin) // CORS, allow cross-origin requests
|
||||||
if err := json.NewEncoder(w).Encode(v); err != nil {
|
if err := json.NewEncoder(w).Encode(v); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in a new issue