1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-07-02 16:38:37 +00:00

Add basic PWA offline page

- Remove feed_icons cache because it's causing more problems that it solve.
- Add basic offline mode when using the service worker.
- Starting in Chrome 93, offline mode is going to be a requirement to install the PWA.

https://developer.chrome.com/blog/improved-pwa-offline-detection/#enforcement-starting-chrome-93-august-2021
This commit is contained in:
Frédéric Guillot 2021-03-07 15:25:34 -08:00 committed by fguillot
parent ae13b4e420
commit 8a812cd8ec
20 changed files with 141 additions and 14 deletions

View file

@ -24,6 +24,9 @@ var commonTemplateFiles embed.FS
//go:embed templates/views/*.html
var viewTemplateFiles embed.FS
//go:embed templates/standalone/*.html
var standaloneTemplateFiles embed.FS
// Engine handles the templating system.
type Engine struct {
templates map[string]*template.Template
@ -75,6 +78,22 @@ func (e *Engine) ParseTemplates() error {
e.templates[templateName] = template.Must(template.New("main").Funcs(e.funcMap.Map()).Parse(templateContents.String()))
}
dirEntries, err = standaloneTemplateFiles.ReadDir("templates/standalone")
if err != nil {
return err
}
for _, dirEntry := range dirEntries {
templateName := dirEntry.Name()
fileData, err := standaloneTemplateFiles.ReadFile("templates/standalone/" + dirEntry.Name())
if err != nil {
return err
}
logger.Debug("[Template] Parsing: %s", templateName)
e.templates[templateName] = template.Must(template.New("base").Funcs(e.funcMap.Map()).Parse(string(fileData)))
}
return nil
}