aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-01-10 15:16:04 +0000
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-01-10 17:16:22 +0000
commit3fd19343c5e13e5a26740e181de03e702c642eee (patch)
tree375d34fe69e805831f1f4278573f20a42096d30f
parente973904765e4efb242d09d3d41d7f9eb0a294424 (diff)
Allow staging sites to turn off appcache.
-rw-r--r--conf/general.yml-example2
-rw-r--r--perllib/FixMyStreet/App/Controller/Offline.pm9
-rw-r--r--templates/web/base/offline/manifest.html1
3 files changed, 11 insertions, 1 deletions
diff --git a/conf/general.yml-example b/conf/general.yml-example
index 71fbeea35..6c694024d 100644
--- a/conf/general.yml-example
+++ b/conf/general.yml-example
@@ -48,9 +48,11 @@ STAGING_SITE: 1
# this to 1 if you want a staging site to route reports as normal.
# - skip_checks: Manual testing of multiple cobrands can be made easier by
# skipping some checks they have in them, if this variable is set.
+# - enable_appcache: Whether the appcache should be active.
STAGING_FLAGS:
send_reports: 0
skip_checks: 0
+ enable_appcache: 0
# What to use as front page/alert example places placeholder
# Defaults to High Street, Main Street
diff --git a/perllib/FixMyStreet/App/Controller/Offline.pm b/perllib/FixMyStreet/App/Controller/Offline.pm
index 9acb33f7e..5f3b69f2e 100644
--- a/perllib/FixMyStreet/App/Controller/Offline.pm
+++ b/perllib/FixMyStreet/App/Controller/Offline.pm
@@ -11,6 +11,7 @@ FixMyStreet::App::Controller::Offline - Catalyst Controller
=head1 DESCRIPTION
Offline pages Catalyst Controller.
+On staging site, appcache only for people who want it.
=head1 METHODS
@@ -18,6 +19,10 @@ Offline pages Catalyst Controller.
sub manifest : Path("/offline/appcache.manifest") {
my ($self, $c) = @_;
+ if (FixMyStreet->staging_flag('enable_appcache', 0)) {
+ $c->response->status(404);
+ $c->response->body('NOT FOUND');
+ }
$c->res->content_type('text/cache-manifest; charset=utf-8');
$c->res->header(Cache_Control => 'no-cache, no-store');
}
@@ -25,6 +30,10 @@ sub manifest : Path("/offline/appcache.manifest") {
sub appcache : Path("/offline/appcache") {
my ($self, $c) = @_;
$c->detach('/page_error_404_not_found', []) if keys %{$c->req->params};
+ if (FixMyStreet->staging_flag('enable_appcache', 0)) {
+ $c->response->status(404);
+ $c->response->body('NOT FOUND');
+ }
}
__PACKAGE__->meta->make_immutable;
diff --git a/templates/web/base/offline/manifest.html b/templates/web/base/offline/manifest.html
index f5a9fddcc..93d26cb94 100644
--- a/templates/web/base/offline/manifest.html
+++ b/templates/web/base/offline/manifest.html
@@ -5,7 +5,6 @@ CACHE MANIFEST
CACHE:
[% version('/cobrands/' _ c.cobrand.asset_moniker _ '/base.css') %]
[% version('/cobrands/' _ c.cobrand.asset_moniker _ '/layout.css') %]
-
[% FOR script IN scripts ~%]
[%- script %]
[% END %]