]> source.dussan.org Git - gitea.git/commit
Move serviceworker to workbox and fix SSE interference (#11538)
authorsilverwind <me@silverwind.io>
Fri, 22 May 2020 01:45:34 +0000 (03:45 +0200)
committerGitHub <noreply@github.com>
Fri, 22 May 2020 01:45:34 +0000 (21:45 -0400)
commit88fe7b5a720365e5c8f0a347730f895263465311
tree7d9de5b5c7d78878787dbe12c40ebe97791b2b52
parentf6f49700cc0f5d66b0c1ff5dc3e310c777583e85
Move serviceworker to workbox and fix SSE interference (#11538)

* Move serviceworker to workbox and fix SSE interference

Instead of statically hardcoding every frontend asset, this uses a
type-based approach to cache all js,css and manifest.json requests.

This also fixes the issue that the service worker was interfering with
EventSource because it was unconditionally handling all requests which
this new implementation doesn't.

Fixes: https://github.com/go-gitea/gitea/issues/11092
Fixes: https://github.com/go-gitea/gitea/issues/7372
* rethrow error instead of logging

* await .register

* Revert "rethrow error instead of logging"

This reverts commit 043162ba1f18b98a4bf9635959fd28d16e839fc5.

* improve comment

* remove JSRenderer

* add version-based cache invalidation

* refactor

* more refactor

* remove comment

* rename item to fit cache name

Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
12 files changed:
.eslintrc
modules/templates/dynamic.go
modules/templates/static.go
package-lock.json
package.json
routers/routes/routes.go
templates/base/head.tmpl
templates/pwa/serviceworker_js.tmpl [deleted file]
web_src/js/features/serviceworker.js [new file with mode: 0644]
web_src/js/index.js
web_src/js/serviceworker.js [new file with mode: 0644]
webpack.config.js