From 78ee44662c5b561e6d8539893296981574cb7ef2 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 17 Jun 2021 22:42:08 -0600 Subject: [PATCH 1/2] Add PWA + ServiceWorker with offline support --- public/offline.html | 61 +++++++++++++++++++++++++++++++++++++ public/sw.js | Bin 0 -> 1091 bytes resources/assets/js/app.js | 8 ++++- 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 public/offline.html create mode 100644 public/sw.js diff --git a/public/offline.html b/public/offline.html new file mode 100644 index 000000000..b216ae2ea --- /dev/null +++ b/public/offline.html @@ -0,0 +1,61 @@ + + + + + + + + You are offline + + + +
+
+

+ icon/color/svg/pixelfed-icon-color Created with Sketch. +

+

You are offline

+ +

Click the button below to try reloading.

+

+ +

+
+
+ + + + diff --git a/public/sw.js b/public/sw.js new file mode 100644 index 0000000000000000000000000000000000000000..b88112cf2ebc2b025fc255cafaf63dc4fac1a2b5 GIT binary patch literal 1091 zcmbVLU2EGg6n&O|h47OMMPsim8I_xi>9e}V8UGa00tZ@6*d)GmnW1#L@GM_L0<}zKKNd!aAShf ztRRF5|7;{>LkJ<6mlSdh*i*!4n!Y@@TQKaEadn0T$WcV3!VK)`5+0wx2X@5&gudi5 zr?hmSt!PTxRjEW*v8o{PZ_?u*)be{7+~LL9Qn%qkue9 zmks9|+u+n@xGOy&C^PdR%x|q}ZdF*v;lDF|65Mkywcmtowq*%1)xYjUt~f%ISVAJP z5i%G^h=cIt3?1QpW;6<)yo3hA-nxfL>*U5;<=N&#@lj?j-r)kGjp&(k)*T3acHswh g=~6Tka_N|FVyEN%9}#?;-1AGDk}gBK4PDy(e=Lko761SM literal 0 HcmV?d00001 diff --git a/resources/assets/js/app.js b/resources/assets/js/app.js index 2d1af4b41..8471cd6d4 100644 --- a/resources/assets/js/app.js +++ b/resources/assets/js/app.js @@ -34,6 +34,12 @@ window.App.boot = function() { new Vue({ el: '#content'}); } +window.addEventListener("load", () => { + if ("serviceWorker" in navigator) { + navigator.serviceWorker.register("/sw.js"); + } +}); + window.App.util = { compose: { post: (function() { @@ -230,4 +236,4 @@ window.App.util = { .attr('width', 34).attr('height', 34); }) -}; \ No newline at end of file +}; From 79324679f1a540edb223f2894c3ff9e82f527e1e Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 17 Jun 2021 22:42:42 -0600 Subject: [PATCH 2/2] Update compiled assets --- public/js/app.js | Bin 25821 -> 25939 bytes public/mix-manifest.json | Bin 2207 -> 2207 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/public/js/app.js b/public/js/app.js index 977205674b7691e7ebcaedc48f3362af15938aa5..ec571a5ef1e147d79c0f9b61b6de9b18db4e8c0c 100644 GIT binary patch delta 142 zcmcb6lJW8>#tjpU>Jw8^T+34PN_;YlOH%Vvi!_vS@)J{(bTraR^O8$4^Yb(`tCfmV zi^?*SQ^WI%vQvwcGV>Jj63a5v6HD@o)YRZiJrq@XMXBi^BY_6$7nkd06)S1hYHI3~ ZXXd5km+Lte6zG+fWaijzo@wM_1OR>+HKqUn delta 14 Wcmcb7it+AA#tjpUHnSP~8UX+{;07ZA diff --git a/public/mix-manifest.json b/public/mix-manifest.json index 4c37574d6b4debc0885ad4d79291072fed59d493..25f92b75a49692794a95d1eb6fcbe97a87ca741d 100644 GIT binary patch delta 33 ocmbO)IA3r>B%_FtVXA3LYO1NZrGB%_F>xrs@lNwT?#vAIb~T9T=WrJ>p8Tt*{y0H2r$=Kufz