Revert "Remove handling /manifest.json"

This reverts commit dadadeb0662b9725604e2db07a66c86ca8d04c30.
This commit is contained in:
Thanh Nguyen 2023-09-24 13:50:16 +07:00
parent e9676491ee
commit c32bd7e415

View File

@ -40,6 +40,7 @@ func (s *Server) handler() http.Handler {
} }
r.For("/", s.handleIndex) r.For("/", s.handleIndex)
r.For("/manifest.json", s.handleManifest)
r.For("/static/*path", s.handleStatic) r.For("/static/*path", s.handleStatic)
r.For("/api/status", s.handleStatus) r.For("/api/status", s.handleStatus)
r.For("/api/folders", s.handleFolderList) r.For("/api/folders", s.handleFolderList)
@ -78,6 +79,24 @@ func (s *Server) handleStatic(c *router.Context) {
http.StripPrefix(s.BasePath+"/static/", http.FileServer(http.FS(assets.FS))).ServeHTTP(c.Out, c.Req) http.StripPrefix(s.BasePath+"/static/", http.FileServer(http.FS(assets.FS))).ServeHTTP(c.Out, c.Req)
} }
func (s *Server) handleManifest(c *router.Context) {
c.JSON(http.StatusOK, map[string]interface{}{
"$schema": "https://json.schemastore.org/web-manifest-combined.json",
"name": "yarr!",
"short_name": "yarr",
"description": "yet another rss reader",
"display": "standalone",
"start_url": s.BasePath,
"icons": []map[string]interface{}{
{
"src": s.BasePath + "/static/graphicarts/favicon.png",
"sizes": "64x64",
"type": "image/png",
},
},
})
}
func (s *Server) handleStatus(c *router.Context) { func (s *Server) handleStatus(c *router.Context) {
c.JSON(http.StatusOK, map[string]interface{}{ c.JSON(http.StatusOK, map[string]interface{}{
"running": s.worker.FeedsPending(), "running": s.worker.FeedsPending(),