ui: support asking permission if needed when reloading a local file with 'purge cache and full reload'
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
## CHANGES
|
## CHANGES
|
||||||
|
|
||||||
v1.3.8
|
v1.3.8
|
||||||
|
- UI: Native files: Support asking permission when doing a full reload of a local file.
|
||||||
- Library: Add WrModal UI element to simplify modal creation.
|
- Library: Add WrModal UI element to simplify modal creation.
|
||||||
- Library: UI: Add confirmation for page-deletion and multi page deletion when in editing mode (currently only used in ArchiveWeb.page)
|
- Library: UI: Add confirmation for page-deletion and multi page deletion when in editing mode (currently only used in ArchiveWeb.page)
|
||||||
- Fidelity: Fixes for youtube and vimeo replay fidelity
|
- Fidelity: Fixes for youtube and vimeo replay fidelity
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ class Loader extends LitElement
|
|||||||
this.totalSize = 0;
|
this.totalSize = 0;
|
||||||
|
|
||||||
this.tryFileHandle = !!window.showOpenFilePicker;
|
this.tryFileHandle = !!window.showOpenFilePicker;
|
||||||
|
|
||||||
|
this.fileHandle = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static get properties() {
|
static get properties() {
|
||||||
@@ -60,8 +62,12 @@ class Loader extends LitElement
|
|||||||
if (event.data.error) {
|
if (event.data.error) {
|
||||||
this.error = event.data.error;
|
this.error = event.data.error;
|
||||||
this.state = "errored";
|
this.state = "errored";
|
||||||
|
this.fileHandle = event.data.fileHandle;
|
||||||
if (this.error === "missing_local_file") {
|
if (this.error === "missing_local_file") {
|
||||||
this.tryFileHandle = false;
|
this.tryFileHandle = false;
|
||||||
|
} else if (this.error === "permission_needed" && event.data.fileHandle) {
|
||||||
|
this.state = "permission_needed";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (event.data.currentSize && event.data.totalSize) {
|
if (event.data.currentSize && event.data.totalSize) {
|
||||||
@@ -281,12 +287,27 @@ You can select a file to upload from the main page by clicking the \'Choose File
|
|||||||
<a href="/" class="button is-warning">Back</a>`}
|
<a href="/" class="button is-warning">Back</a>`}
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
||||||
|
case "permission_needed":
|
||||||
|
return html`
|
||||||
|
<div class="has-text-left">
|
||||||
|
<div class="">Permission is needed to reload the archive file. (Click <i>Cancel</i> to cancel loading this archive.)</div>
|
||||||
|
<button @click="${this.onAskPermission}" class="button is-primary">Show Permission</button>
|
||||||
|
<a href="/" class="button is-danger">Cancel</a>
|
||||||
|
</div>`;
|
||||||
|
|
||||||
case "waiting":
|
case "waiting":
|
||||||
default:
|
default:
|
||||||
return html`<progress class="progress is-primary is-large" style="max-width: 400px"/>`;
|
return html`<progress class="progress is-primary is-large" style="max-width: 400px"/>`;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async onAskPermission() {
|
||||||
|
const result = await this.fileHandle.requestPermission({mode: "read"});
|
||||||
|
if (result === "granted") {
|
||||||
|
this.doLoad();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
customElements.define("wr-loader", Loader);
|
customElements.define("wr-loader", Loader);
|
||||||
|
|||||||
@@ -716,7 +716,7 @@
|
|||||||
|
|
||||||
"@webrecorder/wabac@github:webrecorder/wabac.js":
|
"@webrecorder/wabac@github:webrecorder/wabac.js":
|
||||||
version "2.5.6"
|
version "2.5.6"
|
||||||
resolved "https://codeload.github.com/webrecorder/wabac.js/tar.gz/e0b7bf42fd69d5e3349b887220aec50d3972a58d"
|
resolved "https://codeload.github.com/webrecorder/wabac.js/tar.gz/37b46a8de15660e4af307b249136121cab355ca7"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@webrecorder/wombat" "^3.0.4"
|
"@webrecorder/wombat" "^3.0.4"
|
||||||
brotli "github:foliojs/brotli.js"
|
brotli "github:foliojs/brotli.js"
|
||||||
|
|||||||
Reference in New Issue
Block a user