forked from b3log/pipe
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsw.min.js
More file actions
1 lines (1 loc) · 2.41 KB
/
Copy pathsw.min.js
File metadata and controls
1 lines (1 loc) · 2.41 KB
1
!function e(t,r,n){function i(u,c){if(!r[u]){if(!t[u]){var s="function"==typeof require&&require;if(!c&&s)return s(u,!0);if(o)return o(u,!0);var a=new Error("Cannot find module '"+u+"'");throw a.code="MODULE_NOT_FOUND",a}var p=r[u]={exports:{}};t[u][0].call(p.exports,function(e){var r=t[u][1][e];return i(r||e)},p,p.exports,e,t,r,n)}return r[u].exports}for(var o="function"==typeof require&&require,u=0;u<n.length;u++)i(n[u]);return i}({1:[function(e,t,r){t.exports={Server:"http://localhost:5897",StaticServer:"",StaticResourceVersion:"1521597972031",RuntimeMode:"prod",LogLevel:"debug",SessionSecret:"BEYOND",SessionMaxAge:86400,SQLite:"${home}/pipe.db",MySQL:"user:password@(localhost:3306)/pipe?charset=utf8mb4&parseTime=True&loc=Local",StaticRoot:"",Port:"5897",AxiosBaseURL:"/api",MockServer:"http://localhost:8888"}},{}],2:[function(e,t,r){"use strict";var n=function(e){return e&&e.__esModule?e:{default:e}}(e("../pipe.json")),i=n.default.StaticResourceVersion,o=n.default.StaticServer||n.default.Server,u=n.default.Server;self.addEventListener("activate",function(e){e.waitUntil(caches.keys().then(function(e){return Promise.all(e.map(async function(e){var t=await navigator.storage.estimate();return"pipe-html"!==e&&"pipe-image"!==e&&e!=="pipe-static-"+i?caches.delete(e):t.usage/t.quota>.8&&("pipe-html"===e||"pipe-image"===e)?(console.log("clear "+e+" cache"),caches.delete(e)):void 0}))}))}),self.addEventListener("fetch",function(e){0===e.request.headers.get("accept").indexOf("text/html")||"*/*"===e.request.headers.get("accept")&&-1===e.request.url.indexOf("/js/")&&!e.request.url.endsWith(".js")||0===e.request.headers.get("accept").indexOf("application/json")&&0===e.request.url.indexOf(u+"/api")?e.respondWith(fetch(e.request).then(function(t){return-1===e.request.url.indexOf(u)?t:caches.open("pipe-html").then(function(r){return"POST"!==e.request.method&&"DELETE"!==e.request.method&&"PUT"!==e.request.method&&r.put(e.request,t.clone()),t})}).catch(function(){return caches.match(e.request)})):e.respondWith(caches.match(e.request).then(function(t){return t||fetch(e.request).then(function(t){return e.request.url.indexOf("https://img.hacpai.com/")>-1?caches.open("pipe-image").then(function(r){return r.put(e.request,t.clone()),t}):e.request.url.indexOf(o)>-1?caches.open("pipe-static-"+i).then(function(r){return r.put(e.request,t.clone()),t}):t}).catch(function(){console.log("fetch "+e.request.url+" error")})}))})},{"../pipe.json":1}]},{},[2]);