@jon49/sw 0.12.13 → 0.12.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/new-app-notifier.ts +1 -3
- package/lib/routes.ts +2 -7
- package/package.json +1 -1
package/lib/new-app-notifier.ts
CHANGED
|
@@ -4,10 +4,8 @@ let refreshing = false
|
|
|
4
4
|
// Here we reload the page
|
|
5
5
|
navigator.serviceWorker.addEventListener('controllerchange', function () {
|
|
6
6
|
if (refreshing) return
|
|
7
|
-
let url = new URL(window.location.href)
|
|
8
|
-
url.searchParams.set("refresh", "hard")
|
|
9
|
-
window.location.href = url.href
|
|
10
7
|
refreshing = true
|
|
8
|
+
window.location.reload()
|
|
11
9
|
})
|
|
12
10
|
|
|
13
11
|
/// Checks if there is a new version of the app available
|
package/lib/routes.ts
CHANGED
|
@@ -175,13 +175,8 @@ async function executeHandler({ url, req, event }: ExectuteHandlerOptions) : Pro
|
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
if (isHtml(result)) {
|
|
178
|
-
if (req.
|
|
179
|
-
|
|
180
|
-
if (referrer.pathname.startsWith("/web")
|
|
181
|
-
&& url.searchParams.get("refresh") !== "hard"
|
|
182
|
-
&& req.headers.get("HF-Request") !== "true") {
|
|
183
|
-
result = html`<template>${result}</template>`
|
|
184
|
-
}
|
|
178
|
+
if (req.url.includes("hz")) {
|
|
179
|
+
result = html`<template>${result}</template>`
|
|
185
180
|
}
|
|
186
181
|
|
|
187
182
|
return streamResponse({
|