Service worker fix
Some checks failed
ci / site (push) Has been cancelled
publish-image / publish (push) Has been cancelled

This commit is contained in:
2026-02-10 06:46:29 -05:00
parent 7cb72b2746
commit b61146b145
2 changed files with 2 additions and 8 deletions

View File

@@ -2,11 +2,6 @@
## Fetch content, build the image, clear the cache and restart the container ## Fetch content, build the image, clear the cache and restart the container
docker run --rm -it --network container:$(docker compose ps -q redis) -v "${PWD}:/usr/src/app" -w /usr/src/app/site -e CACHE_REDIS_URL="redis://127.0.0.1:6379/0" node:24-alpine npm run fetch-content docker run --rm -it --network container:$(docker compose ps -q redis) -v "${PWD}:/usr/src/app" -w /usr/src/app/site -e CACHE_REDIS_URL="redis://127.0.0.1:6379/0" node:24-alpine npm run fetch-content
docker build \ docker compose --env-file ../site/.env -f ../docker-compose.yml build
--build-arg PUBLIC_ENABLE_SW=$(grep PUBLIC_ENABLE_SW ./site/.env | cut -d '=' -f2) \
--build-arg PUBLIC_SITE_URL=$(grep PUBLIC_SITE_URL ./site/.env | cut -d '=' -f2) \
--build-arg PUBLIC_UMAMI_SCRIPT_URL=$(grep PUBLIC_UMAMI_SCRIPT_URL ./site/.env | cut -d '=' -f2) \
--build-arg PUBLIC_UMAMI_WEBSITE_ID=$(grep PUBLIC_UMAMI_WEBSITE_ID ./site/.env | cut -d '=' -f2) \
-t fast-website:local .
docker run --rm -it --network container:$(docker compose ps -q redis) -v "${PWD}:/usr/src/app" -w /usr/src/app/site -e CACHE_REDIS_URL="redis://127.0.0.1:6379/0" node:24-alpine npm run cache:clear docker run --rm -it --network container:$(docker compose ps -q redis) -v "${PWD}:/usr/src/app" -w /usr/src/app/site -e CACHE_REDIS_URL="redis://127.0.0.1:6379/0" node:24-alpine npm run cache:clear
docker compose up -d docker compose up -d

View File

@@ -61,7 +61,6 @@ const canonicalUrl = `${siteUrl}${canonicalPath.startsWith("/") ? canonicalPath
// and only when explicitly enabled by env. // and only when explicitly enabled by env.
import.meta.env.PROD && import.meta.env.PUBLIC_ENABLE_SW === "true" ? ( import.meta.env.PROD && import.meta.env.PUBLIC_ENABLE_SW === "true" ? (
<script is:inline> <script is:inline>
{`
if ("serviceWorker" in navigator) { if ("serviceWorker" in navigator) {
// SW requires HTTPS (or localhost). In prod we expect HTTPS. // SW requires HTTPS (or localhost). In prod we expect HTTPS.
window.addEventListener("load", () => { window.addEventListener("load", () => {
@@ -70,8 +69,8 @@ const canonicalUrl = `${siteUrl}${canonicalPath.startsWith("/") ? canonicalPath
}); });
}); });
} }
`}
</script> </script>
) : null ) : null
} }
</head> </head>