aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2019-12-19 09:23:21 +0000
committerMatthew Somerville <matthew@mysociety.org>2020-02-14 10:38:49 +0000
commit0e80a90bebc12fe381892386f9ffd751edb38d7c (patch)
tree50f5ac13f745f6142c9b6cab726dacda2fb447fe /perllib
parent43290e5f733b4e88c6b4e5467b7e446a416a4682 (diff)
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.
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/App/Controller/Offline.pm9
1 files changed, 9 insertions, 0 deletions
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');