diff --git a/public/js/app.js b/public/js/app.js index 97720567..ec571a5e 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[5],{"+lRy":function(e,t){},0:function(e,t,r){r("JO1w"),r("+lRy"),r("xWuY"),r("BLqG"),r("YfGV"),e.exports=r("RvBz")},"8FsP":function(e,t){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(){var e="object"===("undefined"==typeof window?"undefined":r(window))?window:"object"===("undefined"==typeof self?"undefined":r(self))?self:this,t=e.BlobBuilder||e.WebKitBlobBuilder||e.MSBlobBuilder||e.MozBlobBuilder;e.URL=e.URL||e.webkitURL||function(e,t){return(t=document.createElement("a")).href=e,t};var n=e.Blob,o=URL.createObjectURL,i=URL.revokeObjectURL,a=e.Symbol&&e.Symbol.toStringTag,s=!1,u=!1,c=!!e.ArrayBuffer,f=t&&t.prototype.append&&t.prototype.getBlob;try{s=2===new Blob(["รค"]).size,u=2===new Blob([new Uint8Array([1,2])]).size}catch(e){}function h(e){return e.map((function(e){if(e.buffer instanceof ArrayBuffer){var t=e.buffer;if(e.byteLength!==t.byteLength){var r=new Uint8Array(e.byteLength);r.set(new Uint8Array(t,e.byteOffset,e.byteLength)),t=r.buffer}return t}return e}))}function d(e,r){r=r||{};var n=new t;return h(e).forEach((function(e){n.append(e)})),r.type?n.getBlob(r.type):n.getBlob()}function p(e,t){return new n(h(e),t||{})}e.Blob&&(d.prototype=Blob.prototype,p.prototype=Blob.prototype);var b="function"==typeof TextEncoder?TextEncoder.prototype.encode.bind(new TextEncoder):function(t){for(var r=0,n=t.length,o=e.Uint8Array||Array,i=0,a=Math.max(32,n+(n>>1)+7),s=new o(a>>3<<3);r=55296&&l<=56319){if(r=55296&&l<=56319)continue}if(i+4>s.length){a+=8,a=(a*=1+r/t.length*2)>>3<<3;var c=new Uint8Array(a);c.set(s),s=c}if(0!=(4294967168&l)){if(0==(4294965248&l))s[i++]=l>>6&31|192;else if(0==(4294901760&l))s[i++]=l>>12&15|224,s[i++]=l>>6&63|128;else{if(0!=(4292870144&l))continue;s[i++]=l>>18&7|240,s[i++]=l>>12&63|128,s[i++]=l>>6&63|128}s[i++]=63&l|128}else s[i++]=l}return s.slice(0,i)},y="function"==typeof TextDecoder?TextDecoder.prototype.decode.bind(new TextDecoder):function(e){for(var t=e.length,r=[],n=0;n239?4:l>223?3:l>191?2:1;if(n+c<=t)switch(c){case 1:l<128&&(u=l);break;case 2:128==(192&(o=e[n+1]))&&(s=(31&l)<<6|63&o)>127&&(u=s);break;case 3:o=e[n+1],i=e[n+2],128==(192&o)&&128==(192&i)&&(s=(15&l)<<12|(63&o)<<6|63&i)>2047&&(s<55296||s>57343)&&(u=s);break;case 4:o=e[n+1],i=e[n+2],a=e[n+3],128==(192&o)&&128==(192&i)&&128==(192&a)&&(s=(15&l)<<18|(63&o)<<12|(63&i)<<6|63&a)>65535&&s<1114112&&(u=s)}null===u?(u=65533,c=1):u>65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),n+=c}var f=r.length,h="";for(n=0;n>2,c=(3&o)<<4|a>>4,f=(15&a)<<2|l>>6,h=63&l;s||(h=64,i||(f=64)),r.push(t[u],t[c],t[f],t[h])}return r.join("")}var n=Object.create||function(e){function t(){}return t.prototype=e,new t};if(c)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],s=ArrayBuffer.isView||function(e){return e&&a.indexOf(Object.prototype.toString.call(e))>-1};function u(r,n){n=null==n?{}:n;for(var o=0,i=(r=r||[]).length;o=t.size&&r.close()}))}})}}catch(e){try{new ReadableStream({}),g=function(e){var t=0;e=this;return new ReadableStream({pull:function(r){return e.slice(t,t+524288).arrayBuffer().then((function(n){t+=n.byteLength;var o=new Uint8Array(n);r.enqueue(o),t==e.size&&r.close()}))}})}}catch(e){try{new Response("").body.getReader().read(),g=function(){return new Response(this).body}}catch(e){g=function(){throw new Error("Include https://github.com/MattiasBuelens/web-streams-polyfill")}}}}m.arrayBuffer||(m.arrayBuffer=function(){var e=new FileReader;return e.readAsArrayBuffer(this),v(e)}),m.text||(m.text=function(){var e=new FileReader;return e.readAsText(this),v(e)}),m.stream||(m.stream=g)}(),function(e){"use strict";var t,r=e.Uint8Array,n=e.HTMLCanvasElement,o=n&&n.prototype,i=/\s*;\s*base64\s*(?:;|$)/i,a="toDataURL",s=function(e){for(var n,o,i=e.length,a=new r(i/4*3|0),s=0,l=0,u=[0,0],c=0,f=0;i--;)o=e.charCodeAt(s++),255!==(n=t[o-43])&&void 0!==n&&(u[1]=u[0],u[0]=o,f=f<<6|n,4===++c&&(a[l++]=f>>>16,61!==u[1]&&(a[l++]=f>>>8),61!==u[0]&&(a[l++]=f),c=0));return a};r&&(t=new r([62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,0,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51])),!n||o.toBlob&&o.toBlobHD||(o.toBlob||(o.toBlob=function(e,t){if(t||(t="image/png"),this.mozGetAsFile)e(this.mozGetAsFile("canvas",t));else if(this.msToBlob&&/^\s*image\/png\s*(?:$|;)/i.test(t))e(this.msToBlob());else{var n,o=Array.prototype.slice.call(arguments,1),l=this[a].apply(this,o),u=l.indexOf(","),c=l.substring(u+1),f=i.test(l.substring(0,u));Blob.fake?((n=new Blob).encoding=f?"base64":"URI",n.data=c,n.size=c.length):r&&(n=f?new Blob([s(c)],{type:t}):new Blob([decodeURIComponent(c)],{type:t})),e(n)}}),!o.toBlobHD&&o.toDataURLHD?o.toBlobHD=function(){a="toDataURLHD";var e=this.toBlob();return a="toDataURL",e}:o.toBlobHD=o.toBlob)}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this.content||this)},"8oxB":function(e,t){var r,n,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(r===setTimeout)return setTimeout(e,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(e){r=i}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(e){n=a}}();var l,u=[],c=!1,f=-1;function h(){c&&l&&(c=!1,l.length?u=l.concat(u):f=-1,u.length&&d())}function d(){if(!c){var e=s(h);c=!0;for(var t=u.length;t;){for(l=u,u=[];++f1)for(var r=1;r5&&r.startsWith("https://")){var n=new URL(r);n.host!==window.location.host&&"/i/redirect"!==n.pathname&&e.setAttribute("href","/i/redirect?url="+encodeURIComponent(r))}}))},window.App.boot=function(){new Vue({el:"#content"})},window.App.util={compose:{post:function(){var e=window.location.pathname;["/","/timeline/public"].includes(e)?$("#composeModal").modal("show"):window.location.href="/?a=co"},circle:function(){console.log("Unsupported method.")},collection:function(){console.log("Unsupported method.")},loop:function(){console.log("Unsupported method.")},story:function(){console.log("Unsupported method.")}},time:function(){return new Date},version:1,format:{count:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en-GB",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"compact";return e<1?0:new Intl.NumberFormat(t,{notation:r,compactDisplay:"short"}).format(e)},timeAgo:function(e){var t=Date.parse(e),r=Math.floor((new Date-t)/1e3),n=Math.floor(r/63072e3);return n>=1?n+"y":(n=Math.floor(r/604800))>=1?n+"w":(n=Math.floor(r/86400))>=1?n+"d":(n=Math.floor(r/3600))>=1?n+"h":(n=Math.floor(r/60))>=1?n+"m":Math.floor(r)+"s"},rewriteLinks:function(e){var t=e.innerText;return e.href.startsWith(window.location.origin)?e.href:t=1==t.startsWith("#")?"/discover/tags/"+t.substr(1)+"?src=rph":1==t.startsWith("@")?"/"+e.innerText+"?src=rpp":"/i/redirect?url="+encodeURIComponent(t)}},filters:[["1977","filter-1977"],["Aden","filter-aden"],["Amaro","filter-amaro"],["Ashby","filter-ashby"],["Brannan","filter-brannan"],["Brooklyn","filter-brooklyn"],["Charmes","filter-charmes"],["Clarendon","filter-clarendon"],["Crema","filter-crema"],["Dogpatch","filter-dogpatch"],["Earlybird","filter-earlybird"],["Gingham","filter-gingham"],["Ginza","filter-ginza"],["Hefe","filter-hefe"],["Helena","filter-helena"],["Hudson","filter-hudson"],["Inkwell","filter-inkwell"],["Kelvin","filter-kelvin"],["Kuno","filter-juno"],["Lark","filter-lark"],["Lo-Fi","filter-lofi"],["Ludwig","filter-ludwig"],["Maven","filter-maven"],["Mayfair","filter-mayfair"],["Moon","filter-moon"],["Nashville","filter-nashville"],["Perpetua","filter-perpetua"],["Poprocket","filter-poprocket"],["Reyes","filter-reyes"],["Rise","filter-rise"],["Sierra","filter-sierra"],["Skyline","filter-skyline"],["Slumber","filter-slumber"],["Stinson","filter-stinson"],["Sutro","filter-sutro"],["Toaster","filter-toaster"],["Valencia","filter-valencia"],["Vesper","filter-vesper"],["Walden","filter-walden"],["Willow","filter-willow"],["X-Pro II","filter-xpro-ii"]],filterCss:{"filter-1977":"sepia(.5) hue-rotate(-30deg) saturate(1.4)","filter-aden":"sepia(.2) brightness(1.15) saturate(1.4)","filter-amaro":"sepia(.35) contrast(1.1) brightness(1.2) saturate(1.3)","filter-ashby":"sepia(.5) contrast(1.2) saturate(1.8)","filter-brannan":"sepia(.4) contrast(1.25) brightness(1.1) saturate(.9) hue-rotate(-2deg)","filter-brooklyn":"sepia(.25) contrast(1.25) brightness(1.25) hue-rotate(5deg)","filter-charmes":"sepia(.25) contrast(1.25) brightness(1.25) saturate(1.35) hue-rotate(-5deg)","filter-clarendon":"sepia(.15) contrast(1.25) brightness(1.25) hue-rotate(5deg)","filter-crema":"sepia(.5) contrast(1.25) brightness(1.15) saturate(.9) hue-rotate(-2deg)","filter-dogpatch":"sepia(.35) saturate(1.1) contrast(1.5)","filter-earlybird":"sepia(.25) contrast(1.25) brightness(1.15) saturate(.9) hue-rotate(-5deg)","filter-gingham":"contrast(1.1) brightness(1.1)","filter-ginza":"sepia(.25) contrast(1.15) brightness(1.2) saturate(1.35) hue-rotate(-5deg)","filter-hefe":"sepia(.4) contrast(1.5) brightness(1.2) saturate(1.4) hue-rotate(-10deg)","filter-helena":"sepia(.5) contrast(1.05) brightness(1.05) saturate(1.35)","filter-hudson":"sepia(.25) contrast(1.2) brightness(1.2) saturate(1.05) hue-rotate(-15deg)","filter-inkwell":"brightness(1.25) contrast(.85) grayscale(1)","filter-kelvin":"sepia(.15) contrast(1.5) brightness(1.1) hue-rotate(-10deg)","filter-juno":"sepia(.35) contrast(1.15) brightness(1.15) saturate(1.8)","filter-lark":"sepia(.25) contrast(1.2) brightness(1.3) saturate(1.25)","filter-lofi":"saturate(1.1) contrast(1.5)","filter-ludwig":"sepia(.25) contrast(1.05) brightness(1.05) saturate(2)","filter-maven":"sepia(.35) contrast(1.05) brightness(1.05) saturate(1.75)","filter-mayfair":"contrast(1.1) brightness(1.15) saturate(1.1)","filter-moon":"brightness(1.4) contrast(.95) saturate(0) sepia(.35)","filter-nashville":"sepia(.25) contrast(1.5) brightness(.9) hue-rotate(-15deg)","filter-perpetua":"contrast(1.1) brightness(1.25) saturate(1.1)","filter-poprocket":"sepia(.15) brightness(1.2)","filter-reyes":"sepia(.75) contrast(.75) brightness(1.25) saturate(1.4)","filter-rise":"sepia(.25) contrast(1.25) brightness(1.2) saturate(.9)","filter-sierra":"sepia(.25) contrast(1.5) brightness(.9) hue-rotate(-15deg)","filter-skyline":"sepia(.15) contrast(1.25) brightness(1.25) saturate(1.2)","filter-slumber":"sepia(.35) contrast(1.25) saturate(1.25)","filter-stinson":"sepia(.35) contrast(1.25) brightness(1.1) saturate(1.25)","filter-sutro":"sepia(.4) contrast(1.2) brightness(.9) saturate(1.4) hue-rotate(-10deg)","filter-toaster":"sepia(.25) contrast(1.5) brightness(.95) hue-rotate(-15deg)","filter-valencia":"sepia(.25) contrast(1.1) brightness(1.1)","filter-vesper":"sepia(.35) contrast(1.15) brightness(1.2) saturate(1.3)","filter-walden":"sepia(.35) contrast(.8) brightness(1.25) saturate(1.4)","filter-willow":"brightness(1.2) contrast(.85) saturate(.05) sepia(.2)","filter-xpro-ii":"sepia(.45) contrast(1.25) brightness(1.75) saturate(1.3) hue-rotate(-5deg)"},emoji:["๐Ÿ˜‚","๐Ÿ’ฏ","โค๏ธ","๐Ÿ™Œ","๐Ÿ‘","๐Ÿ‘Œ","๐Ÿ˜","๐Ÿ˜ฏ","๐Ÿ˜ข","๐Ÿ˜…","๐Ÿ˜","๐Ÿ™‚","๐Ÿ˜Ž","๐Ÿ˜€","๐Ÿคฃ","๐Ÿ˜ƒ","๐Ÿ˜„","๐Ÿ˜†","๐Ÿ˜‰","๐Ÿ˜Š","๐Ÿ˜‹","๐Ÿ˜˜","๐Ÿ˜—","๐Ÿ˜™","๐Ÿ˜š","๐Ÿค—","๐Ÿคฉ","๐Ÿค”","๐Ÿคจ","๐Ÿ˜","๐Ÿ˜‘","๐Ÿ˜ถ","๐Ÿ™„","๐Ÿ˜","๐Ÿ˜ฃ","๐Ÿ˜ฅ","๐Ÿ˜ฎ","๐Ÿค","๐Ÿ˜ช","๐Ÿ˜ซ","๐Ÿ˜ด","๐Ÿ˜Œ","๐Ÿ˜›","๐Ÿ˜œ","๐Ÿ˜","๐Ÿคค","๐Ÿ˜’","๐Ÿ˜“","๐Ÿ˜”","๐Ÿ˜•","๐Ÿ™ƒ","๐Ÿค‘","๐Ÿ˜ฒ","๐Ÿ™","๐Ÿ˜–","๐Ÿ˜ž","๐Ÿ˜Ÿ","๐Ÿ˜ค","๐Ÿ˜ญ","๐Ÿ˜ฆ","๐Ÿ˜ง","๐Ÿ˜จ","๐Ÿ˜ฉ","๐Ÿคฏ","๐Ÿ˜ฌ","๐Ÿ˜ฐ","๐Ÿ˜ฑ","๐Ÿ˜ณ","๐Ÿคช","๐Ÿ˜ต","๐Ÿ˜ก","๐Ÿ˜ ","๐Ÿคฌ","๐Ÿ˜ท","๐Ÿค’","๐Ÿค•","๐Ÿคข","๐Ÿคฎ","๐Ÿคง","๐Ÿ˜‡","๐Ÿค ","๐Ÿคก","๐Ÿคฅ","๐Ÿคซ","๐Ÿคญ","๐Ÿง","๐Ÿค“","๐Ÿ˜ˆ","๐Ÿ‘ฟ","๐Ÿ‘น","๐Ÿ‘บ","๐Ÿ’€","๐Ÿ‘ป","๐Ÿ‘ฝ","๐Ÿค–","๐Ÿ’ฉ","๐Ÿ˜บ","๐Ÿ˜ธ","๐Ÿ˜น","๐Ÿ˜ป","๐Ÿ˜ผ","๐Ÿ˜ฝ","๐Ÿ™€","๐Ÿ˜ฟ","๐Ÿ˜พ","๐Ÿคฒ","๐Ÿ‘","๐Ÿค","๐Ÿ‘","๐Ÿ‘Ž","๐Ÿ‘Š","โœŠ","๐Ÿค›","๐Ÿคœ","๐Ÿคž","โœŒ๏ธ","๐ŸคŸ","๐Ÿค˜","๐Ÿ‘ˆ","๐Ÿ‘‰","๐Ÿ‘†","๐Ÿ‘‡","โ˜๏ธ","โœ‹","๐Ÿคš","๐Ÿ–","๐Ÿ––","๐Ÿ‘‹","๐Ÿค™","๐Ÿ’ช","๐Ÿ–•","โœ๏ธ","๐Ÿ™","๐Ÿ’","๐Ÿ’„","๐Ÿ’‹","๐Ÿ‘„","๐Ÿ‘…","๐Ÿ‘‚","๐Ÿ‘ƒ","๐Ÿ‘ฃ","๐Ÿ‘","๐Ÿ‘€","๐Ÿง ","๐Ÿ—ฃ","๐Ÿ‘ค","๐Ÿ‘ฅ"],embed:{post:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"full",o=e+"/embed?";return o+=t?"caption=true&":"caption=false&",o+=r?"likes=true&":"likes=false&",' + + diff --git a/public/sw.js b/public/sw.js new file mode 100644 index 00000000..b88112cf --- /dev/null +++ b/public/sw.js @@ -0,0 +1,45 @@ +const OFFLINE_VERSION = 1; +const CACHE_NAME = "offline"; +const OFFLINE_URL = "/offline.html"; + +self.addEventListener("install", (event) => { + event.waitUntil( + (async () => { + const cache = await caches.open(CACHE_NAME); + await cache.add(new Request(OFFLINE_URL, { cache: "reload" })); + })() + ); + self.skipWaiting(); +}); + +self.addEventListener("activate", (event) => { + event.waitUntil( + (async () => { + if ("navigationPreload" in self.registration) { + await self.registration.navigationPreload.enable(); + } + })() + ); + self.clients.claim(); +}); + +self.addEventListener("fetch", (event) => { + if (event.request.mode === "navigate") { + event.respondWith( + (async () => { + try { + const preloadResponse = await event.preloadResponse; + if (preloadResponse) { + return preloadResponse; + } + const networkResponse = await fetch(event.request); + return networkResponse; + } catch (error) { + const cache = await caches.open(CACHE_NAME); + const cachedResponse = await cache.match(OFFLINE_URL); + return cachedResponse; + } + })() + ); + } +}); diff --git a/resources/assets/js/app.js b/resources/assets/js/app.js index 2d1af4b4..8471cd6d 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 +};