Create Progressive Web App (#4730)

* Create manifest and serviceworker

* Create templates and add AppSubUrl

* Add JSRenderer

* fix ctx type

* Add JSRenderer to static.go

* Complete adding {{AppSubUrl}}

* Add more fonts to urlsToCache

* Add 512px and 192px icons

* Hardcode font MD5

* Default theme doesn't have a specific CSS file
This commit is contained in:
SohnyBohny 2018-11-27 16:18:26 +01:00 committed by techknowlogick
parent e09fe48773
commit 294904321c
9 changed files with 152 additions and 0 deletions

View file

@ -791,6 +791,15 @@ func RegisterRoutes(m *macaron.Macaron) {
}
})
// Progressive Web App
m.Get("/manifest.json", templates.JSONRenderer(), func(ctx *context.Context) {
ctx.HTML(200, "pwa/manifest_json")
})
m.Get("/serviceworker.js", templates.JSRenderer(), func(ctx *context.Context) {
ctx.HTML(200, "pwa/serviceworker_js")
})
// prometheus metrics endpoint
if setting.Metrics.Enabled {
c := metrics.NewCollector()