From 0e80a90bebc12fe381892386f9ffd751edb38d7c Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Thu, 19 Dec 2019 09:23:21 +0000 Subject: Initial service worker. This basic service worker behaves identically to the existing appcache - some static scripts and CSS are cached, any HTML offline instead returns a static HTML page that knows how to show data on stored problems out of localStorage (stored there when /my/planned was visited online). Inspect form submissions will be captured and can be synced back when online. Once feature parity is established, we will then remove appcache, switch from using localStorage to the cache API, and hopefully move all offline support into the service worker. --- perllib/FixMyStreet/App/Controller/Offline.pm | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'perllib/FixMyStreet/App/Controller/Offline.pm') diff --git a/perllib/FixMyStreet/App/Controller/Offline.pm b/perllib/FixMyStreet/App/Controller/Offline.pm index e65642899..d8b9180dd 100644 --- a/perllib/FixMyStreet/App/Controller/Offline.pm +++ b/perllib/FixMyStreet/App/Controller/Offline.pm @@ -20,6 +20,15 @@ Offline pages Catalyst Controller - service worker and appcache. =cut +sub service_worker : Path("/service-worker.js") { + my ($self, $c) = @_; + $c->res->content_type('application/javascript'); +} + +sub fallback : Local { + my ($self, $c) = @_; +} + sub manifest: Path("/.well-known/manifest.webmanifest") { my ($self, $c) = @_; $c->res->content_type('application/manifest+json'); -- cgit v1.2.3