From a9fda069bee99c7c02355c61410069f303dd7e73 Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Fri, 31 May 2024 14:45:57 -0700 Subject: [PATCH] Btrix Integration Fixes (#215) - Fix exception if login info is missing - Rename Browsertrix Cloud -> Browsertrix - Default Browsertrix URL and placeholder to 'app.browsertrix.com' - Add link to browsertrix.com for more info on Browsertrix --- dist/embed/ui.js | 27 ++++++++++++++------------- src/ui/app.js | 25 ++++++++++++++++++------- src/ui/upload.js | 10 +++++----- 3 files changed, 37 insertions(+), 25 deletions(-) diff --git a/dist/embed/ui.js b/dist/embed/ui.js index 5704d270..8bccdaea 100644 --- a/dist/embed/ui.js +++ b/dist/embed/ui.js @@ -6,7 +6,7 @@ * Licence: Apache-2.0 * https://github.com/nextapps-de/flexsearch */ -function _f(self){"use strict";try{module&&(self=module)}catch(e){}var t;function u(e){return void 0===e||e}function aa(e){const t=Array(e);for(let i=0;i=a))));p++);if(i)return o?ta(l,a,0):void(t[t.length]=l)}return!i&&l}function ta(e,t,i){return e=1===e.length?e[0]:[].concat.apply([],e),i||e.length>t?e.slice(i,i+t):e}function ua(e,t,i,a){return i?e=(e=e[(a=a&&t>i)?t:i])&&e[a?i:t]:e=e[t],e}function N(e,t,i,a,r){let o=0;if(e.constructor===Array)if(r)-1!==(t=e.indexOf(t))?1=this.B&&(h||!d[f])){var o=L(p,a,u),s="";switch(this.G){case"full":if(2o;n--)if(n-o>=this.B){var l=L(p,a,u,r,o);M(this,d,s=f.substring(o,n),l,e,i)}break}case"reverse":if(1=this.B&&M(this,d,s,L(p,a,u,r,n),e,i);s=""}case"forward":if(1=this.B&&M(this,d,s,o,e,i);break}default:if(this.C&&(o=Math.min(o/this.C(t,f,u)|0,p-1)),M(this,d,f,o,e,i),h&&1=this.B&&!r[f]){r[f]=1;const t=this.l&&f>o;M(this,c,t?o:f,L(s+(a/2>s?0:1),a,u,n-1,l-1),e,i,t?f:o)}}}}this.m||(this.register[e]=1)}}return this},t.search=function(e,t,i){i||(!t&&C(e)?e=(i=e).query:C(t)&&(i=t));let a,r,o,s,n,l=[],c=0;if(i){e=i.query||e,t=i.limit,c=i.offset||0;var d=i.context;r=i.suggest}if(e&&(a=(e=this.encode(""+e)).length,1=this.B&&!i[t]){if(!(this.s||r||this.map[t]))return l;h[s++]=t,i[t]=1}a=(e=h).length}if(!a)return l;for(t||(t=100),i=0,(d=this.depth&&1t||i)&&(r=r.slice(i,i+t)),a&&(r=za.call(this,r)),{tag:e,result:r}}function za(e){const t=Array(e.length);for(let i,a=0;a{"use strict";const t=["B","kB","MB","GB","TB","PB","EB","ZB","YB"],i=["B","kiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],a=["b","kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],r=["b","kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],o=(e,t,i)=>{let a=e;return"string"==typeof t||Array.isArray(t)?a=e.toLocaleString(t,i):!0!==t&&void 0===i||(a=e.toLocaleString(void 0,i)),a};e.exports=(e,s)=>{if(!Number.isFinite(e))throw new TypeError(`Expected a finite number, got ${typeof e}: ${e}`);const n=(s=Object.assign({bits:!1,binary:!1},s)).bits?s.binary?r:a:s.binary?i:t;if(s.signed&&0===e)return` 0 ${n[0]}`;const l=e<0,c=l?"-":s.signed?"+":"";let d;if(l&&(e=-e),void 0!==s.minimumFractionDigits&&(d={minimumFractionDigits:s.minimumFractionDigits}),void 0!==s.maximumFractionDigits&&(d=Object.assign({maximumFractionDigits:s.maximumFractionDigits},d)),e<1){return c+o(e,s.locale,d)+" "+n[0]}const h=Math.min(Math.floor(s.binary?Math.log(e)/Math.log(1024):Math.log10(e)/3),n.length-1);e/=Math.pow(s.binary?1024:1e3,h),d||(e=e.toPrecision(3));return c+o(Number(e),s.locale,d)+" "+n[h]}},3873:e=>{e.exports=''},9696:e=>{e.exports=''},6420:e=>{e.exports=''},2785:e=>{e.exports=''},4722:e=>{e.exports=''},5275:e=>{e.exports=''},886:e=>{e.exports=''},4562:e=>{e.exports=''},2383:e=>{e.exports=''},6400:e=>{e.exports=''},5729:e=>{e.exports=''},3898:e=>{e.exports=''},8657:e=>{e.exports=''},6532:e=>{e.exports=''},4939:e=>{e.exports=''},4e3:e=>{e.exports=''},1294:e=>{e.exports=''},7050:e=>{e.exports=''},504:e=>{e.exports=''},96:e=>{e.exports=''},5017:e=>{e.exports=''},2427:e=>{e.exports=''},5555:e=>{e.exports=''},5139:e=>{e.exports=''},3525:e=>{e.exports=''},1940:e=>{e.exports=''},5111:e=>{e.exports=''},494:e=>{e.exports=''},8340:e=>{e.exports=''},9397:e=>{e.exports=''},7087:e=>{e.exports=''},1995:e=>{e.exports=''},4688:e=>{e.exports=''},8360:e=>{e.exports=''},5403:e=>{e.exports=''},2724:e=>{e.exports=''},2740:e=>{e.exports=''},9671:e=>{e.exports=''},5364:e=>{e.exports=''},1453:e=>{e.exports=''},3954:e=>{e.exports=''},6736:e=>{e.exports=''},7948:e=>{e.exports=''}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var i=__webpack_module_cache__[e]={id:e,loaded:!1,exports:{}};return __webpack_modules__[e].call(i.exports,i,i.exports,__webpack_require__),i.loaded=!0,i.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var i in t)__webpack_require__.o(t,i)&&!__webpack_require__.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var __webpack_exports__={};(()=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{ArchiveWebApp:()=>zr,Embed:()=>ca,Loader:()=>ji}); +function _f(self){"use strict";try{module&&(self=module)}catch(e){}var t;function u(e){return void 0===e||e}function aa(e){const t=Array(e);for(let i=0;i=a))));p++);if(i)return o?ta(l,a,0):void(t[t.length]=l)}return!i&&l}function ta(e,t,i){return e=1===e.length?e[0]:[].concat.apply([],e),i||e.length>t?e.slice(i,i+t):e}function ua(e,t,i,a){return i?e=(e=e[(a=a&&t>i)?t:i])&&e[a?i:t]:e=e[t],e}function N(e,t,i,a,r){let o=0;if(e.constructor===Array)if(r)-1!==(t=e.indexOf(t))?1=this.B&&(h||!d[f])){var o=L(p,a,u),s="";switch(this.G){case"full":if(2o;n--)if(n-o>=this.B){var l=L(p,a,u,r,o);M(this,d,s=f.substring(o,n),l,e,i)}break}case"reverse":if(1=this.B&&M(this,d,s,L(p,a,u,r,n),e,i);s=""}case"forward":if(1=this.B&&M(this,d,s,o,e,i);break}default:if(this.C&&(o=Math.min(o/this.C(t,f,u)|0,p-1)),M(this,d,f,o,e,i),h&&1=this.B&&!r[f]){r[f]=1;const t=this.l&&f>o;M(this,c,t?o:f,L(s+(a/2>s?0:1),a,u,n-1,l-1),e,i,t?f:o)}}}}this.m||(this.register[e]=1)}}return this},t.search=function(e,t,i){i||(!t&&C(e)?e=(i=e).query:C(t)&&(i=t));let a,r,o,s,n,l=[],c=0;if(i){e=i.query||e,t=i.limit,c=i.offset||0;var d=i.context;r=i.suggest}if(e&&(a=(e=this.encode(""+e)).length,1=this.B&&!i[t]){if(!(this.s||r||this.map[t]))return l;h[s++]=t,i[t]=1}a=(e=h).length}if(!a)return l;for(t||(t=100),i=0,(d=this.depth&&1t||i)&&(r=r.slice(i,i+t)),a&&(r=za.call(this,r)),{tag:e,result:r}}function za(e){const t=Array(e.length);for(let i,a=0;a{"use strict";const t=["B","kB","MB","GB","TB","PB","EB","ZB","YB"],i=["B","kiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],a=["b","kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],r=["b","kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],o=(e,t,i)=>{let a=e;return"string"==typeof t||Array.isArray(t)?a=e.toLocaleString(t,i):!0!==t&&void 0===i||(a=e.toLocaleString(void 0,i)),a};e.exports=(e,s)=>{if(!Number.isFinite(e))throw new TypeError(`Expected a finite number, got ${typeof e}: ${e}`);const n=(s=Object.assign({bits:!1,binary:!1},s)).bits?s.binary?r:a:s.binary?i:t;if(s.signed&&0===e)return` 0 ${n[0]}`;const l=e<0,c=l?"-":s.signed?"+":"";let d;if(l&&(e=-e),void 0!==s.minimumFractionDigits&&(d={minimumFractionDigits:s.minimumFractionDigits}),void 0!==s.maximumFractionDigits&&(d=Object.assign({maximumFractionDigits:s.maximumFractionDigits},d)),e<1){return c+o(e,s.locale,d)+" "+n[0]}const h=Math.min(Math.floor(s.binary?Math.log(e)/Math.log(1024):Math.log10(e)/3),n.length-1);e/=Math.pow(s.binary?1024:1e3,h),d||(e=e.toPrecision(3));return c+o(Number(e),s.locale,d)+" "+n[h]}},3873:e=>{e.exports=''},9696:e=>{e.exports=''},6420:e=>{e.exports=''},2785:e=>{e.exports=''},4722:e=>{e.exports=''},5275:e=>{e.exports=''},886:e=>{e.exports=''},4562:e=>{e.exports=''},2383:e=>{e.exports=''},6400:e=>{e.exports=''},5729:e=>{e.exports=''},3898:e=>{e.exports=''},8657:e=>{e.exports=''},6532:e=>{e.exports=''},4939:e=>{e.exports=''},4e3:e=>{e.exports=''},1294:e=>{e.exports=''},7050:e=>{e.exports=''},504:e=>{e.exports=''},96:e=>{e.exports=''},5017:e=>{e.exports=''},2427:e=>{e.exports=''},5555:e=>{e.exports=''},5139:e=>{e.exports=''},3525:e=>{e.exports=''},1940:e=>{e.exports=''},5111:e=>{e.exports=''},494:e=>{e.exports=''},8340:e=>{e.exports=''},9397:e=>{e.exports=''},7087:e=>{e.exports=''},1995:e=>{e.exports=''},4688:e=>{e.exports=''},8360:e=>{e.exports=''},5403:e=>{e.exports=''},2724:e=>{e.exports=''},2740:e=>{e.exports=''},9671:e=>{e.exports=''},5364:e=>{e.exports=''},1453:e=>{e.exports=''},3954:e=>{e.exports=''},6736:e=>{e.exports=''},7948:e=>{e.exports=''}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var i=__webpack_module_cache__[e]={id:e,loaded:!1,exports:{}};return __webpack_modules__[e].call(i.exports,i,i.exports,__webpack_require__),i.loaded=!0,i.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var i in t)__webpack_require__.o(t,i)&&!__webpack_require__.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var __webpack_exports__={};(()=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{ArchiveWebApp:()=>Cr,Embed:()=>ca,Loader:()=>ji}); /** * @license * Copyright 2019 Google LLC @@ -3672,7 +3672,7 @@ function*(e,t){if(void 0!==e){let i=0;for(const a of e)yield t(a,i++)}}(e.resour `:null}onIpfsShare(e){e.detail.pending?this.ipfsSharePending++:this.ipfsSharePending--}onDeleteColl(e){if(e.preventDefault(),e.stopPropagation(),!this.sortedColls)return;const t=Number(e.currentTarget.getAttribute("data-coll-index"));this.deleteConfirm=this.sortedColls[t]}async doDelete(){if(!this.deleteConfirm)return;this._deleting[this.deleteConfirm.sourceUrl]=!0,this.requestUpdate();const e=this.renderRoot.querySelector(`wr-rec-coll-info[data-coll="${this.deleteConfirm.id}"]`);e&&await e.doDelete(),this.deleteConfirm=null}renderEmpty(){return N`No archived items. Click "New Archiving Session" above to begin archiving pages!`}});var Ua=__webpack_require__(3873),Pa=__webpack_require__.n(Ua);ca.setDefaultReplayFile("replay.html");class La extends ca{constructor(){super(),this.replaybase="./replay/",this.replayfile="record.html",this.mainElementName="archive-web-page-app",this.appName="Embedded ArchiveWeb.page",this.embed="default",this.noWebWorker=!0,this.proxyPrefix="https://wabac-cors-proxy.webrecorder.workers.dev/proxy/",this.archivePrefix="";const e=new URL(window.location);e.hash="",this.logo=Pa(),this.customConfig={prefix:this.proxyPrefix,isLive:!1,archivePrefix:this.archivePrefix,baseUrl:e.href,baseUrlHashReplay:!1,recording:!0,noPostToGet:!0},this.downloaded=null,this.source="proxy://"+this.proxyPrefix}static get properties(){return{...ca.properties,archivePrefix:{type:String},proxyPrefix:{type:String}}}updated(e){e.has("proxyPrefix")&&(this.customConfig.proxyPrefix=this.proxyPrefix),e.has("archivePrefix")&&(this.customConfig.archivePrefix=this.archivePrefix,this.customConfig.isLive=!this.archivePrefix),super.updated(e)}handleMessage(e){this.downloaded&&"object"==typeof e.data&&"downloadedBlob"===e.data.msg_type&&(this.downloaded(e.data.url),this.downloaded=null)}doDownload(){const e=this.renderRoot.querySelector("iframe");if(!e)return;const t=new Promise((e=>{this.downloaded=e}));return e.contentWindow.postMessage({msg_type:"downloadToBlob"}),t}}!async function(){customElements.define("record-web-page",La)}();var Da=__webpack_require__(3525),Ea=__webpack_require__.n(Da),Ta=__webpack_require__(2740),Ra=__webpack_require__.n(Ta);customElements.define("wr-btrix-upload",class extends oe{static get properties(){return{btrixOpts:{type:Object},coll:{type:Object},uploadColl:{type:Object},status:{type:String},uploadId:{type:String},uploadTime:{type:Number},isUploadNeeded:{type:Boolean},actualSize:{type:Number},uploadSize:{type:Number},uploadTotal:{type:Number}}}static get styles(){return ye(s``)}updated(e){if(e.has("uploadColl")){const{coll:e,isUploadNeeded:t}=this.uploadColl;this.coll=e,this.actualSize=0,this.isUploadNeeded=t,this.uploadTime=this.coll.uploadTime,this.uploadId=this.coll.uploadId}e.has("coll")&&this.coll&&this.pollUploadState()}async pollUploadState(){if(this.pollingUploadState)return;this.pollingUploadState=!0;for(;;){const e=await fetch(`./w/api/c/${this.coll.id}/upload`),t=await e.json();if(this.status=t.status,this.uploadTime=t.uploadTime,this.uploadId=t.uploadId,"uploading"===this.status?this.isUploadNeeded=!1:"idle"===this.status&&this.btrixOpts&&this.btrixOpts.client&&t.uploadTime&&t.uploadId&&t.mtime<=t.uploadTime?this.getRemoteUpload():this.uploadId||(this.isUploadNeeded=!0),this.uploadSize=t.size,this.uploadTotal=t.totalSize,"uploading"!==this.status)break;await new Promise((e=>setTimeout(e,1e3)))}this.pollingUploadState=!1}async getRemoteUpload(){try{const e=await this.btrixOpts.client.getRemoteUpload(this.uploadId);this.actualSize=e.fileSize}catch(e){this.isUploadNeeded=!0,this.status="missing"}}render(){if(!this.coll)return N``;const e=this.uploadTime,t=!this.isUploadNeeded&&e;let i="";try{if(this.btrixOpts.client&&this.uploadId){const{client:e}=this.btrixOpts;i=new URL(`/orgs/${e.defaultOrg}/artifacts/upload/${this.uploadId}`,e.url).href}}catch(e){}return N` + title="Upload To Browsertrix"> @@ -3697,7 +3697,7 @@ function*(e,t){if(void 0!==e){let i=0;for(const a of e)yield t(a,i++)}}(e.resour + View in Browsertrix`:""}
Collection:Link: - View in Browsertrix Cloud
@@ -3729,20 +3729,20 @@ function*(e,t){if(void 0!==e){let i=0;for(const a of e)yield t(a,i++)}}(e.resour

`:N`

Archive not yet uploaded. Click "Upload" below to start.

`:N`

- Archive already uploaded to Browsertrix Cloud. + Archive already uploaded to Browsertrix. ${this.renderDeleteUploaded()}

- `;case"deleted":return N`

Upload to Browsertrix Cloud has been deleted.

+ `;case"deleted":return N`

Upload to Browsertrix has been deleted.

(Data is still saved locally in your browser)

`;case"deleteFailed":return N`

Sorry, deleting upload has failed, or, the Browsertrix credentials may be incorrect.

;

Check your credentials in Settings and then click Delete to try again. ${this.renderDeleteUploaded()}

`;default:return""}}renderDeleteUploaded(){return N` - - `}async onUpload(){const e=this.btrixOpts.client,t=await e.getOrg(this.btrixOpts.orgName),i=new URL(`/api/orgs/${t}/uploads/stream`,e.url);this.uploadId&&i.searchParams.set("replaceId",this.uploadId);const a=(new Date).toLocaleString();i.searchParams.set("notes",`Uploaded by ArchiveWeb.page 0.11.4 at ${a}`);const r=i.href,o={Authorization:e.auth},s=JSON.stringify({url:r,headers:o});this.status="uploading",this.uploadSize=0,this.uploadTotal=0;const n=await fetch(`./w/api/c/${this.coll.id}/upload?format=wacz&pages=all`,{method:"POST",body:s});(await n.json()).uploading&&this.pollUploadState()}async onCancelUpload(){const e=JSON.stringify({abortUpload:!0});await fetch(`./w/api/c/${this.coll.id}/upload`,{method:"POST",body:e}),this.pollUploadState()}async onDeleteUpload(){try{const{client:e}=this.btrixOpts;if(!e)return;await e.deleteUpload(this.uploadId),await fetch(`./w/api/c/${this.coll.id}/upload`,{method:"DELETE"}),this.status="deleted",this.isUploadNeeded=!0,this.uploadTime=this.btrixOpts.uploadTime=null,this.uploadId=this.btrixOpts.uploadId=null}catch(e){this.status="deleteFailed"}}});class Oa{static async login({url:e,username:t,password:i,orgName:a}){const r=e+"/api/auth/jwt/login",o=new FormData;o.append("username",t),o.append("password",i);const s=await fetch(r,{method:"POST",body:o}),n=await s.json(),{token_type:l,access_token:c}=n;if(!c||!l)throw new Error("Invalid login");const d=new Oa(e,l+" "+c),h=await d.getOrg(a);return d.defaultOrg=h,d}constructor(e,t){this.url=e,this.auth=t,this.defaultOrg=null}async fetchAPI(e,t="GET",i=null){const a={Authorization:this.auth};"GET"!==t&&(a["Content-Type"]="application/json");try{const r=await fetch(this.url+e,{headers:a,method:t,body:i,duplex:"half"});return await r.json()}catch(e){return console.warn(e),{}}}async getOrg(e=""){const t=await this.fetchAPI("/api/users/me-with-orgs"),{orgs:i}=t;if(!i||!i.length)return null;if(!e)return i[0].id;for(const t of i)if(t.name===e)return t.id;return i[0].id}async getRemoteUpload(e,t=null){const i=this.defaultOrg||t,a=await this.fetchAPI(`/api/orgs/${i}/uploads/${e}`);if(!a.name)throw new Error("upload_missing");return a}async deleteUpload(e,t=null){const i=this.defaultOrg||t,a=JSON.stringify({crawl_ids:[e]});if(!(await this.fetchAPI(`/api/orgs/${i}/uploads/delete`,"POST",a)).deleted)throw new Error("delete_failed")}}const qa="https://w3s.link/";function Na(e){const{hostname:t,protocol:i,pathname:a}=new URL(e),r=i.slice(0,-1);if(!t){const[e,...t]=a.slice(2).split("/");return{type:r,cid:e,path:"/"+t.join("/")}}return{type:r,cid:t,path:a}}async function Ma(e){return Ga(e)?e:Va(e)?ja(e):e}async function Fa(e){return new Response(e).blob()}async function*Ba(e){const t=await e.getReader();try{for(;;){const{done:e,value:i}=await t.read();if(e)return;yield i}}finally{t.releaseLock()}}function ja(e){let t=e;t.next||(t=e[Symbol.asyncIterator]());const i=new TextEncoder;return new ReadableStream({async pull(e){const{value:a,done:r}=await t.next();if(r)await e.close();else{let t=a;"string"==typeof t&&(t=i.encode(t)),await e.enqueue(t)}}})}async function Ha(e){if(!e.ok){const t=await e.text(),i=e.status;throw new Error(`HTTP Error ${i}: ${t}`)}}async function Wa({url:e,file:t,fileName:i="",parameterName:a="file",fetch:r=globalThis.fetch,signal:o}){const s=new FormData,n=new Headers;Ka(e,n);const l=await async function(e){if(Ga(e))return await Fa(e);if(Va(e)){const t=ja(e);return await Fa(t)}return e instanceof Blob?e:new Blob([e])}(t);i?s.append(a,l,i):s.append(a,l);const c=await r(e,{method:"POST",body:s,headers:n,signal:o});return await Ha(c),c}function Ga(e){return"function"==typeof e.getReader}function Va(e){return e[Symbol.asyncIterator]}function Ka(e,t){if(e.password)if(e.username){const i=`Basic ${btoa(`${unescape(e.username)}:${unescape(e.password)}`)}`;t.append("Authorization",unescape(i)),e.username="",e.password=""}else{const i=`Bearer ${e.password}`;t.append("Authorization",unescape(i)),e.password=""}}async function Za({url:e,fetch:t=globalThis.fetch,signal:i}){const a=await t(e,{method:"HEAD",signal:i});await Ha(a);const r=a.headers.get("x-ipfs-datasize")||a.headers.get("Content-Length");return parseInt(r,10)}async function*Ja({url:e,start:t,end:i,format:a,signal:r,fetch:o=globalThis.fetch}){const s=new Headers;Number.isInteger(t)&&(Number.isInteger(i)?s.set("Range",`bytes=${t}-${i}`):s.set("Range",`bytes=${t}-`));const n=new URL(e);a&&(s.set("Accept",`application/vnd.ipld.${a}`),s.set("cache-control","no-cache"));const l=await o(n.href,{headers:s,signal:r});await Ha(l),yield*Ba(l.body)}async function*Ya({url:e,start:t,end:i,format:a,signal:r,gatewayURL:o=Qa()}){const s=function(e,t=Qa()){const{cid:i,path:a,type:r}=Na(e);return new URL(`/${r}/${i}${a}`,t)}(e,o);yield*Ja({url:s,start:t,end:i,format:a,signal:r})}function Qa(){if(!globalThis.location)return qa;const{pathname:e,hostname:t,protocol:i}=globalThis.location;if(e.startsWith("/ipfs/")||e.startsWith("/ipns/"))return`${i}//${t}/`;const[a,...r]=t.split(".");return 59===a.length&&r.length>=2?`${i}//${r.join(".")}/`:qa}let Xa=!1;const er=[5001,45001,45002,45003,45004,45005],tr="https://api.web3.storage/",ir="https://api.estuary.tech/",ar="http://localhost:5001/",rr="agregore",or="daemon",sr="daemon:preferred",nr="web3.storage",lr="estuary",cr="readonly",dr=[sr,rr,or,nr,lr,cr];class hr{get type(){return"invalid"}async*get(e,{start:t,end:i,signal:a=null,format:r=null}={}){throw new Error("Not Implemented")}async getSize(e,t=null){throw new Error("Not Implemented")}async uploadCAR(e,t=null){throw new Error("Not Implemented")}async uploadFile(e,t,i=null){throw new Error("Not Implemented")}async clear(e,t=null){throw new Error("Not Implemented")}}async function pr({daemonURL:e,web3StorageToken:t,web3StorageURL:i=tr,estuaryToken:a,estuaryURL:r=ir,publicGatewayURL:o=Qa(),readonly:s=!0,timeout:n=1e3,fetch:l=globalThis.fetch}={}){const c=[],d=[];if(d.push(async function(e=globalThis.fetch){try{return await e("ipfs://localhost/"),!0}catch(e){return Xa&&console.warn("Unable to detect Agregore",e),!1}}(l).then((e=>e&&c.push({type:rr,fetch:l})))),d.push(async function(){const e=er.map((e=>`http://localhost:${e}`));try{const i=await Promise.any(e.map((e=>kr(e).then((t=>{if(t)return e;throw new Error("Not found")})))));return!!i&&(xr&&!wr&&(t=i,wr=!0,globalThis.chrome.webRequest.onBeforeSendHeaders.addListener((e=>{const{requestHeaders:i}=e;for(const e of i)if("origin"===e.name.toLowerCase())return e.value=t,{requestHeaders:i};return e.requestHeaders.push({name:"Origin",value:t}),{requestHeaders:i}}),{urls:[t+"/*"]},["blocking","requestHeaders","extraHeaders"])),i)}catch{return!1}var t}().then((e=>e&&c.push({type:or,url:e,fetch:l})))),e&&d.push(kr(e,n,l).then((t=>t&&c.push({type:sr,url:e,fetch:l})))),a){const e=r,t=a;c.push({type:lr,url:e,authorization:t,fetch:l,publicGatewayURL:o})}if(t){const e=i,a=t;c.push({type:nr,url:e,authorization:a,fetch:l,publicGatewayURL:o})}return s&&o&&c.push({type:cr,fetch:l,publicGatewayURL:o}),await Promise.allSettled(d),c}async function ur({chooseOrder:e=dr,...t}={}){const i=function(e,t=dr){const i=e.filter((({type:e})=>t.includes(e))).sort((({type:e},{type:i})=>t.indexOf(e)-t.indexOf(i)))[0];if(!i)throw new Error("Unable to find valid type");return i}(await pr(t),e);return async function(e){const{type:t}=e;let i=null;if(t===rr)i=new mr(e.fetch||globalThis.fetch);else if(t.startsWith(or))i=new vr(e.url);else if(t===nr)i=new gr(e.authorization,e.url,e.publicGatewayURL);else if(t===lr)i=new br(e.authorization,e.url,e.publicGatewayURL);else{if(t!==cr)throw new TypeError(`Unknown API type: ${t}.`);i=new fr(e.publicGatewayURL)}return i}(i)}class fr extends hr{constructor(e=Qa()){super(),this.gatewayURL=e}get type(){return cr}async*get(e,{start:t,end:i,signal:a=null,format:r=null}={}){yield*Ya({url:e,start:t,end:i,format:r,gatewayURL:this.gatewayURL,signal:a})}async getSize(e,t=null){const{cid:i,path:a,type:r}=Na(e);return Za({url:new URL(`/${r}/${i}${a}`,this.gatewayURL),signal:t})}}class br extends fr{constructor(e,t=ir,i=Qa()){super(i),this.authorization=e,this.url=t}get type(){return lr}async uploadCAR(e,t=null){throw new Error("Not Implemented")}async uploadFile(e,t,i=null){const a=new URL("/content/add",this.url);a.password=this.authorization;const r=await Wa({url:a,file:e,fileName:t,parameterName:"data",signal:i}),{cid:o}=await r.json();return`ipfs://${o}/`}}class mr extends hr{constructor(e=globalThis.fetch){super(),this.fetch=e}get type(){return rr}async*get(e,{start:t,end:i,signal:a=null,format:r=null}={}){const{fetch:o}=this;yield*Ja({url:e,start:t,end:i,format:r,fetch:o,signal:a})}async getSize(e,t=null){const{fetch:i}=this;return Za({url:e,fetch:i,signal:t})}async uploadCAR(e,t=null){const i=await Ma(e),{fetch:a}=this,r=await a("ipfs://localhost",{method:"POST",headers:{"Content-Type":"application/vnd.ipld.car"},signal:t,body:i});await Ha(r);return(await r.text()).split("\n")}async uploadFile(e,t=null){const i=await Ma(e),{fetch:a}=this,r=await a("ipfs://localhost",{method:"POST",headers:{"Content-Type":"application/octet-stream"},signal:t,body:i});return await Ha(r),r.headers.get("Location")}}class gr extends fr{constructor(e,t=tr,i=Qa()){super(i),this.authorization=e,this.url=t}get type(){return nr}async uploadCAR(e,t=null){const i=new URL("/car",this.url);i.password=this.authorization;const a=await async function({url:e,fileIterator:t,signal:i}){const a=new Headers;a.set("Content-Type","application/octet-stream"),Ka(e,a);const r=await Ma(t),o=await fetch(e,{method:"POST",signal:i,body:r,headers:a,duplex:"half"});return await Ha(o),o}({url:i,fileIterator:e,signal:t});return(await a.text()).split("\n").filter((e=>e)).map((e=>{const{cid:t}=JSON.parse(e);return`ipfs://${t}/`}))}async uploadFile(e,{fileName:t="",signal:i=null}={}){const a=new URL("/upload",this.url);a.password=this.authorization;const r=await Wa({url:a,file:e,fileName:t,signal:i}),{cid:o}=await r.json();return`ipfs://${o}/`}}class vr extends hr{constructor(e=ar){super(),this.url=e}get type(){return or}async*getFile(e,{start:t,end:i,signal:a=null,format:r=null}={}){const{cid:o,path:s,type:n}=Na(e),l=new URL(`/api/v0/cat?arg=/${n}/${o}${s}`,this.url);if(t&&l.searchParams.set("offset",t),i&&l.searchParams.set("length",i-(t||0)+1),r)throw new Error("Format is unsupported on Kubo Daemons for now");const c=await fetch(l,{method:"POST",signal:a});await Ha(c),yield*Ba(c.body)}async*getRaw(e,{signal:t=null}={}){const{cid:i,path:a,type:r}=Na(e),o=new URL(`/api/v0/block/get?arg=/${r}/${i}${a}`,this.url),s=await fetch(o,{method:"POST",signal:t});await Ha(s),yield*Ba(s.body)}async*getCar(e,{signal:t=null}={}){const{cid:i,path:a,type:r}=Na(e),o=new URL(`/api/v0/dag/export?arg=/${r}/${i}${a}`,this.url),s=await fetch(o,{method:"POST",signal:t});await Ha(s),yield*Ba(s.body)}async*get(e,{start:t,end:i,signal:a=null,format:r=null}={}){if(r)if("raw"===r)yield*this.getRaw(e,{start:t,end:i,signal:a});else{if("car"!==r)throw new Error(`Invalid format type, must be car or 'raw', got ${r}`);yield*this.getCar(e,{start:t,end:i,signal:a})}yield*this.getFile(e,{start:t,end:i,signal:a})}async getSize(e,t=null){try{const{cid:i,path:a,type:r}=Na(e),o=`/api/v0/file/ls?arg=/${r}/${i}${a}&size=true`,s=new URL(o,this.url),n=await fetch(s,{method:"POST",signal:t});await Ha(n);const{Objects:l}=await n.json(),[{Size:c}]=Object.values(l);return c}catch(i){return Xa&&console.warn(i),this._getSizeWithDag(e,t)}}async _getSizeWithDag(e,t=null){const{cid:i,path:a,type:r}=Na(e),o=new URL(`/api/v0/dag/stat?arg=/${r}/${i}${a}`,this.url),s=await fetch(o,{method:"POST",signal:t});await Ha(s);const{Size:n}=await s.json();return parseInt(n,10)}async _pin(e,t=null){const{cid:i,path:a,type:r}=Na(e),o=new URL(`/api/v0/pin/add?arg=/${r}/${i}${a}`,this.url),s=await fetch(o,{method:"POST",signal:t});await Ha(s)}async _unpin(e,t=null){const{cid:i,path:a,type:r}=Na(e),o=new URL(`/api/v0/pin/rm?arg=/${r}/${i}${a}`,this.url),s=await fetch(o,{method:"POST",signal:t});await Ha(s)}async clear(e,t=null){return this._unpin(e,t)}async uploadCAR(e,t=null){const i=new URL("/api/v0/dag/import?allow-big-block=true&pin-roots=true",this.url),a=await Wa({url:i,file:e,signal:t});return(await a.text()).split("\n").filter((e=>e)).map((e=>{const{Root:t}=JSON.parse(e);return`ipfs://${t.Cid["/"]}/`}))}async uploadFile(e,t="",i=null){const a=new URL("/api/v0/add?pin=true&cid-version=1&inline=false&raw-leaves=true",this.url),r=e.name&&e instanceof Blob;(t||r)&&a.searchParams.set("wrap-with-directory","true");const o=await Wa({url:a,file:e,fileName:t,signal:i}),s=await o.text(),[n]=s.split("\n"),{Hash:l}=JSON.parse(n),c=`ipfs://${l}/`;return await this._pin(c,i),c}}let wr=!1;const xr=!!(globalThis&&globalThis.chrome&&globalThis.chrome.webRequest&&globalThis.chrome.webRequest.onBeforeSendHeaders&&globalThis.chrome.webRequest.onBeforeSendHeaders.addListener);async function kr(e=ar,t=1e3,i=globalThis.fetch){try{const a=new AbortController,{signal:r}=a;setTimeout((()=>a.abort()),t);const o=await i(new URL("/api/v0/version",e),{method:"POST",signal:r});return!!o.ok||!(!o.status||404===o.status)}catch(t){return Xa&&console.warn("Unable to detect Kubo Daemon",t,e),!1}}function yr(e,t){return self.chrome&&self.chrome.storage?new Promise((i=>{const a={};a[e]=t,self.chrome.storage.local.set(a,(()=>i()))})):self.localStorage?Promise.resolve(localStorage.setItem(e,t)):Promise.reject()}function $r(e){return self.chrome&&self.chrome.storage?new Promise((t=>{self.chrome.storage.local.get(e,(i=>{t(i[e])}))})):self.localStorage?Promise.resolve(localStorage.getItem(e)):Promise.reject()}const Sr="0.11.4",_r="https://w3s.link/ipfs/";class zr extends Ne{constructor(){super(),this.navMenuShown=!1,this.showCollDrop=!1,this.colls=[],this.autorun=!1,this.settingsError="",this.settingsTab=localStorage.getItem("settingsTab")||"ipfs";try{const e=localStorage.getItem("ipfsOpts");this.ipfsOpts=JSON.parse(e)}catch(e){}this.ipfsOpts=this.ipfsOpts||{daemonUrl:"",message:"",useCustom:!1,autoDetect:!1,gatewayUrl:_r};try{const e=localStorage.getItem("btrixOpts");this.btrixOpts=JSON.parse(e),Oa.login(this.btrixOpts).then((e=>this.btrixOpts.client=e))}catch(e){this.btrixOpts=null}$r("autorunBehaviors").then((e=>this.autorun="1"===e)),window.archivewebpage&&window.archivewebpage.setDownloadCallback((e=>this.onDownloadProgress(e)))}get appName(){return"ArchiveWeb.page"}static get properties(){return{...Ne.properties,showStartRecord:{type:Boolean},showCollDrop:{type:Boolean},colls:{type:Array},selCollId:{type:String},selCollTitle:{type:String},recordUrl:{type:String},autorun:{type:Boolean},showNew:{type:String},showImport:{type:Boolean},isImportExisting:{type:Boolean},loadedCollId:{type:String},showDownloadProgress:{type:Boolean},download:{type:Object},ipfsOpts:{type:Object},btrixOpts:{type:Object},uploadCollOpts:{type:Object},showSettings:{type:Boolean},settingsTab:{type:String},settingsError:{type:String},showIpfsShareFailed:{type:Boolean}}}initRoute(){const e=new URLSearchParams(window.location.search);e.has("config")?(super.initRoute(),this.handleMessages()):(this.inited=!0,this.sourceUrl=e.get("source")||""),this.embed||this.checkIPFS()}handleMessages(){window.addEventListener("message",(async e=>{if(this.embed&&this.loadedCollId&&"object"==typeof e.data&&"downloadToBlob"===e.data.msg_type){const t=await fetch(`./w/api/c/${this.loadedCollId}/dl?format=wacz&pages=all`),i=await t.blob();e.source.postMessage({msg_type:"downloadedBlob",coll:this.loadedCollId,url:URL.createObjectURL(i)})}}))}onStartLoad(e){this.embed||(this.showImport=!1,this.sourceUrl=e.detail.sourceUrl,this.loadInfo=e.detail,this.isImportExisting&&this.selCollId&&(this.loadInfo.importCollId=this.selCollId))}onCollLoaded(e){if(this.loadInfo&&this.loadInfo.importCollId&&navigator.serviceWorker.controller){const e={msg_type:"reload",full:!0,name:this.loadInfo.importCollId};navigator.serviceWorker.controller.postMessage(e)}this.embed&&(this.loadedCollId=e.detail.collInfo&&e.detail.collInfo.coll),super.onCollLoaded(e),!e.detail.alreadyLoaded&&e.detail.sourceUrl&&e.detail.sourceUrl!==this.sourceUrl&&(this.sourceUrl=e.detail.sourceUrl)}getLoadInfo(e){if(this.disableCSP(),this.loadInfo)return this.loadInfo;return{customColl:e.startsWith("local://")?e.slice("local://".length):e}}async disableCSP(){if(this.embed||!self.chrome||!self.chrome.runtime)return;const e=navigator.userAgent.match(/Chrome\/([\d]+)/);if(!e||Number(e[1])<94)return;console.log("attempt to disable CSP to ensure replay works");let t=await new Promise((e=>{chrome.tabs.getCurrent((t=>e(t.id)))}));chrome.runtime.sendMessage({msg:"disableCSP",tabId:t})}static get styles(){return ye(zr.appStyles)}static get appStyles(){return ye(s` + `}async onUpload(){const e=this.btrixOpts.client,t=await e.getOrg(this.btrixOpts.orgName),i=new URL(`/api/orgs/${t}/uploads/stream`,e.url);this.uploadId&&i.searchParams.set("replaceId",this.uploadId);const a=(new Date).toLocaleString();i.searchParams.set("notes",`Uploaded by ArchiveWeb.page 0.11.4 at ${a}`);const r=i.href,o={Authorization:e.auth},s=JSON.stringify({url:r,headers:o});this.status="uploading",this.uploadSize=0,this.uploadTotal=0;const n=await fetch(`./w/api/c/${this.coll.id}/upload?format=wacz&pages=all`,{method:"POST",body:s});(await n.json()).uploading&&this.pollUploadState()}async onCancelUpload(){const e=JSON.stringify({abortUpload:!0});await fetch(`./w/api/c/${this.coll.id}/upload`,{method:"POST",body:e}),this.pollUploadState()}async onDeleteUpload(){try{const{client:e}=this.btrixOpts;if(!e)return;await e.deleteUpload(this.uploadId),await fetch(`./w/api/c/${this.coll.id}/upload`,{method:"DELETE"}),this.status="deleted",this.isUploadNeeded=!0,this.uploadTime=this.btrixOpts.uploadTime=null,this.uploadId=this.btrixOpts.uploadId=null}catch(e){this.status="deleteFailed"}}});class Oa{static async login({url:e,username:t,password:i,orgName:a}){const r=e+"/api/auth/jwt/login",o=new FormData;o.append("username",t),o.append("password",i);const s=await fetch(r,{method:"POST",body:o}),n=await s.json(),{token_type:l,access_token:c}=n;if(!c||!l)throw new Error("Invalid login");const d=new Oa(e,l+" "+c),h=await d.getOrg(a);return d.defaultOrg=h,d}constructor(e,t){this.url=e,this.auth=t,this.defaultOrg=null}async fetchAPI(e,t="GET",i=null){const a={Authorization:this.auth};"GET"!==t&&(a["Content-Type"]="application/json");try{const r=await fetch(this.url+e,{headers:a,method:t,body:i,duplex:"half"});return await r.json()}catch(e){return console.warn(e),{}}}async getOrg(e=""){const t=await this.fetchAPI("/api/users/me-with-orgs"),{orgs:i}=t;if(!i||!i.length)return null;if(!e)return i[0].id;for(const t of i)if(t.name===e)return t.id;return i[0].id}async getRemoteUpload(e,t=null){const i=this.defaultOrg||t,a=await this.fetchAPI(`/api/orgs/${i}/uploads/${e}`);if(!a.name)throw new Error("upload_missing");return a}async deleteUpload(e,t=null){const i=this.defaultOrg||t,a=JSON.stringify({crawl_ids:[e]});if(!(await this.fetchAPI(`/api/orgs/${i}/uploads/delete`,"POST",a)).deleted)throw new Error("delete_failed")}}const qa="https://w3s.link/";function Na(e){const{hostname:t,protocol:i,pathname:a}=new URL(e),r=i.slice(0,-1);if(!t){const[e,...t]=a.slice(2).split("/");return{type:r,cid:e,path:"/"+t.join("/")}}return{type:r,cid:t,path:a}}async function Ma(e){return Ga(e)?e:Va(e)?ja(e):e}async function Fa(e){return new Response(e).blob()}async function*Ba(e){const t=await e.getReader();try{for(;;){const{done:e,value:i}=await t.read();if(e)return;yield i}}finally{t.releaseLock()}}function ja(e){let t=e;t.next||(t=e[Symbol.asyncIterator]());const i=new TextEncoder;return new ReadableStream({async pull(e){const{value:a,done:r}=await t.next();if(r)await e.close();else{let t=a;"string"==typeof t&&(t=i.encode(t)),await e.enqueue(t)}}})}async function Ha(e){if(!e.ok){const t=await e.text(),i=e.status;throw new Error(`HTTP Error ${i}: ${t}`)}}async function Wa({url:e,file:t,fileName:i="",parameterName:a="file",fetch:r=globalThis.fetch,signal:o}){const s=new FormData,n=new Headers;Ka(e,n);const l=await async function(e){if(Ga(e))return await Fa(e);if(Va(e)){const t=ja(e);return await Fa(t)}return e instanceof Blob?e:new Blob([e])}(t);i?s.append(a,l,i):s.append(a,l);const c=await r(e,{method:"POST",body:s,headers:n,signal:o});return await Ha(c),c}function Ga(e){return"function"==typeof e.getReader}function Va(e){return e[Symbol.asyncIterator]}function Ka(e,t){if(e.password)if(e.username){const i=`Basic ${btoa(`${unescape(e.username)}:${unescape(e.password)}`)}`;t.append("Authorization",unescape(i)),e.username="",e.password=""}else{const i=`Bearer ${e.password}`;t.append("Authorization",unescape(i)),e.password=""}}async function Za({url:e,fetch:t=globalThis.fetch,signal:i}){const a=await t(e,{method:"HEAD",signal:i});await Ha(a);const r=a.headers.get("x-ipfs-datasize")||a.headers.get("Content-Length");return parseInt(r,10)}async function*Ja({url:e,start:t,end:i,format:a,signal:r,fetch:o=globalThis.fetch}){const s=new Headers;Number.isInteger(t)&&(Number.isInteger(i)?s.set("Range",`bytes=${t}-${i}`):s.set("Range",`bytes=${t}-`));const n=new URL(e);a&&(s.set("Accept",`application/vnd.ipld.${a}`),s.set("cache-control","no-cache"));const l=await o(n.href,{headers:s,signal:r});await Ha(l),yield*Ba(l.body)}async function*Ya({url:e,start:t,end:i,format:a,signal:r,gatewayURL:o=Qa()}){const s=function(e,t=Qa()){const{cid:i,path:a,type:r}=Na(e);return new URL(`/${r}/${i}${a}`,t)}(e,o);yield*Ja({url:s,start:t,end:i,format:a,signal:r})}function Qa(){if(!globalThis.location)return qa;const{pathname:e,hostname:t,protocol:i}=globalThis.location;if(e.startsWith("/ipfs/")||e.startsWith("/ipns/"))return`${i}//${t}/`;const[a,...r]=t.split(".");return 59===a.length&&r.length>=2?`${i}//${r.join(".")}/`:qa}let Xa=!1;const er=[5001,45001,45002,45003,45004,45005],tr="https://api.web3.storage/",ir="https://api.estuary.tech/",ar="http://localhost:5001/",rr="agregore",or="daemon",sr="daemon:preferred",nr="web3.storage",lr="estuary",cr="readonly",dr=[sr,rr,or,nr,lr,cr];class hr{get type(){return"invalid"}async*get(e,{start:t,end:i,signal:a=null,format:r=null}={}){throw new Error("Not Implemented")}async getSize(e,t=null){throw new Error("Not Implemented")}async uploadCAR(e,t=null){throw new Error("Not Implemented")}async uploadFile(e,t,i=null){throw new Error("Not Implemented")}async clear(e,t=null){throw new Error("Not Implemented")}}async function pr({daemonURL:e,web3StorageToken:t,web3StorageURL:i=tr,estuaryToken:a,estuaryURL:r=ir,publicGatewayURL:o=Qa(),readonly:s=!0,timeout:n=1e3,fetch:l=globalThis.fetch}={}){const c=[],d=[];if(d.push(async function(e=globalThis.fetch){try{return await e("ipfs://localhost/"),!0}catch(e){return Xa&&console.warn("Unable to detect Agregore",e),!1}}(l).then((e=>e&&c.push({type:rr,fetch:l})))),d.push(async function(){const e=er.map((e=>`http://localhost:${e}`));try{const i=await Promise.any(e.map((e=>kr(e).then((t=>{if(t)return e;throw new Error("Not found")})))));return!!i&&(xr&&!wr&&(t=i,wr=!0,globalThis.chrome.webRequest.onBeforeSendHeaders.addListener((e=>{const{requestHeaders:i}=e;for(const e of i)if("origin"===e.name.toLowerCase())return e.value=t,{requestHeaders:i};return e.requestHeaders.push({name:"Origin",value:t}),{requestHeaders:i}}),{urls:[t+"/*"]},["blocking","requestHeaders","extraHeaders"])),i)}catch{return!1}var t}().then((e=>e&&c.push({type:or,url:e,fetch:l})))),e&&d.push(kr(e,n,l).then((t=>t&&c.push({type:sr,url:e,fetch:l})))),a){const e=r,t=a;c.push({type:lr,url:e,authorization:t,fetch:l,publicGatewayURL:o})}if(t){const e=i,a=t;c.push({type:nr,url:e,authorization:a,fetch:l,publicGatewayURL:o})}return s&&o&&c.push({type:cr,fetch:l,publicGatewayURL:o}),await Promise.allSettled(d),c}async function ur({chooseOrder:e=dr,...t}={}){const i=function(e,t=dr){const i=e.filter((({type:e})=>t.includes(e))).sort((({type:e},{type:i})=>t.indexOf(e)-t.indexOf(i)))[0];if(!i)throw new Error("Unable to find valid type");return i}(await pr(t),e);return async function(e){const{type:t}=e;let i=null;if(t===rr)i=new mr(e.fetch||globalThis.fetch);else if(t.startsWith(or))i=new vr(e.url);else if(t===nr)i=new gr(e.authorization,e.url,e.publicGatewayURL);else if(t===lr)i=new br(e.authorization,e.url,e.publicGatewayURL);else{if(t!==cr)throw new TypeError(`Unknown API type: ${t}.`);i=new fr(e.publicGatewayURL)}return i}(i)}class fr extends hr{constructor(e=Qa()){super(),this.gatewayURL=e}get type(){return cr}async*get(e,{start:t,end:i,signal:a=null,format:r=null}={}){yield*Ya({url:e,start:t,end:i,format:r,gatewayURL:this.gatewayURL,signal:a})}async getSize(e,t=null){const{cid:i,path:a,type:r}=Na(e);return Za({url:new URL(`/${r}/${i}${a}`,this.gatewayURL),signal:t})}}class br extends fr{constructor(e,t=ir,i=Qa()){super(i),this.authorization=e,this.url=t}get type(){return lr}async uploadCAR(e,t=null){throw new Error("Not Implemented")}async uploadFile(e,t,i=null){const a=new URL("/content/add",this.url);a.password=this.authorization;const r=await Wa({url:a,file:e,fileName:t,parameterName:"data",signal:i}),{cid:o}=await r.json();return`ipfs://${o}/`}}class mr extends hr{constructor(e=globalThis.fetch){super(),this.fetch=e}get type(){return rr}async*get(e,{start:t,end:i,signal:a=null,format:r=null}={}){const{fetch:o}=this;yield*Ja({url:e,start:t,end:i,format:r,fetch:o,signal:a})}async getSize(e,t=null){const{fetch:i}=this;return Za({url:e,fetch:i,signal:t})}async uploadCAR(e,t=null){const i=await Ma(e),{fetch:a}=this,r=await a("ipfs://localhost",{method:"POST",headers:{"Content-Type":"application/vnd.ipld.car"},signal:t,body:i});await Ha(r);return(await r.text()).split("\n")}async uploadFile(e,t=null){const i=await Ma(e),{fetch:a}=this,r=await a("ipfs://localhost",{method:"POST",headers:{"Content-Type":"application/octet-stream"},signal:t,body:i});return await Ha(r),r.headers.get("Location")}}class gr extends fr{constructor(e,t=tr,i=Qa()){super(i),this.authorization=e,this.url=t}get type(){return nr}async uploadCAR(e,t=null){const i=new URL("/car",this.url);i.password=this.authorization;const a=await async function({url:e,fileIterator:t,signal:i}){const a=new Headers;a.set("Content-Type","application/octet-stream"),Ka(e,a);const r=await Ma(t),o=await fetch(e,{method:"POST",signal:i,body:r,headers:a,duplex:"half"});return await Ha(o),o}({url:i,fileIterator:e,signal:t});return(await a.text()).split("\n").filter((e=>e)).map((e=>{const{cid:t}=JSON.parse(e);return`ipfs://${t}/`}))}async uploadFile(e,{fileName:t="",signal:i=null}={}){const a=new URL("/upload",this.url);a.password=this.authorization;const r=await Wa({url:a,file:e,fileName:t,signal:i}),{cid:o}=await r.json();return`ipfs://${o}/`}}class vr extends hr{constructor(e=ar){super(),this.url=e}get type(){return or}async*getFile(e,{start:t,end:i,signal:a=null,format:r=null}={}){const{cid:o,path:s,type:n}=Na(e),l=new URL(`/api/v0/cat?arg=/${n}/${o}${s}`,this.url);if(t&&l.searchParams.set("offset",t),i&&l.searchParams.set("length",i-(t||0)+1),r)throw new Error("Format is unsupported on Kubo Daemons for now");const c=await fetch(l,{method:"POST",signal:a});await Ha(c),yield*Ba(c.body)}async*getRaw(e,{signal:t=null}={}){const{cid:i,path:a,type:r}=Na(e),o=new URL(`/api/v0/block/get?arg=/${r}/${i}${a}`,this.url),s=await fetch(o,{method:"POST",signal:t});await Ha(s),yield*Ba(s.body)}async*getCar(e,{signal:t=null}={}){const{cid:i,path:a,type:r}=Na(e),o=new URL(`/api/v0/dag/export?arg=/${r}/${i}${a}`,this.url),s=await fetch(o,{method:"POST",signal:t});await Ha(s),yield*Ba(s.body)}async*get(e,{start:t,end:i,signal:a=null,format:r=null}={}){if(r)if("raw"===r)yield*this.getRaw(e,{start:t,end:i,signal:a});else{if("car"!==r)throw new Error(`Invalid format type, must be car or 'raw', got ${r}`);yield*this.getCar(e,{start:t,end:i,signal:a})}yield*this.getFile(e,{start:t,end:i,signal:a})}async getSize(e,t=null){try{const{cid:i,path:a,type:r}=Na(e),o=`/api/v0/file/ls?arg=/${r}/${i}${a}&size=true`,s=new URL(o,this.url),n=await fetch(s,{method:"POST",signal:t});await Ha(n);const{Objects:l}=await n.json(),[{Size:c}]=Object.values(l);return c}catch(i){return Xa&&console.warn(i),this._getSizeWithDag(e,t)}}async _getSizeWithDag(e,t=null){const{cid:i,path:a,type:r}=Na(e),o=new URL(`/api/v0/dag/stat?arg=/${r}/${i}${a}`,this.url),s=await fetch(o,{method:"POST",signal:t});await Ha(s);const{Size:n}=await s.json();return parseInt(n,10)}async _pin(e,t=null){const{cid:i,path:a,type:r}=Na(e),o=new URL(`/api/v0/pin/add?arg=/${r}/${i}${a}`,this.url),s=await fetch(o,{method:"POST",signal:t});await Ha(s)}async _unpin(e,t=null){const{cid:i,path:a,type:r}=Na(e),o=new URL(`/api/v0/pin/rm?arg=/${r}/${i}${a}`,this.url),s=await fetch(o,{method:"POST",signal:t});await Ha(s)}async clear(e,t=null){return this._unpin(e,t)}async uploadCAR(e,t=null){const i=new URL("/api/v0/dag/import?allow-big-block=true&pin-roots=true",this.url),a=await Wa({url:i,file:e,signal:t});return(await a.text()).split("\n").filter((e=>e)).map((e=>{const{Root:t}=JSON.parse(e);return`ipfs://${t.Cid["/"]}/`}))}async uploadFile(e,t="",i=null){const a=new URL("/api/v0/add?pin=true&cid-version=1&inline=false&raw-leaves=true",this.url),r=e.name&&e instanceof Blob;(t||r)&&a.searchParams.set("wrap-with-directory","true");const o=await Wa({url:a,file:e,fileName:t,signal:i}),s=await o.text(),[n]=s.split("\n"),{Hash:l}=JSON.parse(n),c=`ipfs://${l}/`;return await this._pin(c,i),c}}let wr=!1;const xr=!!(globalThis&&globalThis.chrome&&globalThis.chrome.webRequest&&globalThis.chrome.webRequest.onBeforeSendHeaders&&globalThis.chrome.webRequest.onBeforeSendHeaders.addListener);async function kr(e=ar,t=1e3,i=globalThis.fetch){try{const a=new AbortController,{signal:r}=a;setTimeout((()=>a.abort()),t);const o=await i(new URL("/api/v0/version",e),{method:"POST",signal:r});return!!o.ok||!(!o.status||404===o.status)}catch(t){return Xa&&console.warn("Unable to detect Kubo Daemon",t,e),!1}}function yr(e,t){return self.chrome&&self.chrome.storage?new Promise((i=>{const a={};a[e]=t,self.chrome.storage.local.set(a,(()=>i()))})):self.localStorage?Promise.resolve(localStorage.setItem(e,t)):Promise.reject()}function $r(e){return self.chrome&&self.chrome.storage?new Promise((t=>{self.chrome.storage.local.get(e,(i=>{t(i[e])}))})):self.localStorage?Promise.resolve(localStorage.getItem(e)):Promise.reject()}const Sr="0.11.4",_r="https://w3s.link/ipfs/",zr="https://app.browsertrix.com";class Cr extends Ne{constructor(){super(),this.navMenuShown=!1,this.showCollDrop=!1,this.colls=[],this.autorun=!1,this.settingsError="",this.settingsTab=localStorage.getItem("settingsTab")||"ipfs";try{const e=localStorage.getItem("ipfsOpts");this.ipfsOpts=JSON.parse(e)}catch(e){}this.ipfsOpts=this.ipfsOpts||{daemonUrl:"",message:"",useCustom:!1,autoDetect:!1,gatewayUrl:_r};try{const e=localStorage.getItem("btrixOpts");this.btrixOpts=JSON.parse(e),this.doBtrixLogin()}catch(e){this.btrixOpts=null}$r("autorunBehaviors").then((e=>this.autorun="1"===e)),window.archivewebpage&&window.archivewebpage.setDownloadCallback((e=>this.onDownloadProgress(e)))}async doBtrixLogin(){try{this.btrixOpts.client=await Oa.login(this.btrixOpts)}catch(e){this.btrixOpts=null}}get appName(){return"ArchiveWeb.page"}static get properties(){return{...Ne.properties,showStartRecord:{type:Boolean},showCollDrop:{type:Boolean},colls:{type:Array},selCollId:{type:String},selCollTitle:{type:String},recordUrl:{type:String},autorun:{type:Boolean},showNew:{type:String},showImport:{type:Boolean},isImportExisting:{type:Boolean},loadedCollId:{type:String},showDownloadProgress:{type:Boolean},download:{type:Object},ipfsOpts:{type:Object},btrixOpts:{type:Object},uploadCollOpts:{type:Object},showSettings:{type:Boolean},settingsTab:{type:String},settingsError:{type:String},showIpfsShareFailed:{type:Boolean}}}initRoute(){const e=new URLSearchParams(window.location.search);e.has("config")?(super.initRoute(),this.handleMessages()):(this.inited=!0,this.sourceUrl=e.get("source")||""),this.embed||this.checkIPFS()}handleMessages(){window.addEventListener("message",(async e=>{if(this.embed&&this.loadedCollId&&"object"==typeof e.data&&"downloadToBlob"===e.data.msg_type){const t=await fetch(`./w/api/c/${this.loadedCollId}/dl?format=wacz&pages=all`),i=await t.blob();e.source.postMessage({msg_type:"downloadedBlob",coll:this.loadedCollId,url:URL.createObjectURL(i)})}}))}onStartLoad(e){this.embed||(this.showImport=!1,this.sourceUrl=e.detail.sourceUrl,this.loadInfo=e.detail,this.isImportExisting&&this.selCollId&&(this.loadInfo.importCollId=this.selCollId))}onCollLoaded(e){if(this.loadInfo&&this.loadInfo.importCollId&&navigator.serviceWorker.controller){const e={msg_type:"reload",full:!0,name:this.loadInfo.importCollId};navigator.serviceWorker.controller.postMessage(e)}this.embed&&(this.loadedCollId=e.detail.collInfo&&e.detail.collInfo.coll),super.onCollLoaded(e),!e.detail.alreadyLoaded&&e.detail.sourceUrl&&e.detail.sourceUrl!==this.sourceUrl&&(this.sourceUrl=e.detail.sourceUrl)}getLoadInfo(e){if(this.disableCSP(),this.loadInfo)return this.loadInfo;return{customColl:e.startsWith("local://")?e.slice("local://".length):e}}async disableCSP(){if(this.embed||!self.chrome||!self.chrome.runtime)return;const e=navigator.userAgent.match(/Chrome\/([\d]+)/);if(!e||Number(e[1])<94)return;console.log("attempt to disable CSP to ensure replay works");let t=await new Promise((e=>{chrome.tabs.getCurrent((t=>e(t.id)))}));chrome.runtime.sendMessage({msg:"disableCSP",tabId:t})}static get styles(){return ye(Cr.appStyles)}static get appStyles(){return ye(s` :host { font-size: initial; overflow: auto; @@ -4068,7 +4068,7 @@ function*(e,t){if(void 0!==e){let i=0;for(const a of e)yield t(a,i++)}}(e.resour this.settingsTab="ipfs"}>IPFS
  • - this.settingsTab="browsertrix"}>Browsertrix Cloud + this.settingsTab="browsertrix"}>Browsertrix
  • @@ -4100,14 +4100,15 @@ function*(e,t){if(void 0!==e){let i=0;for(const a of e)yield t(a,i++)}}(e.resour `:""} ${"browsertrix"===this.settingsTab?N` -

    Configure your credentials to upload archived items to Browsertrix Cloud.

    +

    Configure your credentials to upload archived items to Browsertrix.

    +

    Don't have a Browsertrix account? Visit https://browsertrix.com/ for more info.

    - Browsertrix Cloud URL: + Browsertrix URL: + name="btrixUrl" id="btrixUrl" value="${this.btrixOpts&&this.btrixOpts.url||zr}" + placeholder="${zr}">

    @@ -4143,4 +4144,4 @@ function*(e,t){if(void 0!==e){let i=0;for(const a of e)yield t(a,i++)}}(e.resour
    - `}async onNewColl(e){this.showNew="loading",e.preventDefault();const t=this.renderRoot.querySelector("#new-title").value,i=JSON.stringify({metadata:{title:t}}),a=await fetch("./w/api/c/create",{method:"POST",body:i});await a.json();const r=this.renderRoot.querySelector("wr-rec-coll-index");r&&r.loadColls(),this.showNew=null}onSelectColl(e){this.selCollId=e.currentTarget.value}async setDefaultColl(){this.selCollId||(this.selCollId=await $r("defaultCollId")),!this.selCollId&&this.colls&&this.colls.length&&(this.selCollId=this.colls[0].id),self.chrome&&self.chrome.storage&&self.chrome.storage.local&&self.localStorage&&(await yr("index:sortKey",localStorage.getItem("index:sortKey")),await yr("index:sortDesc",localStorage.getItem("index:sortDesc")))}_setCurrColl(e){if(!(e instanceof CustomEvent))return void this.setDefaultColl();const{detail:t}=e;this.selCollId=t.coll,this.colls&&this.colls.length||(this.colls=[{id:t.coll,title:t.title}])}async onShowStart(e){this._setCurrColl(e),this.recordUrl=e.detail.url||"https://example.com/",this.showStartRecord=!0}onShowImport(e){this._setCurrColl(e),this.showImport=!0,this.isImportExisting=!0}onCollsLoaded(e){this.colls=e.detail.colls,this.setDefaultColl()}async onStartRecord(e){e.preventDefault();const t=this.renderRoot.querySelector("#url").value,i=this.renderRoot.querySelector("#preview"),a=i&&i.checked;this.showStartRecord=!1;const r=this.autorun,o=this.selCollId;if(await yr("defaultCollId",o),await yr("autorunBehaviors",r?"1":"0"),self.chrome&&self.chrome.runtime)chrome.runtime.sendMessage({msg:"startNew",url:t,collId:o,autorun:r});else if(window.archivewebpage&&window.archivewebpage.record){const e=!a;window.archivewebpage.record({url:t,collId:o,startRec:e,autorun:r})}return!1}async onTitle(e){if(super.onTitle(e),this.embed&&this.loadedCollId&&e.detail.replayTitle&&e.detail.title)try{await fetch(`./w/api/c/${this.loadedCollId}/pageTitle`,{method:"POST",body:JSON.stringify(e.detail)})}catch(e){console.warn(e)}}async onSaveSettings(e){e.preventDefault();const t=this.renderRoot.querySelector("#ipfsDaemonUrl"),i=this.renderRoot.querySelector("#ipfsGatewayUrl"),a=this.renderRoot.querySelector("#ipfsAutoDetect");if(t&&i){const e=t.value,r=i.value,o=a&&a.checked;this.ipfsOpts={daemonUrl:e,useCustom:!!e,gatewayUrl:r,autoDetect:o},await this.checkIPFS(),localStorage.setItem("ipfsOpts",JSON.stringify(this.ipfsOpts))}const r=this.renderRoot.querySelector("#btrixUrl"),o=this.renderRoot.querySelector("#btrixUsername"),s=this.renderRoot.querySelector("#btrixPassword"),n=this.renderRoot.querySelector("#btrixOrgName");if(r&&o&&s){const e=r.value,t=o.value,i=s.value,a=n&&n.value||"";if(e&&t&&i){const r={url:e,username:t,password:i,orgName:a};let o;try{o=await Oa.login(r),this.settingsError=""}catch(e){return this.settingsError="Unable to log in to Browsertrix Cloud. Check your credentials.",!1}localStorage.setItem("btrixOpts",JSON.stringify(r)),this.btrixOpts={...r,client:o}}else this.btrixOpts=null,localStorage.removeItem("btrixOpts")}return localStorage.setItem("settingsTab",this.settingsTab),this.showSettings=!1,!1}async onCancelSettings(){this.settingsError=null,this.showSettings=!1}async checkIPFS(){const e=this.ipfsOpts;if(e.useCustom&&e.daemonUrl)e.message="IPFS Access -- Custom IPFS Daemon";else if(!e.daemonUrl&&e.autoDetect){const t=await ur({web3StorageToken:""});t instanceof vr&&(e.daemonUrl=t.url),e.useCustom=!1,t instanceof gr?e.message="Sharing via remote web3.storage":e.daemonUrl?e.daemonUrl.startsWith("http://localhost:45")?e.message="Sharing via Brave IPFS node":e.daemonUrl.startsWith("http://localhost")?e.message="Sharing via local IPFS node":e.message="":e.message="IPFS Access Unknown - Sharing Not Available"}}}customElements.define("archive-web-page-app",zr)})();var __webpack_export_target__=self;for(var i in __webpack_exports__)__webpack_export_target__[i]=__webpack_exports__[i];__webpack_exports__.__esModule&&Object.defineProperty(__webpack_export_target__,"__esModule",{value:!0})})(); \ No newline at end of file + `}async onNewColl(e){this.showNew="loading",e.preventDefault();const t=this.renderRoot.querySelector("#new-title").value,i=JSON.stringify({metadata:{title:t}}),a=await fetch("./w/api/c/create",{method:"POST",body:i});await a.json();const r=this.renderRoot.querySelector("wr-rec-coll-index");r&&r.loadColls(),this.showNew=null}onSelectColl(e){this.selCollId=e.currentTarget.value}async setDefaultColl(){this.selCollId||(this.selCollId=await $r("defaultCollId")),!this.selCollId&&this.colls&&this.colls.length&&(this.selCollId=this.colls[0].id),self.chrome&&self.chrome.storage&&self.chrome.storage.local&&self.localStorage&&(await yr("index:sortKey",localStorage.getItem("index:sortKey")),await yr("index:sortDesc",localStorage.getItem("index:sortDesc")))}_setCurrColl(e){if(!(e instanceof CustomEvent))return void this.setDefaultColl();const{detail:t}=e;this.selCollId=t.coll,this.colls&&this.colls.length||(this.colls=[{id:t.coll,title:t.title}])}async onShowStart(e){this._setCurrColl(e),this.recordUrl=e.detail.url||"https://example.com/",this.showStartRecord=!0}onShowImport(e){this._setCurrColl(e),this.showImport=!0,this.isImportExisting=!0}onCollsLoaded(e){this.colls=e.detail.colls,this.setDefaultColl()}async onStartRecord(e){e.preventDefault();const t=this.renderRoot.querySelector("#url").value,i=this.renderRoot.querySelector("#preview"),a=i&&i.checked;this.showStartRecord=!1;const r=this.autorun,o=this.selCollId;if(await yr("defaultCollId",o),await yr("autorunBehaviors",r?"1":"0"),self.chrome&&self.chrome.runtime)chrome.runtime.sendMessage({msg:"startNew",url:t,collId:o,autorun:r});else if(window.archivewebpage&&window.archivewebpage.record){const e=!a;window.archivewebpage.record({url:t,collId:o,startRec:e,autorun:r})}return!1}async onTitle(e){if(super.onTitle(e),this.embed&&this.loadedCollId&&e.detail.replayTitle&&e.detail.title)try{await fetch(`./w/api/c/${this.loadedCollId}/pageTitle`,{method:"POST",body:JSON.stringify(e.detail)})}catch(e){console.warn(e)}}async onSaveSettings(e){e.preventDefault();const t=this.renderRoot.querySelector("#ipfsDaemonUrl"),i=this.renderRoot.querySelector("#ipfsGatewayUrl"),a=this.renderRoot.querySelector("#ipfsAutoDetect");if(t&&i){const e=t.value,r=i.value,o=a&&a.checked;this.ipfsOpts={daemonUrl:e,useCustom:!!e,gatewayUrl:r,autoDetect:o},await this.checkIPFS(),localStorage.setItem("ipfsOpts",JSON.stringify(this.ipfsOpts))}const r=this.renderRoot.querySelector("#btrixUrl"),o=this.renderRoot.querySelector("#btrixUsername"),s=this.renderRoot.querySelector("#btrixPassword"),n=this.renderRoot.querySelector("#btrixOrgName");if(r&&o&&s){const e=r.value,t=o.value,i=s.value,a=n&&n.value||"";if(e&&t&&i){const r={url:e,username:t,password:i,orgName:a};let o;try{o=await Oa.login(r),this.settingsError=""}catch(e){return this.settingsError="Unable to log in to Browsertrix. Check your credentials.",!1}localStorage.setItem("btrixOpts",JSON.stringify(r)),this.btrixOpts={...r,client:o}}else this.btrixOpts=null,localStorage.removeItem("btrixOpts")}return localStorage.setItem("settingsTab",this.settingsTab),this.showSettings=!1,!1}async onCancelSettings(){this.settingsError=null,this.showSettings=!1}async checkIPFS(){const e=this.ipfsOpts;if(e.useCustom&&e.daemonUrl)e.message="IPFS Access -- Custom IPFS Daemon";else if(!e.daemonUrl&&e.autoDetect){const t=await ur({web3StorageToken:""});t instanceof vr&&(e.daemonUrl=t.url),e.useCustom=!1,t instanceof gr?e.message="Sharing via remote web3.storage":e.daemonUrl?e.daemonUrl.startsWith("http://localhost:45")?e.message="Sharing via Brave IPFS node":e.daemonUrl.startsWith("http://localhost")?e.message="Sharing via local IPFS node":e.message="":e.message="IPFS Access Unknown - Sharing Not Available"}}}customElements.define("archive-web-page-app",Cr)})();var __webpack_export_target__=self;for(var i in __webpack_exports__)__webpack_export_target__[i]=__webpack_exports__[i];__webpack_exports__.__esModule&&Object.defineProperty(__webpack_export_target__,"__esModule",{value:!0})})(); \ No newline at end of file diff --git a/src/ui/app.js b/src/ui/app.js index 8d0c70fd..9e151dc5 100644 --- a/src/ui/app.js +++ b/src/ui/app.js @@ -29,6 +29,8 @@ const VERSION = __AWP_VERSION__; const DEFAULT_GATEWAY_URL = "https://w3s.link/ipfs/"; +const DEFAULT_BTRIX_URL = "https://app.browsertrix.com"; + //============================================================================ class ArchiveWebApp extends ReplayWebApp @@ -63,7 +65,7 @@ class ArchiveWebApp extends ReplayWebApp try { const res = localStorage.getItem("btrixOpts"); this.btrixOpts = JSON.parse(res); - BtrixClient.login(this.btrixOpts).then(client => this.btrixOpts.client = client); + this.doBtrixLogin(); } catch (e) { this.btrixOpts = null; } @@ -75,6 +77,14 @@ class ArchiveWebApp extends ReplayWebApp } } + async doBtrixLogin() { + try { + this.btrixOpts.client = await BtrixClient.login(this.btrixOpts); + } catch (e) { + this.btrixOpts = null; + } + } + get appName() { return "ArchiveWeb.page"; } @@ -648,7 +658,7 @@ class ArchiveWebApp extends ReplayWebApp this.settingsTab = "ipfs"}>IPFS
  • - this.settingsTab = "browsertrix"}>Browsertrix Cloud + this.settingsTab = "browsertrix"}>Browsertrix
  • @@ -680,14 +690,15 @@ class ArchiveWebApp extends ReplayWebApp
    ` : ""} ${this.settingsTab === "browsertrix" ? html` -

    Configure your credentials to upload archived items to Browsertrix Cloud.

    +

    Configure your credentials to upload archived items to Browsertrix.

    +

    Don't have a Browsertrix account? Visit https://browsertrix.com/ for more info.

    - Browsertrix Cloud URL: + Browsertrix URL: + name="btrixUrl" id="btrixUrl" value="${this.btrixOpts && this.btrixOpts.url || DEFAULT_BTRIX_URL}" + placeholder="${DEFAULT_BTRIX_URL}">

    @@ -883,7 +894,7 @@ class ArchiveWebApp extends ReplayWebApp client = await BtrixClient.login(btrixOpts); this.settingsError = ""; } catch (e) { - this.settingsError = "Unable to log in to Browsertrix Cloud. Check your credentials."; + this.settingsError = "Unable to log in to Browsertrix. Check your credentials."; return false; } diff --git a/src/ui/upload.js b/src/ui/upload.js index ba729249..a494e9ae 100644 --- a/src/ui/upload.js +++ b/src/ui/upload.js @@ -126,7 +126,7 @@ class BtrixUploader extends LitElement return html` + title="Upload To Browsertrix"> @@ -151,7 +151,7 @@ class BtrixUploader extends LitElement + View in Browsertrix` : ""}
    Collection:Link: - View in Browsertrix Cloud
    @@ -200,7 +200,7 @@ class BtrixUploader extends LitElement if (!this.isUploadNeeded) { return html`

    - Archive already uploaded to Browsertrix Cloud. + Archive already uploaded to Browsertrix. ${this.renderDeleteUploaded()}

    `; @@ -216,7 +216,7 @@ class BtrixUploader extends LitElement } case "deleted": - return html`

    Upload to Browsertrix Cloud has been deleted.

    + return html`

    Upload to Browsertrix has been deleted.

    (Data is still saved locally in your browser)

    `; case "deleteFailed": @@ -233,7 +233,7 @@ class BtrixUploader extends LitElement renderDeleteUploaded() { return html` -