diff options
| author | Xe <me@christine.website> | 2021-12-21 13:37:39 -0500 |
|---|---|---|
| committer | Xe <me@christine.website> | 2021-12-21 13:37:39 -0500 |
| commit | ee69f652e545b8a42c7cd3b93ff66c5825066e5e (patch) | |
| tree | 770d4a1663f719da2dee85138f097852cbf23fb2 | |
| parent | 7c3a00ff1137f5576d87ce10daccfabeb7120781 (diff) | |
| download | xesite-ee69f652e545b8a42c7cd3b93ff66c5825066e5e.tar.xz xesite-ee69f652e545b8a42c7cd3b93ff66c5825066e5e.zip | |
fuck you service worker cache
Signed-off-by: Xe <me@christine.website>
| -rwxr-xr-x | static/js/sw.js | 57 | ||||
| -rw-r--r-- | static/manifest.json | 6 |
2 files changed, 4 insertions, 59 deletions
diff --git a/static/js/sw.js b/static/js/sw.js index 29ea65c..4492088 100755 --- a/static/js/sw.js +++ b/static/js/sw.js @@ -1,56 +1 @@ -//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) {
- event.waitUntil(preLoad());
-});
-
-const cacheName = "cache-xesite-2.3.0-1000";
-
-var preLoad = function () {
- return caches.open(cacheName).then(function (cache) {
- 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;
- }
- 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 addToCache = function (request) {
- return caches.open(cacheName).then(function (cache) {
- return fetch(request).then(function (response) {
- return cache.put(request, response);
- });
- });
-};
-
-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;
- }
- });
- });
-};
+self.addEventListener('install', function (event) {});
diff --git a/static/manifest.json b/static/manifest.json index 3d11b2e..e78006d 100644 --- a/static/manifest.json +++ b/static/manifest.json @@ -1,12 +1,12 @@ { - "name": "Christine Dodrill", - "short_name": "Christine", + "name": "Xeblog", + "short_name": "Xeblog", "theme_color": "#ffcbe4", "background_color": "#fa99ca", "display": "standalone", "scope": "/", "start_url": "/", - "description": "Blog and Resume for Christine Dodrill", + "description": "Blog and Resume for Christine Xe", "orientation": "any", "icons": [ { |
