From 1b60dbe9a2f3d3cb035071cca44db7e6287a5941 Mon Sep 17 00:00:00 2001 From: James Chang Date: Wed, 14 Apr 2021 17:45:33 -0400 Subject: [PATCH] Add service-worker script to static assets, update og:image to permanent link --- frontend/nuxt.config.js | 2 +- frontend/static/service-worker.js | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 frontend/static/service-worker.js diff --git a/frontend/nuxt.config.js b/frontend/nuxt.config.js index d88dae4..1abcd24 100644 --- a/frontend/nuxt.config.js +++ b/frontend/nuxt.config.js @@ -32,7 +32,7 @@ export default { }, { property: 'og:image', - content: 'https://cubepb.com/_nuxt/img/cubepb-logo-2-b.2c3896b.png', + content: 'https://cubepb.com/cubepb-logo-2-b.png', }, ], link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }], diff --git a/frontend/static/service-worker.js b/frontend/static/service-worker.js new file mode 100644 index 0000000..973d94b --- /dev/null +++ b/frontend/static/service-worker.js @@ -0,0 +1,18 @@ +self.addEventListener('activate', function (event) { + event.waitUntil( + caches.keys().then(function (cacheNames) { + return Promise.all( + cacheNames + .filter(function (_cacheName) { + // Return true if you want to remove this cache, + // but remember that caches are shared across + // the whole origin + return true + }) + .map(function (cacheName) { + return caches.delete(cacheName) + }) + ) + }) + ) +})