1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2024-11-25 20:59:36 +01:00

The last commit

This commit is contained in:
binwiederhier 2023-06-20 21:46:09 -04:00
parent 141565d9d2
commit 271056a4aa
2 changed files with 13 additions and 18 deletions

View file

@ -589,29 +589,24 @@ func (s *Server) handleWebConfig(w http.ResponseWriter, _ *http.Request, _ *visi
return err return err
} }
// handleWebManifest serves the web app manifest for the progressive web app (PWA)
func (s *Server) handleWebManifest(w http.ResponseWriter, _ *http.Request, _ *visitor) error { func (s *Server) handleWebManifest(w http.ResponseWriter, _ *http.Request, _ *visitor) error {
response := &webManifestResponse{ response := &webManifestResponse{
Name: "ntfy web", Name: "ntfy web",
Description: "ntfy lets you send push notifications via scripts from any computer or phone. Made with ❤ by Philipp C. Heckel, Apache License 2.0, source at https://heckel.io/ntfy.", Description: "ntfy lets you send push notifications via scripts from any computer or phone",
ShortName: "ntfy", ShortName: "ntfy",
Scope: "/", Scope: "/",
StartURL: s.config.WebRoot, StartURL: s.config.WebRoot,
Display: "standalone", Display: "standalone",
BackgroundColor: "#ffffff", BackgroundColor: "#ffffff",
ThemeColor: "#317f6f", ThemeColor: "#317f6f",
Icons: []webManifestIcon{ Icons: []*webManifestIcon{
{SRC: "/static/images/pwa-192x192.png", Sizes: "192x192", Type: "image/png"}, {SRC: "/static/images/pwa-192x192.png", Sizes: "192x192", Type: "image/png"},
{SRC: "/static/images/pwa-512x512.png", Sizes: "512x512", Type: "image/png"}, {SRC: "/static/images/pwa-512x512.png", Sizes: "512x512", Type: "image/png"},
}, },
} }
err := s.writeJSON(w, response)
if err != nil {
return err
}
w.Header().Set("Content-Type", "application/manifest+json") w.Header().Set("Content-Type", "application/manifest+json")
return nil 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,

View file

@ -529,7 +529,7 @@ type webManifestResponse struct {
Display string `json:"display"` Display string `json:"display"`
BackgroundColor string `json:"background_color"` BackgroundColor string `json:"background_color"`
ThemeColor string `json:"theme_color"` ThemeColor string `json:"theme_color"`
Icons []webManifestIcon `json:"icons"` Icons []*webManifestIcon `json:"icons"`
} }
type webManifestIcon struct { type webManifestIcon struct {