summaryrefslogtreecommitdiffstats
path: root/build.js
diff options
context:
space:
mode:
Diffstat (limited to 'build.js')
-rw-r--r--build.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/build.js b/build.js
index 0f2373e..fc58f8f 100644
--- a/build.js
+++ b/build.js
@@ -360,6 +360,11 @@ function bootShell(logo, staging) {
}
const BOOT_SHELL_SCRIPT = `<script>try{var m=location.pathname.match(/^\\/([A-Za-z0-9._-]{1,64})\\/?$/);if(m){document.getElementById('boot-shell').style.display='';document.getElementById('boot-shell-name').textContent=decodeURIComponent(m[1]);}}catch(e){}</script>`;
+// HAL_NO_SW=1: the page registers no service worker. The Android bundled
+// build serves this page from its own assets, where a worker would only
+// fetch the live site over the top of them.
+const NO_SW = !!process.env.HAL_NO_SW;
+
async function pageHtml({ css, staging, pwa, scriptHtml }) {
return `<!doctype html>
<html lang="en">
@@ -376,7 +381,7 @@ ${pwa ? PWA_HEAD : ''}<style>${css}</style>
<div id="app">${bootShell(await brandSvg(), staging)}</div>
${BOOT_SHELL_SCRIPT}
${scriptHtml}
-${pwa ? SW_REGISTER + '\n' : ''}</body>
+${pwa && !NO_SW ? SW_REGISTER + '\n' : ''}</body>
</html>`;
}