mirror of
https://github.com/miniflux/v2.git
synced 2025-06-27 16:36:00 +00:00
PWA: First implementation of offline mode
This commit is contained in:
parent
05f7a34d43
commit
925ea2c082
10 changed files with 1851 additions and 1076 deletions
|
@ -31,7 +31,19 @@ func (h *handler) showJavascript(w http.ResponseWriter, r *http.Request) {
|
|||
contents := static.JavascriptBundles[filename]
|
||||
|
||||
if filename == "service-worker" {
|
||||
variables := fmt.Sprintf(`const OFFLINE_URL=%q;`, route.Path(h.router, "offline"))
|
||||
user, err := h.store.UserByID(request.UserID(r))
|
||||
if err != nil {
|
||||
html.ServerError(w, r, err)
|
||||
return
|
||||
}
|
||||
|
||||
cacheForOffline := 0
|
||||
if user.CacheForOffline {
|
||||
cacheForOffline = 1
|
||||
}
|
||||
|
||||
variables := fmt.Sprintf(`const OFFLINE_URL=%q;const USE_CACHE=%d;`, route.Path(h.router, "offline"), cacheForOffline)
|
||||
|
||||
contents = append([]byte(variables), contents...)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue