aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristine Dodrill <me@christine.website>2021-03-16 22:09:50 -0400
committerChristine Dodrill <me@christine.website>2021-03-16 22:09:50 -0400
commit4c7f3036ffc6b2dbe52fcab26e58208ae0896beb (patch)
treea3bcbbb6c6964f29d3912c71878642806c8c4cbd
parent4ea63cbc2e34be713ad41bace77b15372fb1182a (diff)
downloadxesite-4c7f3036ffc6b2dbe52fcab26e58208ae0896beb.tar.xz
xesite-4c7f3036ffc6b2dbe52fcab26e58208ae0896beb.zip
le bump
-rw-r--r--Cargo.lock4
-rw-r--r--Cargo.toml2
-rwxr-xr-xstatic/js/sw.js68
3 files changed, 37 insertions, 37 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 903f4c6..8cf3486 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2526,7 +2526,7 @@ checksum = "d089681aa106a86fade1b0128fb5daf07d5867a509ab036d99988dec80429a57"
[[package]]
name = "xesite"
-version = "2.2.0"
+version = "2.2.1"
dependencies = [
"cfcache",
"chrono",
@@ -2548,7 +2548,7 @@ dependencies = [
"pfacts",
"pretty_env_logger",
"prometheus",
- "rand 0.8.3",
+ "rand 0.7.3",
"reqwest",
"ructe",
"sdnotify",
diff --git a/Cargo.toml b/Cargo.toml
index f45dcf0..d8a627b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "xesite"
-version = "2.2.0"
+version = "2.2.1"
authors = ["Christine Dodrill <me@christine.website>"]
edition = "2018"
build = "src/build.rs"
diff --git a/static/js/sw.js b/static/js/sw.js
index 5e2c921..e6421b5 100755
--- a/static/js/sw.js
+++ b/static/js/sw.js
@@ -1,44 +1,44 @@
//This is the service worker with the combined offline experience (Offline page + Offline copy of pages)
//Install stage sets up the offline page in the cache and opens a new cache
-self.addEventListener('install', function(event) {
+self.addEventListener('install', function (event) {
event.waitUntil(preLoad());
});
-const cacheName = "cache-xesite-2.0.0";
+const cacheName = "cache-xesite-2.1.1";
-var preLoad = function(){
- console.log('[PWA Builder] Install Event processing');
- return caches.open(cacheName).then(function(cache) {
- console.log('[PWA Builder] Cached index and offline page during Install');
- return cache.addAll(['/blog/', '/blog', '/', '/contact', '/resume', '/talks', '/gallery', '/signalboost']);
- });
+var preLoad = function () {
+ console.log('[PWA Builder] Install Event processing');
+ return caches.open(cacheName).then(function (cache) {
+ console.log('[PWA Builder] Cached index and offline page during Install');
+ return cache.addAll(['/blog/', '/blog', '/', '/contact', '/resume', '/talks', '/gallery', '/signalboost']);
+ });
};
-self.addEventListener('fetch', function(event) {
- if (event.request.cache === 'only-if-cached' && event.request.mode !== 'same-origin') {
- return;
- }
- console.log('[PWA Builder] The service worker is serving the asset.');
- event.respondWith(checkResponse(event.request).catch(function() {
- return returnFromCache(event.request);
- }));
- event.waitUntil(addToCache(event.request));
+self.addEventListener('fetch', function (event) {
+ if (event.request.cache === 'only-if-cached' && event.request.mode !== 'same-origin') {
+ return;
+ }
+ console.log('[PWA Builder] The service worker is serving the asset.');
+ event.respondWith(checkResponse(event.request).catch(function () {
+ return returnFromCache(event.request);
+ }));
+ event.waitUntil(addToCache(event.request));
});
-var checkResponse = function(request){
- return new Promise(function(fulfill, reject) {
- fetch(request).then(function(response){
- if(response.status !== 404) {
- fulfill(response);
- } else {
- reject();
- }
- }, reject);
- });
+var checkResponse = function (request) {
+ return new Promise(function (fulfill, reject) {
+ fetch(request).then(function (response) {
+ if (response.status !== 404) {
+ fulfill(response);
+ } else {
+ reject();
+ }
+ }, reject);
+ });
};
-var addToCache = function(request){
+var addToCache = function (request) {
return caches.open(cacheName).then(function (cache) {
return fetch(request).then(function (response) {
console.log('[PWA Builder] add page to offline: ' + response.url);
@@ -47,14 +47,14 @@ var addToCache = function(request){
});
};
-var returnFromCache = function(request){
+var returnFromCache = function (request) {
return caches.open(cacheName).then(function (cache) {
return cache.match(request).then(function (matching) {
- if(!matching || matching.status == 404) {
- return cache.match('offline.html');
- } else {
- return matching;
- }
+ if (!matching || matching.status == 404) {
+ return cache.match('offline.html');
+ } else {
+ return matching;
+ }
});
});
};