From da1e5c03df8a8f35720f9eb69a865216db185d2b Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Wed, 20 May 2020 17:28:03 -0700 Subject: [PATCH] reorg dir structure: - keep shared and electron build at root - move static files for replayweb.page and Jekyll config to docs/ - move Jekyll markdown to docs/docs/ --- .gitignore | 13 ++++------ build/notarize.js | 7 +++++ docs/404.html | 11 ++++++++ CNAME => docs/CNAME | 0 Gemfile => docs/Gemfile | 0 Gemfile.lock => docs/Gemfile.lock | 0 _config.yml => docs/_config.yml | 0 {_includes => docs/_includes}/title.html | 0 {_sass => docs/_sass}/custom/custom.scss | 0 docs/{ => docs}/browsing.md | 0 docs/{ => docs}/linking.md | 0 docs/{ => docs}/reference.md | 0 docs/{ => docs}/supported-formats.md | 0 docs/{ => docs}/supported-locations.md | 0 docs/{ => docs}/usage.md | 0 {dist => docs}/embed.js | 2 +- {examples => docs/examples}/embed-test.warc | Bin .../examples}/netpreserve-twitter.warc | Bin {dist => docs}/frontend.js | 2 +- index.html => docs/index.html | 2 +- docs/run.sh | 4 +++ sw.js => docs/sw.js | 2 +- index.js | 3 --- package.json | 9 ++++--- src/electron-main.js | 9 ++++--- webpack.config.js | 24 +++++------------- 26 files changed, 48 insertions(+), 40 deletions(-) create mode 100644 docs/404.html rename CNAME => docs/CNAME (100%) rename Gemfile => docs/Gemfile (100%) rename Gemfile.lock => docs/Gemfile.lock (100%) rename _config.yml => docs/_config.yml (100%) rename {_includes => docs/_includes}/title.html (100%) rename {_sass => docs/_sass}/custom/custom.scss (100%) rename docs/{ => docs}/browsing.md (100%) rename docs/{ => docs}/linking.md (100%) rename docs/{ => docs}/reference.md (100%) rename docs/{ => docs}/supported-formats.md (100%) rename docs/{ => docs}/supported-locations.md (100%) rename docs/{ => docs}/usage.md (100%) rename {dist => docs}/embed.js (97%) rename {examples => docs/examples}/embed-test.warc (100%) rename {examples => docs/examples}/netpreserve-twitter.warc (100%) rename {dist => docs}/frontend.js (99%) rename index.html => docs/index.html (79%) create mode 100755 docs/run.sh rename sw.js => docs/sw.js (98%) delete mode 100644 index.js diff --git a/.gitignore b/.gitignore index 1cffac1..651d9cd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,12 @@ *.har *.warc *.warc.gz -!examples/*.warc -dist/sw.js +!docs/examples/*.warc **/node_modules yarn-error.log coverage/ -local-examples/ -.DS_Store -.sass-cache/ -_site/ +**/local-examples/ +**/.DS_Store +**/.sass-cache/ +docs/_site/ dist/ -!dist/frontend.js -!dist/embed.js diff --git a/build/notarize.js b/build/notarize.js index 38e5972..d4b6dcd 100644 --- a/build/notarize.js +++ b/build/notarize.js @@ -6,6 +6,13 @@ exports.default = async function notarizing(context) { return; } + if (process.env.CSC_IDENTITY_AUTO_DISCOVERY === "false") { + console.log('Skipped signing and notarizing'); + return; + } + + console.log('Notarizing...'); + const appName = context.packager.appInfo.productFilename; const password = `@keychain:WR Notarize`; diff --git a/docs/404.html b/docs/404.html new file mode 100644 index 0000000..a78689b --- /dev/null +++ b/docs/404.html @@ -0,0 +1,11 @@ + + + + + +Loading SW, Please wait... + + + diff --git a/CNAME b/docs/CNAME similarity index 100% rename from CNAME rename to docs/CNAME diff --git a/Gemfile b/docs/Gemfile similarity index 100% rename from Gemfile rename to docs/Gemfile diff --git a/Gemfile.lock b/docs/Gemfile.lock similarity index 100% rename from Gemfile.lock rename to docs/Gemfile.lock diff --git a/_config.yml b/docs/_config.yml similarity index 100% rename from _config.yml rename to docs/_config.yml diff --git a/_includes/title.html b/docs/_includes/title.html similarity index 100% rename from _includes/title.html rename to docs/_includes/title.html diff --git a/_sass/custom/custom.scss b/docs/_sass/custom/custom.scss similarity index 100% rename from _sass/custom/custom.scss rename to docs/_sass/custom/custom.scss diff --git a/docs/browsing.md b/docs/docs/browsing.md similarity index 100% rename from docs/browsing.md rename to docs/docs/browsing.md diff --git a/docs/linking.md b/docs/docs/linking.md similarity index 100% rename from docs/linking.md rename to docs/docs/linking.md diff --git a/docs/reference.md b/docs/docs/reference.md similarity index 100% rename from docs/reference.md rename to docs/docs/reference.md diff --git a/docs/supported-formats.md b/docs/docs/supported-formats.md similarity index 100% rename from docs/supported-formats.md rename to docs/docs/supported-formats.md diff --git a/docs/supported-locations.md b/docs/docs/supported-locations.md similarity index 100% rename from docs/supported-locations.md rename to docs/docs/supported-locations.md diff --git a/docs/usage.md b/docs/docs/usage.md similarity index 100% rename from docs/usage.md rename to docs/docs/usage.md diff --git a/dist/embed.js b/docs/embed.js similarity index 97% rename from dist/embed.js rename to docs/embed.js index e7aef91..b098e75 100644 --- a/dist/embed.js +++ b/docs/embed.js @@ -1,4 +1,4 @@ -!function(t,e){for(var s in e)t[s]=e[s]}(self,function(t){var e={};function s(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,s),r.l=!0,r.exports}return s.m=t,s.c=e,s.d=function(t,e,n){s.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},s.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.t=function(t,e){if(1&e&&(t=s(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(s.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)s.d(n,r,function(e){return t[e]}.bind(null,r));return n},s.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(e,"a",e),e},s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s.p="/dist/",s(s.s=108)}({0:function(t,e,s){"use strict";s.d(e,"c",(function(){return d.e})),s.d(e,"d",(function(){return N})),s.d(e,"b",(function(){return C})),s.d(e,"a",(function(){return E}));var n=s(5),r=s(1);function i(t,e){const{element:{content:s},parts:n}=t,r=document.createTreeWalker(s,133,null,!1);let i=a(n),o=n[i],c=-1,l=0;const u=[];let d=null;for(;r.nextNode();){c++;const t=r.currentNode;for(t.previousSibling===d&&(d=null),e.has(t)&&(u.push(t),null===d&&(d=t)),null!==d&&l++;void 0!==o&&o.index===c;)o.index=null!==d?-1:o.index-l,i=a(n,i),o=n[i]}u.forEach(t=>t.parentNode.removeChild(t))}const o=t=>{let e=11===t.nodeType?0:1;const s=document.createTreeWalker(t,133,null,!1);for(;s.nextNode();)e++;return e},a=(t,e=-1)=>{for(let s=e+1;st.parentNode.removeChild(t))}const o=t=>{let e=11===t.nodeType?0:1;const s=document.createTreeWalker(t,133,null,!1);for(;s.nextNode();)e++;return e},a=(t,e=-1)=>{for(let s=e+1;se.parentNode.removeChild(e))}const n=e=>{let t=11===e.nodeType?0:1;const i=document.createTreeWalker(e,133,null,!1);for(;i.nextNode();)t++;return t},s=(e,t=-1)=>{for(let i=t+1;ie.parentNode.removeChild(e))}const n=e=>{let t=11===e.nodeType?0:1;const i=document.createTreeWalker(e,133,null,!1);for(;i.nextNode();)t++;return t},s=(e,t=-1)=>{for(let i=t+1;i - + diff --git a/docs/run.sh b/docs/run.sh new file mode 100755 index 0000000..f05fc2d --- /dev/null +++ b/docs/run.sh @@ -0,0 +1,4 @@ +#!/bin/bash +export PATH=/usr/local/opt/ruby/bin:$PATH +bundle update +bundle exec jekyll serve --trace diff --git a/sw.js b/docs/sw.js similarity index 98% rename from sw.js rename to docs/sw.js index 0435a5d..bfe77d1 100644 --- a/sw.js +++ b/docs/sw.js @@ -1,4 +1,4 @@ -!function(t,e){for(var r in e)t[r]=e[r]}(self,function(t){var e={};function r(i){if(e[i])return e[i].exports;var n=e[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=t,r.c=e,r.d=function(t,e,i){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(i,n,function(e){return t[e]}.bind(null,n));return i},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="/dist/",r(r.s=109)}([,,,function(t,e,r){"use strict";function i(t,e){for(const r of e)if(t.startsWith(r))return!0;return!1}function n(t,e){for(const r of e)if(t.indexOf(r)>=0)return!0;return!1}function s(t){return t.replace(/[-:T]/g,"").slice(0,14)}function o(t){if(!t)return new Date;t.length<14&&(t+="00000101000000".substr(t.length));const e=t.substring(0,4)+"-"+t.substring(4,6)+"-"+t.substring(6,8)+"T"+t.substring(8,10)+":"+t.substring(10,12)+":"+t.substring(12,14)+"-00:00";return new Date(e)}function a(t){if(!t)return"";try{return""+parseInt(t.getTime()/1e3)}catch(t){return""}}async function u(t,e){const r="string"==typeof t?(new TextEncoder).encode(t):t,i=await crypto.subtle.digest(e,r);return e+":"+Array.from(new Uint8Array(i)).map(t=>t.toString(16).padStart(2,"0")).join("")}function h(t){try{return new Headers(t)}catch(e){for(let e of Object.keys(t)){const r=t[e],i=r.replace(/[\r\n]+/g,", ");r!=i&&(t[e]=i)}return new Headers(t)}}r.d(e,"k",(function(){return i})),r.d(e,"c",(function(){return n})),r.d(e,"f",(function(){return s})),r.d(e,"l",(function(){return o})),r.d(e,"e",(function(){return a})),r.d(e,"d",(function(){return u})),r.d(e,"h",(function(){return l})),r.d(e,"i",(function(){return h})),r.d(e,"j",(function(){return d})),r.d(e,"g",(function(){return p})),r.d(e,"a",(function(){return f})),r.d(e,"b",(function(){return m}));const c=[101,204,205,304];function l(t){return c.includes(t)}function p(t){return"XMLHttpRequest"===t.headers.get("X-Pywb-Requested-With")}function d(t,e){let r,i;return e||(e="Sorry, this url was not found in the archive."),"script"===t.destination||t.headers.get("x-pywb-requested-with")?(r=JSON.stringify(e),i="application/json"):(r=e,i="text/html"),new Response(r,{status:404,statusText:"Not Found",headers:{"Content-Type":i}})}class f extends class{constructor(t,e){this.url=t,this.status=e}}{}class m{}},,,,function(t,e,r){"use strict";r.d(e,"b",(function(){return o})),r.d(e,"a",(function(){return a})),r.d(e,"d",(function(){return f})),r.d(e,"c",(function(){return y}));var i=r(97);const n=new TextDecoder("utf-8");class s extends i.Inflate{constructor(t,e){super(t),this.reader=e}onEnd(t){this.err=t,this.err||(this.reader._rawOffset+=this.strm.total_in)}}class o{static concatChunks(t,e){if(1===t.length)return t[0];const r=new Uint8Array(e);let i=0;for(const e of t)r.set(e,i),i+=e.byteLength;return r}static splitChunk(t,e){return[t.slice(0,e),t.slice(e)]}getReadableStream(){const t=this[Symbol.asyncIterator]();return new ReadableStream({pull:e=>t.next().then(t=>{t.done||!t.value?e.close():e.enqueue(t.value)})})}async readFully(){const t=[];let e=0;for await(const r of this)t.push(r),e+=r.byteLength;return o.concatChunks(t,e)}async readline(t=0){const e=await this.readlineRaw(t);return e?n.decode(e):""}async*iterLines(t=0){let e=null;for(;e=await this.readline(t);)yield e}}class a extends o{constructor(t,e="gzip",r=!1){if(super(),this.compressed=e,this.opts={raw:"deflateRaw"===e},this.inflator=e?new s(this.opts,this):null,"function"!=typeof t[Symbol.asyncIterator])if("function"==typeof t.getReader)t=a.fromReadable(t.getReader());else if("function"==typeof t.read)t=a.fromReadable(t);else{if("function"!=typeof t[Symbol.iterator])throw new TypeError("Invalid Stream Source");t=a.fromIter(t)}this._sourceIter=t[Symbol.asyncIterator](),r&&(this._sourceIter=this.dechunk(this._sourceIter)),this.lastValue=null,this.errored=!1,this._savedChunk=null,this._rawOffset=0,this._readOffset=0,this.numChunks=0}async _loadNext(){const t=await this._sourceIter.next();return t.done?null:t.value}async*dechunk(t){const e=new a(t,null);let r=-1,i=!0;for(;0!=r;){const t=await e.readlineRaw(64);let s=null;if(r=parseInt(n.decode(t),16),!r||r>2**32){if(Number.isNaN(r)||r>2**32){i||(this.errored=!0),yield t;break}}else if(s=await e.readSize(r),s.length!=r){i?yield t:this.errored=!0,yield s;break}const o=await e.readSize(2);if(13!=o[0]||10!=o[1]){i?yield t:this.errored=!0,yield s,yield o;break}yield s,i=!1}yield*e}_unread(t){t.length&&(this._readOffset-=t.length,this._savedChunk&&console.log("Already have chunk!"),this._savedChunk=t)}async _next(){if(this._savedChunk){const t=this._savedChunk;return this._savedChunk=null,t}if(this.compressed){const t=this._getNextChunk();if(t)return t}let t=await this._loadNext();for(;this.compressed&&t;){this._push(t);const e=this._getNextChunk(t);if(e)return e;t=await this._loadNext()}return t}_push(t){this.lastValue=t,this.inflator.ended&&(this.inflator=new s(this.opts,this)),this.inflator.push(t),this.inflator.err&&this.inflator.ended&&"deflate"===this.compressed&&!1===this.opts.raw&&0===this.numChunks&&(this.opts.raw=!0,this.compressed="deflateRaw",this.inflator=new s(this.opts,this),this.inflator.push(t))}_getNextChunk(t){for(;;){if(this.inflator.chunks.length>0)return this.numChunks++,this.inflator.chunks.shift();if(this.inflator.ended){if(0!==this.inflator.err)return this.compressed=null,t;const e=this.inflator.strm.avail_in;if(e&&this.lastValue){this._push(this.lastValue.slice(-e));continue}}return null}}async*[Symbol.asyncIterator](){let t=null;for(;t=await this._next();)this._readOffset+=t.length,yield t}async readlineRaw(t){const e=[];let r,i=0,n=null;for await(const s of this){if(t&&i+s.byteLength>t){n=s,r=t-i-1;const e=s.slice(0,r+1).indexOf(10);e>=0&&(r=e);break}if(r=s.indexOf(10),r>=0){n=s;break}e.push(s),i+=s.byteLength}if(n){const[t,s]=a.splitChunk(n,r+1);e.push(t),i+=t.byteLength,this._unread(s)}else if(!e.length)return null;return a.concatChunks(e,i)}readFully(){return this.readSize()}async readSize(t=-1,e=!1){const r=[];let i=0;for await(const n of this){if(t>=0){if(n.length>t){const[s,o]=a.splitChunk(n,t);e||r.push(s),i+=s.byteLength,this._unread(o);break}if(n.length===t){e||r.push(n),i+=n.byteLength,t=0;break}t-=n.length}e||r.push(n),i+=n.byteLength}return e?i:a.concatChunks(r,i)}getReadOffset(){return this._readOffset}getRawOffset(){return this.compressed?this._rawOffset:this._readOffset}getRawLength(t){return this.compressed?this.inflator.strm.total_in:this._readOffset-t}static fromReadable(t){return{async*[Symbol.asyncIterator](){let e=null;for(;(e=await t.read())&&!e.done;)yield e.value}}}static fromIter(t){return{async*[Symbol.asyncIterator](){for(const e of t)yield e}}}}class u extends o{constructor(t,e,r=0){super(),this.sourceIter=t,this.length=e,this.limit=e,this.skip=r}setLimitSkip(t,e=0){this.limit=t,this.skip=e}async*[Symbol.asyncIterator](){if(!(this.limit<=0))for await(let t of this.sourceIter){if(this.skip>0){if(!(t.length>=this.skip)){this.skip-=t.length;continue}{const[e,r]=u.splitChunk(t,this.skip);t=r,this.skip=0}}if(t.length>this.limit){const[e,r]=u.splitChunk(t,this.limit);t=e,this.sourceIter._unread(r)}if(t.length&&(this.limit-=t.length,yield t),this.limit<=0)break}}async readlineRaw(t){if(this.limit<=0)return null;const e=await this.sourceIter.readlineRaw(t?Math.min(t,this.limit):this.limit);return this.limit-=e.length,e}async skipFully(){const t=this.limit;for(;this.limit>0;)this.limit-=await this.sourceIter.readSize(this.limit,!0);return t}}class h{constructor({statusline:t,headers:e}){this.statusline=t,this.headers=e}toString(){const t=[this.statusline];for(const[e,r]of this.headers)t.push(`${e}: ${r}`);return t.join("\r\n")+"\r\n"}_parseResponseStatusLine(){const t=l(this.statusline," ",2);this._protocol=t[0],this._statusCode=t.length>1?Number(t[1]):"",this._statusText=t.length>2?t[2]:""}get statusCode(){return void 0===this._statusCode&&this._parseResponseStatusLine(),this._statusCode}get protocol(){return void 0===this._protocol&&this._parseResponseStatusLine(),this._protocol}get statusText(){return void 0===this._statusText&&this._parseResponseStatusLine(),this._statusText}_parseRequestStatusLine(){const t=this.statusline.split(" ",2);this._method=t[0],this._requestPath=t.length>1?t[1]:""}get method(){return void 0===this._method&&this._parseRequestStatusLine(),this._method}get requestPath(){return void 0===this._requestPath&&this._parseRequestStatusLine(),this._requestPath}}class c{startsWithSpace(t){const e=t.charAt(0);return" "===e||"\t"===e}async parse(t,{headersClass:e=Map}={}){const r=await t.readline();if(!r)return null;let i=r.trimEnd();const n=new e;if(!i)return null;let s=(await t.readline()).trimEnd();for(;s;){let[e,r]=l(s,":",1);r&&(e=e.trimStart(),r=r.trim());let i=(await t.readline()).trimEnd();for(;this.startsWithSpace(i);)r&&(r+=i),i=(await t.readline()).trimEnd();if(r)try{n.set(e,r)}catch(t){}s=i}return new h({statusline:i,headers:n,totalRead:this.totalRead})}}function l(t,e,r){const i=t.split(e),n=i.slice(0,r);return i.slice(r).length>0&&n.push(i.slice(r).join(e)),n}const p=new TextDecoder("utf-8");class d extends o{constructor({warcHeaders:t,reader:e}){super(),this.warcHeaders=t,this.headersLen=0,this._reader=new u(e,this.warcContentLength),this._contentReader=null,this.payload=null,this.httpHeaders=null,this.consumed=!1,this.fixUp()}_addHttpHeaders(t,e){this.httpHeaders=t,this.headersLen=e,this._reader.setLimitSkip(this.warcContentLength-this.headersLen)}getResponseInfo(){const t=this.httpHeaders;return t?{headers:t.headers,status:t.statusCode,statusText:t.statusText}:null}fixUp(){const t=this.warcHeaders.headers.get("WARC-Target-URI");t&&t.startsWith("<")&&t.endsWith(">")&&this.warcHeaders.headers.set("WARC-Target-URI",t.slice(1,-1))}async readFully(t=!1){if(this.httpHeaders){if(this._contentReader&&!t)throw new TypeError("WARC Record decoding already started, but requesting raw payload");if(t&&"raw"===this.consumed&&this.payload)return await this._createDecodingReader([this.payload]).readFully()}return this.payload||(t?(this.payload=await super.readFully(),this.consumed="content"):(this.payload=await this._reader.readFully(),this.consumed="raw")),this.payload}get reader(){if(this._contentReader)throw new TypeError("WARC Record decoding already started, but requesting raw payload");return this._reader}get contentReader(){return this.httpHeaders?(this._contentReader||(this._contentReader=this._createDecodingReader(this._reader)),this._contentReader):this._reader}_createDecodingReader(t){let e=this.httpHeaders.headers.get("content-encoding"),r=this.httpHeaders.headers.get("transfer-encoding");const i="chunked"===r;return e||i||(e=r),new a(t,e,i)}async readlineRaw(t){if(this.consumed)throw new Error("Record already consumed.. Perhaps a promise was not awaited?");return this.contentReader.readlineRaw(t)}async contentText(){const t=await this.readFully(!0);return p.decode(t)}async*[Symbol.asyncIterator](){for await(const t of this.contentReader)if(yield t,this.consumed)throw new Error("Record already consumed.. Perhaps a promise was not awaited?");this.consumed="content"}async skipFully(){if(this.consumed)return;const t=await this._reader.skipFully();return this.consumed="skipped",t}warcHeader(t){return this.warcHeaders.headers.get(t)}get warcType(){return this.warcHeaders.headers.get("WARC-Type")}get warcTargetURI(){return this.warcHeaders.headers.get("WARC-Target-URI")}get warcDate(){return this.warcHeaders.headers.get("WARC-Date")}get warcRefersToTargetURI(){return this.warcHeaders.headers.get("WARC-Refers-To-Target-URI")}get warcRefersToDate(){return this.warcHeaders.headers.get("WARC-Refers-To-Date")}get warcPayloadDigest(){return this.warcHeaders.headers.get("WARC-Payload-Digest")}get warcContentType(){return this.warcHeaders.headers.get("Content-Type")}get warcContentLength(){return Number(this.warcHeaders.headers.get("Content-Length"))}}class f{static parse(t,e){return new f(t,e).parse()}static iterRecords(t,e){return new f(t,e)}constructor(t,{keepHeadersCase:e=!1,parseHttp:r=!0}={}){this._offset=0,this._warcHeadersLength=0,this._headersClass=e?Map:Headers,this._parseHttp=r,this._atRecordBoundary=!0,t instanceof a||(t=new a(t)),this._reader=t,this._record=null}async readToNextRecord(){!this._atRecordBoundary&&this._reader&&this._record&&(await this._record.skipFully(),await this._reader.readSize(4,!0),this._atRecordBoundary=!0)}async parse(){await this.readToNextRecord(),this._offset=this._reader.getRawOffset();const t=new c,e=await t.parse(this._reader,{headersClass:this._headersClass});if(!e)return null;this._warcHeadersLength=this._reader.getReadOffset();const r=new d({warcHeaders:e,reader:this._reader});if(this._atRecordBoundary=!1,this._record=r,this._parseHttp)switch(r.warcType){case"response":case"request":await this._addHttpHeaders(r,t,this._reader);break;case"revisit":r.warcContentLength>0&&await this._addHttpHeaders(r,t,this._reader)}return r}get offset(){return this._offset}get recordLength(){return this._reader.getRawLength(this._offset)}async*[Symbol.asyncIterator](){let t=null;for(;t=await this.parse(this._reader);)yield t;this._record=null}async _addHttpHeaders(t,e,r){const i=await e.parse(r,{headersClass:this._headersClass});t._addHttpHeaders(i,r.getReadOffset()-this._warcHeadersLength)}}const m="offset,warc-type,warc-target-uri".split(",");const w="urlkey,timestamp,url,mime,status,digest,length,offset,filename".split(","),g="urlkey,timestamp,url,mime,status,digest,redirect,meta,length,offset,filename".split(",");class y extends class extends class{constructor(t,e){this.opts=t,this.out=e}write(t){this.out.write(JSON.stringify(t)+"\n")}async run(t){for await(const e of this.iterIndex(t))this.write(e)}async*iterIndex(t){const e={strictHeaders:!0,parseHttp:this.parseHttp};for(const{filename:r,reader:i}of t){if(!r||!i)continue;const t=new f(i,e);for await(const e of t){await e.skipFully();const i=this.indexRecord(e,t,r);i&&(yield i)}}}indexRecord(t,e,r){if(this.filterRecord&&!this.filterRecord(t))return null;const i={},n={offset:e.offset,length:e.recordLength,filename:r};for(const e of this.fields)null!=n[e]?i[e]=n[e]:this.setField(e,t,i);return i}setField(t,e,r){const i=this.getField(t,e);null!=i&&(r[t]=i)}getField(t,e){return"http:status"===t?!e.httpHeaders||"response"!==e.warcType&&"revisit"!==e.warcType?null:e.httpHeaders.statusCode:t.startsWith("http:")?e.httpHeaders?e.httpHeaders.headers.get(t.slice(5)):null:e.warcHeaders.headers.get(t)}}{constructor(t={},e=null){if(super(t,e),t.fields){this.fields=t.fields.split(","),this.parseHttp=!1;for(const t of this.fields)if(t.startsWith("http:")){this.parseHttp=!0;break}}else this.fields=m,this.parseHttp=!1}}{constructor(t={},e=null){switch(super(t,e),this.includeAll=t.all,this.fields=w,this.parseHttp=!0,t.format){case"cdxj":this.write=this.writeCDXJ;break;case"cdx":this.write=this.writeCDX11}}filterRecord(t){if(this.includeAll)return!0;const e=t.warcType;return"request"!==e&&"warcinfo"!==e}writeCDXJ(t){const{urlkey:e,timestamp:r}=t;delete t.urlkey,delete t.timestamp,this.out.write(`${e} ${r} ${JSON.stringify(t)}\n`)}writeCDX11(t){const e=[];for(const r of g)e.push(null!=t[r]?t[r]:"-");this.out.write(e.join(" ")+"\n")}getField(t,e){let r=null;switch(t){case"urlkey":return this.getSurt(e.warcTargetURI);case"timestamp":return r=e.warcDate,r.replace(/[-:T]/g,"").slice(0,14);case"url":return e.warcTargetURI;case"mime":switch(e.warcType){case"revisit":return"warc/revisit";case"response":case"request":t="http:content-type";break;default:t="content-type"}return r=super.getField(t,e),r?r.split(";",1)[0].trim():null;case"status":return super.getField("http:status",e);case"digest":return r=e.warcPayloadDigest,r?r.split(":",2)[1]:null}}getSurt(t){try{const e=new URL(t);let r=e.hostname.split(".").reverse().join(",");return e.port&&(r+=":"+e.port),r+=")",r+=e.pathname,r.toLowerCase()}catch(e){return t}}}},,,,function(t,e,r){"use strict";var i=r(32),n=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],s=["scalar","sequence","mapping"];t.exports=function(t,e){var r,o;if(e=e||{},Object.keys(e).forEach((function(e){if(-1===n.indexOf(e))throw new i('Unknown option "'+e+'" is met in definition of "'+t+'" YAML type.')})),this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(t){return t},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.defaultStyle=e.defaultStyle||null,this.styleAliases=(r=e.styleAliases||null,o={},null!==r&&Object.keys(r).forEach((function(t){r[t].forEach((function(e){o[String(e)]=t}))})),o),-1===s.indexOf(this.kind))throw new i('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}},,,function(t,e,r){"use strict";(function(t){ +!function(t,e){for(var r in e)t[r]=e[r]}(self,function(t){var e={};function r(i){if(e[i])return e[i].exports;var n=e[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=t,r.c=e,r.d=function(t,e,i){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(i,n,function(e){return t[e]}.bind(null,n));return i},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="/",r(r.s=109)}([,,,function(t,e,r){"use strict";function i(t,e){for(const r of e)if(t.startsWith(r))return!0;return!1}function n(t,e){for(const r of e)if(t.indexOf(r)>=0)return!0;return!1}function s(t){return t.replace(/[-:T]/g,"").slice(0,14)}function o(t){if(!t)return new Date;t.length<14&&(t+="00000101000000".substr(t.length));const e=t.substring(0,4)+"-"+t.substring(4,6)+"-"+t.substring(6,8)+"T"+t.substring(8,10)+":"+t.substring(10,12)+":"+t.substring(12,14)+"-00:00";return new Date(e)}function a(t){if(!t)return"";try{return""+parseInt(t.getTime()/1e3)}catch(t){return""}}async function u(t,e){const r="string"==typeof t?(new TextEncoder).encode(t):t,i=await crypto.subtle.digest(e,r);return e+":"+Array.from(new Uint8Array(i)).map(t=>t.toString(16).padStart(2,"0")).join("")}function h(t){try{return new Headers(t)}catch(e){for(let e of Object.keys(t)){const r=t[e],i=r.replace(/[\r\n]+/g,", ");r!=i&&(t[e]=i)}return new Headers(t)}}r.d(e,"k",(function(){return i})),r.d(e,"c",(function(){return n})),r.d(e,"f",(function(){return s})),r.d(e,"l",(function(){return o})),r.d(e,"e",(function(){return a})),r.d(e,"d",(function(){return u})),r.d(e,"h",(function(){return l})),r.d(e,"i",(function(){return h})),r.d(e,"j",(function(){return d})),r.d(e,"g",(function(){return p})),r.d(e,"a",(function(){return f})),r.d(e,"b",(function(){return m}));const c=[101,204,205,304];function l(t){return c.includes(t)}function p(t){return"XMLHttpRequest"===t.headers.get("X-Pywb-Requested-With")}function d(t,e){let r,i;return e||(e="Sorry, this url was not found in the archive."),"script"===t.destination||t.headers.get("x-pywb-requested-with")?(r=JSON.stringify(e),i="application/json"):(r=e,i="text/html"),new Response(r,{status:404,statusText:"Not Found",headers:{"Content-Type":i}})}class f extends class{constructor(t,e){this.url=t,this.status=e}}{}class m{}},,,,function(t,e,r){"use strict";r.d(e,"b",(function(){return o})),r.d(e,"a",(function(){return a})),r.d(e,"d",(function(){return f})),r.d(e,"c",(function(){return y}));var i=r(97);const n=new TextDecoder("utf-8");class s extends i.Inflate{constructor(t,e){super(t),this.reader=e}onEnd(t){this.err=t,this.err||(this.reader._rawOffset+=this.strm.total_in)}}class o{static concatChunks(t,e){if(1===t.length)return t[0];const r=new Uint8Array(e);let i=0;for(const e of t)r.set(e,i),i+=e.byteLength;return r}static splitChunk(t,e){return[t.slice(0,e),t.slice(e)]}getReadableStream(){const t=this[Symbol.asyncIterator]();return new ReadableStream({pull:e=>t.next().then(t=>{t.done||!t.value?e.close():e.enqueue(t.value)})})}async readFully(){const t=[];let e=0;for await(const r of this)t.push(r),e+=r.byteLength;return o.concatChunks(t,e)}async readline(t=0){const e=await this.readlineRaw(t);return e?n.decode(e):""}async*iterLines(t=0){let e=null;for(;e=await this.readline(t);)yield e}}class a extends o{constructor(t,e="gzip",r=!1){if(super(),this.compressed=e,this.opts={raw:"deflateRaw"===e},this.inflator=e?new s(this.opts,this):null,"function"!=typeof t[Symbol.asyncIterator])if("function"==typeof t.getReader)t=a.fromReadable(t.getReader());else if("function"==typeof t.read)t=a.fromReadable(t);else{if("function"!=typeof t[Symbol.iterator])throw new TypeError("Invalid Stream Source");t=a.fromIter(t)}this._sourceIter=t[Symbol.asyncIterator](),r&&(this._sourceIter=this.dechunk(this._sourceIter)),this.lastValue=null,this.errored=!1,this._savedChunk=null,this._rawOffset=0,this._readOffset=0,this.numChunks=0}async _loadNext(){const t=await this._sourceIter.next();return t.done?null:t.value}async*dechunk(t){const e=new a(t,null);let r=-1,i=!0;for(;0!=r;){const t=await e.readlineRaw(64);let s=null;if(r=parseInt(n.decode(t),16),!r||r>2**32){if(Number.isNaN(r)||r>2**32){i||(this.errored=!0),yield t;break}}else if(s=await e.readSize(r),s.length!=r){i?yield t:this.errored=!0,yield s;break}const o=await e.readSize(2);if(13!=o[0]||10!=o[1]){i?yield t:this.errored=!0,yield s,yield o;break}yield s,i=!1}yield*e}_unread(t){t.length&&(this._readOffset-=t.length,this._savedChunk&&console.log("Already have chunk!"),this._savedChunk=t)}async _next(){if(this._savedChunk){const t=this._savedChunk;return this._savedChunk=null,t}if(this.compressed){const t=this._getNextChunk();if(t)return t}let t=await this._loadNext();for(;this.compressed&&t;){this._push(t);const e=this._getNextChunk(t);if(e)return e;t=await this._loadNext()}return t}_push(t){this.lastValue=t,this.inflator.ended&&(this.inflator=new s(this.opts,this)),this.inflator.push(t),this.inflator.err&&this.inflator.ended&&"deflate"===this.compressed&&!1===this.opts.raw&&0===this.numChunks&&(this.opts.raw=!0,this.compressed="deflateRaw",this.inflator=new s(this.opts,this),this.inflator.push(t))}_getNextChunk(t){for(;;){if(this.inflator.chunks.length>0)return this.numChunks++,this.inflator.chunks.shift();if(this.inflator.ended){if(0!==this.inflator.err)return this.compressed=null,t;const e=this.inflator.strm.avail_in;if(e&&this.lastValue){this._push(this.lastValue.slice(-e));continue}}return null}}async*[Symbol.asyncIterator](){let t=null;for(;t=await this._next();)this._readOffset+=t.length,yield t}async readlineRaw(t){const e=[];let r,i=0,n=null;for await(const s of this){if(t&&i+s.byteLength>t){n=s,r=t-i-1;const e=s.slice(0,r+1).indexOf(10);e>=0&&(r=e);break}if(r=s.indexOf(10),r>=0){n=s;break}e.push(s),i+=s.byteLength}if(n){const[t,s]=a.splitChunk(n,r+1);e.push(t),i+=t.byteLength,this._unread(s)}else if(!e.length)return null;return a.concatChunks(e,i)}readFully(){return this.readSize()}async readSize(t=-1,e=!1){const r=[];let i=0;for await(const n of this){if(t>=0){if(n.length>t){const[s,o]=a.splitChunk(n,t);e||r.push(s),i+=s.byteLength,this._unread(o);break}if(n.length===t){e||r.push(n),i+=n.byteLength,t=0;break}t-=n.length}e||r.push(n),i+=n.byteLength}return e?i:a.concatChunks(r,i)}getReadOffset(){return this._readOffset}getRawOffset(){return this.compressed?this._rawOffset:this._readOffset}getRawLength(t){return this.compressed?this.inflator.strm.total_in:this._readOffset-t}static fromReadable(t){return{async*[Symbol.asyncIterator](){let e=null;for(;(e=await t.read())&&!e.done;)yield e.value}}}static fromIter(t){return{async*[Symbol.asyncIterator](){for(const e of t)yield e}}}}class u extends o{constructor(t,e,r=0){super(),this.sourceIter=t,this.length=e,this.limit=e,this.skip=r}setLimitSkip(t,e=0){this.limit=t,this.skip=e}async*[Symbol.asyncIterator](){if(!(this.limit<=0))for await(let t of this.sourceIter){if(this.skip>0){if(!(t.length>=this.skip)){this.skip-=t.length;continue}{const[e,r]=u.splitChunk(t,this.skip);t=r,this.skip=0}}if(t.length>this.limit){const[e,r]=u.splitChunk(t,this.limit);t=e,this.sourceIter._unread(r)}if(t.length&&(this.limit-=t.length,yield t),this.limit<=0)break}}async readlineRaw(t){if(this.limit<=0)return null;const e=await this.sourceIter.readlineRaw(t?Math.min(t,this.limit):this.limit);return this.limit-=e.length,e}async skipFully(){const t=this.limit;for(;this.limit>0;)this.limit-=await this.sourceIter.readSize(this.limit,!0);return t}}class h{constructor({statusline:t,headers:e}){this.statusline=t,this.headers=e}toString(){const t=[this.statusline];for(const[e,r]of this.headers)t.push(`${e}: ${r}`);return t.join("\r\n")+"\r\n"}_parseResponseStatusLine(){const t=l(this.statusline," ",2);this._protocol=t[0],this._statusCode=t.length>1?Number(t[1]):"",this._statusText=t.length>2?t[2]:""}get statusCode(){return void 0===this._statusCode&&this._parseResponseStatusLine(),this._statusCode}get protocol(){return void 0===this._protocol&&this._parseResponseStatusLine(),this._protocol}get statusText(){return void 0===this._statusText&&this._parseResponseStatusLine(),this._statusText}_parseRequestStatusLine(){const t=this.statusline.split(" ",2);this._method=t[0],this._requestPath=t.length>1?t[1]:""}get method(){return void 0===this._method&&this._parseRequestStatusLine(),this._method}get requestPath(){return void 0===this._requestPath&&this._parseRequestStatusLine(),this._requestPath}}class c{startsWithSpace(t){const e=t.charAt(0);return" "===e||"\t"===e}async parse(t,{headersClass:e=Map}={}){const r=await t.readline();if(!r)return null;let i=r.trimEnd();const n=new e;if(!i)return null;let s=(await t.readline()).trimEnd();for(;s;){let[e,r]=l(s,":",1);r&&(e=e.trimStart(),r=r.trim());let i=(await t.readline()).trimEnd();for(;this.startsWithSpace(i);)r&&(r+=i),i=(await t.readline()).trimEnd();if(r)try{n.set(e,r)}catch(t){}s=i}return new h({statusline:i,headers:n,totalRead:this.totalRead})}}function l(t,e,r){const i=t.split(e),n=i.slice(0,r);return i.slice(r).length>0&&n.push(i.slice(r).join(e)),n}const p=new TextDecoder("utf-8");class d extends o{constructor({warcHeaders:t,reader:e}){super(),this.warcHeaders=t,this.headersLen=0,this._reader=new u(e,this.warcContentLength),this._contentReader=null,this.payload=null,this.httpHeaders=null,this.consumed=!1,this.fixUp()}_addHttpHeaders(t,e){this.httpHeaders=t,this.headersLen=e,this._reader.setLimitSkip(this.warcContentLength-this.headersLen)}getResponseInfo(){const t=this.httpHeaders;return t?{headers:t.headers,status:t.statusCode,statusText:t.statusText}:null}fixUp(){const t=this.warcHeaders.headers.get("WARC-Target-URI");t&&t.startsWith("<")&&t.endsWith(">")&&this.warcHeaders.headers.set("WARC-Target-URI",t.slice(1,-1))}async readFully(t=!1){if(this.httpHeaders){if(this._contentReader&&!t)throw new TypeError("WARC Record decoding already started, but requesting raw payload");if(t&&"raw"===this.consumed&&this.payload)return await this._createDecodingReader([this.payload]).readFully()}return this.payload||(t?(this.payload=await super.readFully(),this.consumed="content"):(this.payload=await this._reader.readFully(),this.consumed="raw")),this.payload}get reader(){if(this._contentReader)throw new TypeError("WARC Record decoding already started, but requesting raw payload");return this._reader}get contentReader(){return this.httpHeaders?(this._contentReader||(this._contentReader=this._createDecodingReader(this._reader)),this._contentReader):this._reader}_createDecodingReader(t){let e=this.httpHeaders.headers.get("content-encoding"),r=this.httpHeaders.headers.get("transfer-encoding");const i="chunked"===r;return e||i||(e=r),new a(t,e,i)}async readlineRaw(t){if(this.consumed)throw new Error("Record already consumed.. Perhaps a promise was not awaited?");return this.contentReader.readlineRaw(t)}async contentText(){const t=await this.readFully(!0);return p.decode(t)}async*[Symbol.asyncIterator](){for await(const t of this.contentReader)if(yield t,this.consumed)throw new Error("Record already consumed.. Perhaps a promise was not awaited?");this.consumed="content"}async skipFully(){if(this.consumed)return;const t=await this._reader.skipFully();return this.consumed="skipped",t}warcHeader(t){return this.warcHeaders.headers.get(t)}get warcType(){return this.warcHeaders.headers.get("WARC-Type")}get warcTargetURI(){return this.warcHeaders.headers.get("WARC-Target-URI")}get warcDate(){return this.warcHeaders.headers.get("WARC-Date")}get warcRefersToTargetURI(){return this.warcHeaders.headers.get("WARC-Refers-To-Target-URI")}get warcRefersToDate(){return this.warcHeaders.headers.get("WARC-Refers-To-Date")}get warcPayloadDigest(){return this.warcHeaders.headers.get("WARC-Payload-Digest")}get warcContentType(){return this.warcHeaders.headers.get("Content-Type")}get warcContentLength(){return Number(this.warcHeaders.headers.get("Content-Length"))}}class f{static parse(t,e){return new f(t,e).parse()}static iterRecords(t,e){return new f(t,e)}constructor(t,{keepHeadersCase:e=!1,parseHttp:r=!0}={}){this._offset=0,this._warcHeadersLength=0,this._headersClass=e?Map:Headers,this._parseHttp=r,this._atRecordBoundary=!0,t instanceof a||(t=new a(t)),this._reader=t,this._record=null}async readToNextRecord(){!this._atRecordBoundary&&this._reader&&this._record&&(await this._record.skipFully(),await this._reader.readSize(4,!0),this._atRecordBoundary=!0)}async parse(){await this.readToNextRecord(),this._offset=this._reader.getRawOffset();const t=new c,e=await t.parse(this._reader,{headersClass:this._headersClass});if(!e)return null;this._warcHeadersLength=this._reader.getReadOffset();const r=new d({warcHeaders:e,reader:this._reader});if(this._atRecordBoundary=!1,this._record=r,this._parseHttp)switch(r.warcType){case"response":case"request":await this._addHttpHeaders(r,t,this._reader);break;case"revisit":r.warcContentLength>0&&await this._addHttpHeaders(r,t,this._reader)}return r}get offset(){return this._offset}get recordLength(){return this._reader.getRawLength(this._offset)}async*[Symbol.asyncIterator](){let t=null;for(;t=await this.parse(this._reader);)yield t;this._record=null}async _addHttpHeaders(t,e,r){const i=await e.parse(r,{headersClass:this._headersClass});t._addHttpHeaders(i,r.getReadOffset()-this._warcHeadersLength)}}const m="offset,warc-type,warc-target-uri".split(",");const w="urlkey,timestamp,url,mime,status,digest,length,offset,filename".split(","),g="urlkey,timestamp,url,mime,status,digest,redirect,meta,length,offset,filename".split(",");class y extends class extends class{constructor(t,e){this.opts=t,this.out=e}write(t){this.out.write(JSON.stringify(t)+"\n")}async run(t){for await(const e of this.iterIndex(t))this.write(e)}async*iterIndex(t){const e={strictHeaders:!0,parseHttp:this.parseHttp};for(const{filename:r,reader:i}of t){if(!r||!i)continue;const t=new f(i,e);for await(const e of t){await e.skipFully();const i=this.indexRecord(e,t,r);i&&(yield i)}}}indexRecord(t,e,r){if(this.filterRecord&&!this.filterRecord(t))return null;const i={},n={offset:e.offset,length:e.recordLength,filename:r};for(const e of this.fields)null!=n[e]?i[e]=n[e]:this.setField(e,t,i);return i}setField(t,e,r){const i=this.getField(t,e);null!=i&&(r[t]=i)}getField(t,e){return"http:status"===t?!e.httpHeaders||"response"!==e.warcType&&"revisit"!==e.warcType?null:e.httpHeaders.statusCode:t.startsWith("http:")?e.httpHeaders?e.httpHeaders.headers.get(t.slice(5)):null:e.warcHeaders.headers.get(t)}}{constructor(t={},e=null){if(super(t,e),t.fields){this.fields=t.fields.split(","),this.parseHttp=!1;for(const t of this.fields)if(t.startsWith("http:")){this.parseHttp=!0;break}}else this.fields=m,this.parseHttp=!1}}{constructor(t={},e=null){switch(super(t,e),this.includeAll=t.all,this.fields=w,this.parseHttp=!0,t.format){case"cdxj":this.write=this.writeCDXJ;break;case"cdx":this.write=this.writeCDX11}}filterRecord(t){if(this.includeAll)return!0;const e=t.warcType;return"request"!==e&&"warcinfo"!==e}writeCDXJ(t){const{urlkey:e,timestamp:r}=t;delete t.urlkey,delete t.timestamp,this.out.write(`${e} ${r} ${JSON.stringify(t)}\n`)}writeCDX11(t){const e=[];for(const r of g)e.push(null!=t[r]?t[r]:"-");this.out.write(e.join(" ")+"\n")}getField(t,e){let r=null;switch(t){case"urlkey":return this.getSurt(e.warcTargetURI);case"timestamp":return r=e.warcDate,r.replace(/[-:T]/g,"").slice(0,14);case"url":return e.warcTargetURI;case"mime":switch(e.warcType){case"revisit":return"warc/revisit";case"response":case"request":t="http:content-type";break;default:t="content-type"}return r=super.getField(t,e),r?r.split(";",1)[0].trim():null;case"status":return super.getField("http:status",e);case"digest":return r=e.warcPayloadDigest,r?r.split(":",2)[1]:null}}getSurt(t){try{const e=new URL(t);let r=e.hostname.split(".").reverse().join(",");return e.port&&(r+=":"+e.port),r+=")",r+=e.pathname,r.toLowerCase()}catch(e){return t}}}},,,,function(t,e,r){"use strict";var i=r(32),n=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],s=["scalar","sequence","mapping"];t.exports=function(t,e){var r,o;if(e=e||{},Object.keys(e).forEach((function(e){if(-1===n.indexOf(e))throw new i('Unknown option "'+e+'" is met in definition of "'+t+'" YAML type.')})),this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(t){return t},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.defaultStyle=e.defaultStyle||null,this.styleAliases=(r=e.styleAliases||null,o={},null!==r&&Object.keys(r).forEach((function(t){r[t].forEach((function(e){o[String(e)]=t}))})),o),-1===s.indexOf(this.kind))throw new i('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}},,,function(t,e,r){"use strict";(function(t){ /*! * The buffer module from node.js, for the browser. * diff --git a/index.js b/index.js deleted file mode 100644 index 0acdcfb..0000000 --- a/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import './src/frontend'; - - diff --git a/package.json b/package.json index 283c80c..bd6dfc3 100644 --- a/package.json +++ b/package.json @@ -42,17 +42,18 @@ "build-electron": "yarn run build && yarn run pack" }, "build": { - "afterSign": "notarize.js", + "afterSign": "build/notarize.js", "productName": "ReplayWeb.page", "asar": true, "appId": "net.webrecorder.replaywebpage", "artifactName": "${name}-${version}.${ext}", "files": [ + "!**/*", "!**/node_modules/**/*", + "package.json", "dist/*.js", - "index.html", - "sw.js", - "package.json" + "docs/*.js", + "docs/index.html" ], "extraResources": [ "plugins" diff --git a/src/electron-main.js b/src/electron-main.js index 7b9ac47..1a0a4f0 100644 --- a/src/electron-main.js +++ b/src/electron-main.js @@ -19,19 +19,22 @@ const REPLAY_PREFIX = STATIC_PREFIX + "wabac/"; const STATIC_PATHS = { 'index.html': 'text/html', - 'dist/frontend.js': 'application/javascript', - 'dist/sw.js': 'application/javascript', + 'frontend.js': 'application/javascript', 'sw.js': 'application/javascript' }; const URL_RX = /([^\/]+)\/([\d]+)(?:\w\w_)?\/(.*)$/; const appPath = app.getAppPath(); + const projPath = path.join(appPath, "../"); +const staticContentPath = path.join(__dirname, "../", "docs"); + const pluginPath = path.join(projPath, "plugins", "PepperFlashPlayer.plugin"); console.log('app path', appPath); +console.log('dir name', __dirname); console.log('proj path', projPath); console.log('plugin path', pluginPath); @@ -72,7 +75,7 @@ async function doIntercept(request, callback) { const type = STATIC_PATHS[filename]; if (type) { - const fullPath = path.join(__dirname, "../", filename); + const fullPath = path.join(staticContentPath, filename); console.log("fullPath: " + fullPath); diff --git a/webpack.config.js b/webpack.config.js index d84a8d8..2aa7c2c 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -63,23 +63,11 @@ const browserConfig = (env, argv) => { }, output: { - path: path.join(__dirname, 'dist'), - filename: (chunkData) => { - switch (chunkData.chunk.name) { - case 'sw': - return !IS_DEV_SERVER ? '../[name].js': '[name].js'; - - case 'wombat': - return '../static/[name].js'; - - case 'frontend': - default: - return '[name].js'; - } - }, + path: path.join(__dirname, 'docs'), + filename: '[name].js', libraryTarget: 'self', globalObject: 'self', - publicPath: '/dist/' + publicPath: '/' }, externals: { @@ -89,15 +77,15 @@ const browserConfig = (env, argv) => { devServer: { compress: true, port: 9990, - headers: {'Service-Worker-Allowed': '/'}, open: false, - publicPath: '/dist/' + contentBase: path.join(__dirname, 'docs'), + publicPath: '/' }, plugins: [ new MiniCssExtractPlugin(), new webpack.DefinePlugin({ - __SW_PATH__: JSON.stringify(!IS_DEV_SERVER ? './sw.js' : './dist/sw.js'), + __SW_PATH__: JSON.stringify('./sw.js'), __APP_FILE_SERVE_PREFIX__ : JSON.stringify(APP_FILE_SERVE_PREFIX), }), ],