wacz loading: support wacz 1.0.0! -- update to wabac.js 2.3.0

local file loading: support purge cache + reload for local files when filehandles are used (chrome)
update CHANGES.md
bump to 1.3.1
This commit is contained in:
Ilya Kreymer
2020-11-20 15:38:12 -08:00
parent 1bb14b1299
commit 4155b9af33
9 changed files with 69 additions and 63 deletions
+7 -3
View File
@@ -73,6 +73,7 @@ class Coll extends LitElement
this.appName = "ReplayWeb.page";
this.appLogo = rwpLogo;
this.appHomeUrl = "/";
}
static get properties() {
@@ -107,6 +108,7 @@ class Coll extends LitElement
appName: { type: String },
appLogo: { type: String },
appHomeUrl: { type: String }
}
}
@@ -703,7 +705,7 @@ class Coll extends LitElement
<div class="field has-addons">
${!this.embed ? html`
<a href="/" role="button" class="button is-borderless is-hidden-touch" aria-labelledby="home" @keyup="${clickOnSpacebarPress}">
<a href="${this.appHomeUrl}" role="button" class="button is-borderless is-hidden-touch" aria-labelledby="home" @keyup="${clickOnSpacebarPress}">
<span class="icon is-small">
<fa-icon size="1.0em" .svg="${fasHome}" aria-hidden="true"></fa-icon>
<span class="is-sr-only">Home</span>
@@ -765,7 +767,7 @@ class Coll extends LitElement
<div class="dropdown-menu" id="menu-dropdown">
<div class="dropdown-content">
${!this.embed ? html`
<a href="/" role="button" class="dropdown-item is-hidden-desktop" @keyup="${clickOnSpacebarPress}">
<a href="${this.appHomeUrl}" role="button" class="dropdown-item is-hidden-desktop" @keyup="${clickOnSpacebarPress}">
<span class="icon is-small">
<fa-icon size="1.0em" class="has-text-grey" aria-hidden="true" .svg="${fasHome}"></fa-icon>
</span>
@@ -999,7 +1001,9 @@ class Coll extends LitElement
}
async deleteFully(reload = false) {
const resp = await fetch(`${this.collInfo.apiPrefix}`, {
const deleteURL = this.collInfo.apiPrefix + (reload ? "?reload=1" : "");
const resp = await fetch(deleteURL, {
method: 'DELETE',
});
+9 -3
View File
@@ -20,6 +20,8 @@ class Loader extends LitElement
this.currentSize = 0;
this.totalSize = 0;
this.tryFileHandle = !!window.showOpenFilePicker;
}
static get properties() {
@@ -35,7 +37,8 @@ class Loader extends LitElement
total: { type: Number },
status: { type: String },
coll: { type: String },
embed: { type: String }
embed: { type: String },
tryFileHandle: { type: Boolean }
}
}
@@ -57,6 +60,9 @@ class Loader extends LitElement
if (event.data.error) {
this.error = event.data.error;
this.state = "errored";
if (this.error === "missing_local_file") {
this.tryFileHandle = false;
}
}
if (event.data.currentSize && event.data.totalSize) {
this.currentSize = event.data.currentSize;
@@ -114,7 +120,7 @@ Please try loading this page from an HTTPS URL`;
break;
case "file":
if (!this.loadInfo) {
if (!this.loadInfo && !this.tryFileHandle) {
this.state = "errored";
this.error = `\
File URLs can not be entered directly or shared.
@@ -179,7 +185,7 @@ You can select a file to upload from the main page by clicking the \'Choose File
}
updated(changedProperties) {
if (this.sourceUrl && changedProperties.has("sourceUrl")) {
if (this.sourceUrl && changedProperties.has("sourceUrl") || changedProperties.has("tryFileHandle")) {
this.doLoad();
}
}
+1 -13
View File
@@ -191,19 +191,7 @@ class Pages extends LitElement
const resp = await fetch(`${this.collInfo.apiPrefix}/curated/${this.currList}`);
const json = await resp.json();
const curated = [];
for (const c of json.curated) {
for (const p of this.filteredPages) {
if (p.id === c.page) {
if (p.ts) {
p.date = new Date(p.ts).toISOString();
}
curated.push(p);
break;
}
}
}
const curated = json.curated;
this.filteredPages = curated;
}
+9 -5
View File
@@ -117,11 +117,15 @@ class Story extends LitElement
if (!this.curatedPageMap[curated.list]) {
this.curatedPageMap[curated.list] = [];
}
const page = pageMap[curated.page];
if (!page) {
console.log("No Page with id: " + page);
continue;
}
const page = curated;
// if (curated.page) {
// page = pageMap[curated.page];
// if (!page) {
// console.log("No Page with id: " + page);
// continue;
// }
// }
const url = page.url;
const ts = page.ts;