diff --git a/nuxt.config.js b/nuxt.config.js index 3a880e7..6e0c8d1 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -85,6 +85,7 @@ export default { // "~/plugins/web3modal.js", { src: '~/plugins/v-tooltip', mode: 'client' }, { src: '~/plugins/v-clipboard2', mode: 'client' }, + { src: '~/plugins/pwa-update', mode: 'client' }, ], // Auto import components: https://go.nuxtjs.dev/config-components @@ -100,7 +101,70 @@ export default { // Doc: https://github.com/nuxt-community/google-fonts-module "@nuxtjs/google-fonts", "@nuxtjs/svg", + '@nuxtjs/pwa', ], + + pwa: { + meta: { + appleStatusBarStyle: 'default', + }, + + icon: false, + + manifest: { + "short_name": "Assembly", + "name": "Instadapp - Assembly", + "description": "The Open Source Dashboard for the Instadapp Protocol", + "iconPath": "/android-icon-192x192.png", + "providedBy": { + "name": "InstaDApp Labs LLC", + "url": "https://instadapp.io/" + }, + "start_url": "/", + "display": "minimal-ui", + "theme_color": "#3F75FF", + "background_color": "#ffffff", + "icons": [ + { + "src": "\/android-icon-36x36.png", + "sizes": "36x36", + "type": "image\/png", + "density": "0.75" + }, + { + "src": "\/android-icon-48x48.png", + "sizes": "48x48", + "type": "image\/png", + "density": "1.0" + }, + { + "src": "\/android-icon-72x72.png", + "sizes": "72x72", + "type": "image\/png", + "density": "1.5" + }, + { + "src": "\/android-icon-96x96.png", + "sizes": "96x96", + "type": "image\/png", + "density": "2.0" + }, + { + "src": "\/android-icon-144x144.png", + "sizes": "144x144", + "type": "image\/png", + "density": "3.0" + }, + { + "src": "\/android-icon-192x192.png", + "sizes": "192x192", + "type": "image\/png", + "density": "4.0" + } + ] + } + + }, googleFonts: { families: { Montserrat: [100, 200, 300, 400, 500, 600, 700, 800, 900] diff --git a/package.json b/package.json index cdc4800..8a558b9 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ "@nuxt/types": "^2.15.7", "@nuxt/typescript-build": "^2.1.0", "@nuxtjs/google-fonts": "^1.3.0", + "@nuxtjs/pwa": "^3.3.5", "@nuxtjs/svg": "^0.1.12", "@nuxtjs/tailwindcss": "^4.2.0", "postcss": "^8.3.5" diff --git a/plugins/pwa-update.js b/plugins/pwa-update.js new file mode 100644 index 0000000..48c8fdf --- /dev/null +++ b/plugins/pwa-update.js @@ -0,0 +1,20 @@ +export default async function () { + const workbox = await window.$workbox + + if (!workbox) { + console.debug("Workbox couldn't be loaded.") + return + } + + workbox.addEventListener('installed', (event) => { + if (event.isUpdate === true) { + console.debug('There is an update for the PWA, reloading...') + + // window.location.reload() + + return + } + + console.debug('The PWA is on the latest version.') + }) +} diff --git a/yarn.lock b/yarn.lock index bd2a23c..274e00f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2250,6 +2250,21 @@ dependencies: http-proxy-middleware "^1.0.6" +"@nuxtjs/pwa@^3.3.5": + version "3.3.5" + resolved "https://registry.yarnpkg.com/@nuxtjs/pwa/-/pwa-3.3.5.tgz#db7c905536ebe8a464a347b6ae3215810642c044" + integrity sha512-8tTmW8DBspWxlJwTimOHTkwfkwPpL9wIcGmy75Gcmin+c9YtX2Ehxmhgt/TLFOC9XsLAqojqynw3/Agr/9OE1w== + dependencies: + clone-deep "^4.0.1" + defu "^3.2.2" + execa "^5.0.0" + fs-extra "^9.1.0" + hasha "^5.2.2" + jimp-compact "^0.16.1" + lodash.template "^4.5.0" + serve-static "^1.14.1" + workbox-cdn "^5.1.4" + "@nuxtjs/svg@^0.1.12": version "0.1.12" resolved "https://registry.yarnpkg.com/@nuxtjs/svg/-/svg-0.1.12.tgz#a5b2a66070a36e3c5c5183db9e3d89485ef3eb1c" @@ -5263,6 +5278,15 @@ cliui@^7.0.2: strip-ansi "^6.0.0" wrap-ansi "^7.0.0" +clone-deep@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/clone-deep/-/clone-deep-4.0.1.tgz#c19fd9bdbbf85942b4fd979c84dcf7d5f07c2387" + integrity sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ== + dependencies: + is-plain-object "^2.0.4" + kind-of "^6.0.2" + shallow-clone "^3.0.0" + clone-response@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/clone-response/-/clone-response-1.0.2.tgz#d1dc973920314df67fbeb94223b4ee350239e96b" @@ -8352,6 +8376,14 @@ hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3, hash.js@^1.1.7: inherits "^2.0.3" minimalistic-assert "^1.0.1" +hasha@^5.2.2: + version "5.2.2" + resolved "https://registry.yarnpkg.com/hasha/-/hasha-5.2.2.tgz#a48477989b3b327aea3c04f53096d816d97522a1" + integrity sha512-Hrp5vIK/xr5SkeN2onO32H0MgNZ0f17HRNH39WfL0SYUNOTZ5Lz1TJ8Pajo/87dYGEFlLMm7mIc/k/s6Bvz9HQ== + dependencies: + is-stream "^2.0.0" + type-fest "^0.8.0" + hdkey@^0.7.1: version "0.7.1" resolved "https://registry.yarnpkg.com/hdkey/-/hdkey-0.7.1.tgz#caee4be81aa77921e909b8d228dd0f29acaee632" @@ -9238,6 +9270,11 @@ jest-worker@^26.5.0: merge-stream "^2.0.0" supports-color "^7.0.0" +jimp-compact@^0.16.1: + version "0.16.1" + resolved "https://registry.yarnpkg.com/jimp-compact/-/jimp-compact-0.16.2.tgz#650bf90698eb7af797e20bf5f5cdccd137e7d08a" + integrity sha512-F/r0L283J46xiGUEvUb3jxUsei7aB94g3NRIMuJ4WhbpEcJV2U5GpaUNJLnBiOP2+x4lLTI4UiRVrmbrXQAOMA== + jiti@^1.9.2: version "1.12.6" resolved "https://registry.yarnpkg.com/jiti/-/jiti-1.12.6.tgz#8884d53a10bd571e0e85787994d97cfcc48ac6f9" @@ -13383,6 +13420,13 @@ sha.js@^2.4.0, sha.js@^2.4.8: inherits "^2.0.1" safe-buffer "^5.0.1" +shallow-clone@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/shallow-clone/-/shallow-clone-3.0.1.tgz#8f2981ad92531f55035b01fb230769a40e02efa3" + integrity sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA== + dependencies: + kind-of "^6.0.2" + shallowequal@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/shallowequal/-/shallowequal-1.1.0.tgz#188d521de95b9087404fd4dcb68b13df0ae4e7f8" @@ -14492,7 +14536,7 @@ type-fest@^0.6.0: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.6.0.tgz#8d2a2370d3df886eb5c90ada1c5bf6188acf838b" integrity sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg== -type-fest@^0.8.1: +type-fest@^0.8.0, type-fest@^0.8.1: version "0.8.1" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== @@ -15873,6 +15917,11 @@ widest-line@^3.1.0: dependencies: string-width "^4.0.0" +workbox-cdn@^5.1.4: + version "5.1.4" + resolved "https://registry.yarnpkg.com/workbox-cdn/-/workbox-cdn-5.1.4.tgz#dbd8acee70b1978be70106207590bbb76af935cf" + integrity sha512-04gM3mi8QGutokkSaA9xunVfjURnLbo9TTWyi8+pSDCEW5cD8u5GbJiliLK1vB9CShk/9OY1UDfW+XcmD+d6KQ== + worker-farm@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/worker-farm/-/worker-farm-1.7.0.tgz#26a94c5391bbca926152002f69b84a4bf772e5a8"