Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate serviceworker caching manifest generation #11092

Closed
silverwind opened this issue Apr 16, 2020 · 0 comments · Fixed by #11538
Closed

Automate serviceworker caching manifest generation #11092

silverwind opened this issue Apr 16, 2020 · 0 comments · Fixed by #11538
Labels
topic/build PR changes how Gitea is built, i.e. regarding Docker or the Makefile type/enhancement An improvement of existing functionality

Comments

@silverwind
Copy link
Member

silverwind commented Apr 16, 2020

The script at https://github.com/go-gitea/gitea/blob/master/templates/pwa/serviceworker_js.tmpl should be replaced with something that automatically generates a appropriate service worker caching manifest based on the present files in public at compile time and then use that data together with StaticUrlPrefix at runtime to serve the actual URLs.

Normally, one would use a webpack plugin for this, but webpack can not know about StaticUrlPrefix, and also does not know about vendor files so it's not directly suitable, but could maybe be integrated in the compile-time part of the process.

@guillep2k guillep2k added topic/build PR changes how Gitea is built, i.e. regarding Docker or the Makefile type/enhancement An improvement of existing functionality labels Apr 17, 2020
silverwind added a commit to silverwind/gitea that referenced this issue May 20, 2020
We don't really gain anything from it except the client-side caching
which is a problem better solved on HTTP level. Gitea is not a PWA and
will not do anything useful in a offline scenario without having access
to the server.

This should also resolve issues seen with the serviceworker interfering
on SSE requests.

The only API we can not use without a service worker is push
notifications while the "app" is closed but the more established
HTML Notification API will be a alternative.

Fixes: go-gitea#11092
Fixes: go-gitea#8056
Fixes: go-gitea#7372
silverwind added a commit to silverwind/gitea that referenced this issue May 21, 2020
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: go-gitea#11092
Fixes: go-gitea#7372
techknowlogick pushed a commit that referenced this issue May 22, 2020
* 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: #11092
Fixes: #7372

* rethrow error instead of logging

* await .register

* Revert "rethrow error instead of logging"

This reverts commit 043162b.

* improve comment

* remove JSRenderer

* add version-based cache invalidation

* refactor

* more refactor

* remove comment

* rename item to fit cache name

Co-authored-by: guillep2k <[email protected]>
silverwind added a commit to silverwind/gitea that referenced this issue May 22, 2020
* 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: go-gitea#11092
Fixes: go-gitea#7372

* rethrow error instead of logging

* await .register

* Revert "rethrow error instead of logging"

This reverts commit 043162b.

* improve comment

* remove JSRenderer

* add version-based cache invalidation

* refactor

* more refactor

* remove comment

* rename item to fit cache name

Co-authored-by: guillep2k <[email protected]>
guillep2k added a commit that referenced this issue May 22, 2020
* 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: #11092
Fixes: #7372

* rethrow error instead of logging

* await .register

* Revert "rethrow error instead of logging"

This reverts commit 043162b.

* improve comment

* remove JSRenderer

* add version-based cache invalidation

* refactor

* more refactor

* remove comment

* rename item to fit cache name

Co-authored-by: guillep2k <[email protected]>
ydelafollye pushed a commit to ydelafollye/gitea that referenced this issue Jul 31, 2020
* 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: go-gitea#11092
Fixes: go-gitea#7372

* rethrow error instead of logging

* await .register

* Revert "rethrow error instead of logging"

This reverts commit 043162b.

* improve comment

* remove JSRenderer

* add version-based cache invalidation

* refactor

* more refactor

* remove comment

* rename item to fit cache name

Co-authored-by: guillep2k <[email protected]>
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic/build PR changes how Gitea is built, i.e. regarding Docker or the Makefile type/enhancement An improvement of existing functionality
Projects
None yet
2 participants