From b040ac6373b65d9c1836f1fe3e5a0d45b9ce8878 Mon Sep 17 00:00:00 2001 From: tamaina Date: Fri, 27 Sep 2019 05:12:56 +0900 Subject: [PATCH] PWA Fix (#5432) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * PWA Fix * SWが/api/へのリクエストに関与しないように * fix semicolon * Update base.pug * Update base.pug --- assets/icons/512.png | Bin 0 -> 10231 bytes assets/icons/icon.svg | Bin 0 -> 5729 bytes src/client/app/boot.js | 13 +++------- src/client/app/sw.js | 46 +++++++++++++++++++++++++++++++--- src/server/web/views/base.pug | 2 ++ 5 files changed, 49 insertions(+), 12 deletions(-) create mode 100644 assets/icons/512.png create mode 100644 assets/icons/icon.svg diff --git a/assets/icons/512.png b/assets/icons/512.png new file mode 100644 index 0000000000000000000000000000000000000000..66abba2d0d39af63c816e1b9bb8a8f497fe01312 GIT binary patch literal 10231 zcmeHt`9GBJ-}XghE25BXD3!7&J7XzpgzUS@P7KDrm*gW`w(OLpu`AidR6<#@8@o!D z88Vi!%~ej{deH(NT*fbYs+rid{0ly9p`&biw;vy*=( zHru;WuJ(?LTC_?|lQdbfe^0#9yoFrKoj*D_FFJ52$>F*#w=6fXDRP44_ojd#qeDF= z(9Pi_aQVbX9%K|PxSY8RF5=`-{paR?CggwVW_SvY#@+@gG&{MViX%v_hw-%WIr?w- z?Hg=K?p_jw@3oAJl1rzacS*9v%ELt^%>6&rw0u!qjHc{iIBk59UhrqcPMaimqMIVi zSZuPlU!vZ1wj>3(XV<27`S*dLzC&(D>O;Xk`s14U&hIX|-7(#xQu3E<;kk4akur;W z2X%!X4Jrg*)R)(q_x8S!tM|FKOt1-=Smdi|!iX4TtSWbjFwWnNu;{^{4=Y){xUXJ_9%Y;<+T)sc&r| z>l#{&-OKOR)fQ^`MF;gT=8~XwHOaTHKHvX~lPk$+IZb%vjBe2o7#6=d^QrL=l{7)T z_l4siOsT5o#@LvjNy{Vuk{)Dj%I?HaptVA)KKA{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mcNMT;W?>O#y=|MA z#2@e|2o&9%jo4@!v46lx3o-5YG(=sifgkVwD01Unnu)08=HeV1V5|dNUT1>H3tb}(^p+z4H#9{ImXDzh-og(7qu_>xsh2O9C50WFnnBa8!3 z)U62MObh}4L%4Wj6Qq#Zv!8Za%G!V~qZ-zB|J>cx60X*Vr?(e)xJUr;II|cV-2$>R zYONtOWR7H~1(aw9WI@w8{ z+-tn!8I3UARphnlJ0f{RIR*s$s=?0jswXm-_R9P=&(UJv{v-s^xR9R(5FF?q-rBm1 z(#&e8$~z+dNo|#cd7sE!Z{$c&t1oFY%NQs(zHd5+^?rMmEopU^oe`(ZJyq-+G5_+B zH}*@mp=N%Bd_K^P`iM)P+MYujrA@_v0bB_C%ak~PeZoSRud->umd%FlE3AN1!^FEf z+LA3{vgD)y*SifY9Wa)*#2VhoajDn8*Isf8zTnAQ2wlVSjCS)zSS-L~qo154KpRaU zIXDUyO2@sIb)!}2)Vi{-b)!<_eBV{qtjCfpV|PS&EGKWw1C)V*Z&T4lQU`6N{n|bZ06GNHb~%+ExF}!(c#=P@@Wce zu{ed+oSoF8D(uW zDm>4>K%BW1vXino9dD%yT})@)SS6PD5sMs=+%~g3U=M)+8fH&o_KOc*_PM1)_VBY9 z$eBTUP4=AKM15RqYmVQ^8-KHEQ?!dlmQtfr@)GMZ>ZlpO!%<*FMSCMkeSv#RCJGW4 zRlYDt!`?UQ*NZbw?_!<%Wv1A#K2~7Z61b}gFJX>9!(V6m;P>L=5vX_NN^W4ow4d4r1 zS9qCyr=>Oc^p1f}3`}XfEdTxYG)0s^+dLigQlG0(DhY zCOY;dxX~wC(7Q4P6pAbk}T~Dq0_JgPY1>eYEegFUf literal 0 HcmV?d00001 diff --git a/assets/icons/icon.svg b/assets/icons/icon.svg new file mode 100644 index 0000000000000000000000000000000000000000..842a5a885f4289f1e5918c361c9e0600b6b23b96 GIT binary patch literal 5729 zcmcIo*^b=C6@AxN6j~3K5t3c|LQTs^tT-`{1+Wzd2=u}sYi4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Xc`N5jRWasQCm?24}eE>PS(?+^N1o8Y-Wp#C{E&ihT@4OQgZ?k>R_N& zGl-HzI{gBOXhz(?7WaDqQ8=ARA#g=cBh+5n(4{{S+|s!4r>3SjYRL#*0{5XFYff{C zzj)=TR4389lJioZ!{i?@xI4b?)XJO#E*+@`tNFs-!;5@^)JGb B&7uGR literal 0 HcmV?d00001 diff --git a/src/client/app/boot.js b/src/client/app/boot.js index 583cc4fc8..c244050a5 100644 --- a/src/client/app/boot.js +++ b/src/client/app/boot.js @@ -98,15 +98,10 @@ // If mobile, insert the viewport meta tag if (isMobile) { - const meta = document.createElement('meta'); - meta.setAttribute('name', 'viewport'); - meta.setAttribute('content', - 'width=device-width,' + - 'initial-scale=1,' + - 'minimum-scale=1,' + - 'maximum-scale=1,' + - 'user-scalable=no'); - head.appendChild(meta); + const viewport = document.getElementsByName("viewport").item(0); + viewport.setAttribute('content', + `${viewport.getAttribute('content')},minimum-scale=1,maximum-scale=1,user-scalable=no`); + head.appendChild(viewport); } // Switch desktop or mobile version diff --git a/src/client/app/sw.js b/src/client/app/sw.js index 92f2ac828..d080130e3 100644 --- a/src/client/app/sw.js +++ b/src/client/app/sw.js @@ -4,13 +4,53 @@ import composeNotification from './common/scripts/compose-notification'; +// eslint-disable-next-line no-undef +const version = _VERSION_; +const cacheName = `mk-cache-${version}`; + +const apiUrl = `${location.origin}/api/`; + // インストールされたとき self.addEventListener('install', ev => { console.info('installed'); - ev.waitUntil(Promise.all([ - self.skipWaiting(), // Force activate - ])); + ev.waitUntil( + caches.open(cacheName) + .then(cache => { + return cache.addAll([ + "/", + `/assets/desktop.${version}.js`, + `/assets/mobile.${version}.js`, + "/assets/error.jpg" + ]); + }) + .then(() => self.skipWaiting()) + ); +}); + +self.addEventListener('activate', ev => { + ev.waitUntil( + caches.keys() + .then(cacheNames => Promise.all( + cacheNames + .filter((v) => v !== cacheName) + .map(name => caches.delete(name)) + )) + .then(() => self.clients.claim()) + ); +}); + +self.addEventListener('fetch', ev => { + if (ev.request.method !== 'GET' || ev.request.url.startsWith(apiUrl)) return; + ev.respondWith( + caches.match(ev.request) + .then(response => { + return response || fetch(ev.request); + }) + .catch(() => { + return caches.match("/"); + }) + ); }); // プッシュ通知を受け取ったとき diff --git a/src/server/web/views/base.pug b/src/server/web/views/base.pug index 16bea853e..97c7a87e1 100644 --- a/src/server/web/views/base.pug +++ b/src/server/web/views/base.pug @@ -12,7 +12,9 @@ html meta(name='referrer' content='origin') meta(name='theme-color' content='#105779') meta(property='og:site_name' content= instanceName || 'Misskey') + meta(name='viewport' content='width=device-width, initial-scale=1') link(rel='icon' href= icon || '/favicon.ico') + link(rel='apple-touch-icon' href= icon || '/apple-touch-icon.png') link(rel='manifest' href='/manifest.json') title