bloby-bot 0.70.0 → 0.70.1
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/package.json
CHANGED
package/supervisor/index.ts
CHANGED
|
@@ -194,7 +194,7 @@ self.addEventListener('fetch', function(event) {
|
|
|
194
194
|
if (HASHED_RE.test(url.pathname)) {
|
|
195
195
|
event.respondWith(caches.open(CACHE).then(function(c) {
|
|
196
196
|
return c.match(request).then(function(hit) {
|
|
197
|
-
return hit || fetch(request).then(function(r) { if (r.
|
|
197
|
+
return hit || fetch(request).then(function(r) { if (r.status === 200) c.put(request, r.clone()); return r; });
|
|
198
198
|
});
|
|
199
199
|
}));
|
|
200
200
|
return;
|
|
@@ -209,7 +209,7 @@ self.addEventListener('fetch', function(event) {
|
|
|
209
209
|
return c.match(request).then(function(hit) {
|
|
210
210
|
if (hit) return hit;
|
|
211
211
|
return fetch(request).then(function(r) {
|
|
212
|
-
if (r.
|
|
212
|
+
if (r.status === 200) { // never 206 — Cache.put rejects partial (Range) responses
|
|
213
213
|
c.put(request, r.clone());
|
|
214
214
|
c.keys().then(function(keys) {
|
|
215
215
|
for (var i = 0; i < keys.length; i++) {
|
|
@@ -237,7 +237,7 @@ self.addEventListener('fetch', function(event) {
|
|
|
237
237
|
// Network-first: always fetch the live dashboard; only fall back to cache when offline.
|
|
238
238
|
event.respondWith(caches.open(CACHE).then(function(c) {
|
|
239
239
|
return fetch(request)
|
|
240
|
-
.then(function(r) { if (r.
|
|
240
|
+
.then(function(r) { if (r.status === 200) c.put('/', r.clone()); return r; })
|
|
241
241
|
.catch(function() { return c.match('/'); });
|
|
242
242
|
}));
|
|
243
243
|
return;
|
|
@@ -249,7 +249,7 @@ self.addEventListener('fetch', function(event) {
|
|
|
249
249
|
// Everything else (JS/CSS modules, static assets) → network-first, cache as offline fallback.
|
|
250
250
|
event.respondWith(caches.open(CACHE).then(function(c) {
|
|
251
251
|
return fetch(request)
|
|
252
|
-
.then(function(r) { if (r.
|
|
252
|
+
.then(function(r) { if (r.status === 200) c.put(request, r.clone()); return r; })
|
|
253
253
|
.catch(function() { return c.match(request); });
|
|
254
254
|
}));
|
|
255
255
|
});
|
|
@@ -57,7 +57,7 @@ self.addEventListener('fetch', (event) => {
|
|
|
57
57
|
if (/\/assets\/.+-[a-zA-Z0-9_-]{6,}\.(js|css)$/.test(url.pathname)) {
|
|
58
58
|
event.respondWith(caches.open(CACHE).then(c =>
|
|
59
59
|
c.match(request).then(hit =>
|
|
60
|
-
hit || fetch(request).then(r => { if (r.
|
|
60
|
+
hit || fetch(request).then(r => { if (r.status === 200) c.put(request, r.clone()); return r; })
|
|
61
61
|
)
|
|
62
62
|
));
|
|
63
63
|
return;
|
|
@@ -70,7 +70,7 @@ self.addEventListener('fetch', (event) => {
|
|
|
70
70
|
event.respondWith(caches.open(CACHE).then(c =>
|
|
71
71
|
c.match(request).then(hit =>
|
|
72
72
|
hit || fetch(request).then(r => {
|
|
73
|
-
if (r.
|
|
73
|
+
if (r.status === 200) { // never 206 — Cache.put rejects partial (Range) responses
|
|
74
74
|
c.put(request, r.clone());
|
|
75
75
|
c.keys().then(keys => {
|
|
76
76
|
for (const k of keys) {
|
|
@@ -94,7 +94,7 @@ self.addEventListener('fetch', (event) => {
|
|
|
94
94
|
// Network-first: always fetch the live dashboard; cache only as offline fallback.
|
|
95
95
|
event.respondWith(caches.open(CACHE).then(c =>
|
|
96
96
|
fetch(request)
|
|
97
|
-
.then(r => { if (r.
|
|
97
|
+
.then(r => { if (r.status === 200) c.put('/', r.clone()); return r; })
|
|
98
98
|
.catch(() => c.match('/'))
|
|
99
99
|
));
|
|
100
100
|
return;
|
|
@@ -107,7 +107,7 @@ self.addEventListener('fetch', (event) => {
|
|
|
107
107
|
// Covers: JS/CSS modules, images, video, fonts, manifest, etc.
|
|
108
108
|
event.respondWith(caches.open(CACHE).then(c =>
|
|
109
109
|
fetch(request)
|
|
110
|
-
.then(r => { if (r.
|
|
110
|
+
.then(r => { if (r.status === 200) c.put(request, r.clone()); return r; })
|
|
111
111
|
.catch(() => c.match(request))
|
|
112
112
|
));
|
|
113
113
|
});
|