misc fixes:
- don't attempt to resolve sourceUrl (breaks file urls) - pass blob to loader - add exact size progress update, if available - google drive loader: switch to manual auth for any error
This commit is contained in:
+4
-2
@@ -39,7 +39,9 @@ class Chooser extends LitElement
|
|||||||
loadInfo.loadUrl = url.href;
|
loadInfo.loadUrl = url.href;
|
||||||
} else {
|
} else {
|
||||||
loadInfo.loadUrl = URL.createObjectURL(this.file);
|
loadInfo.loadUrl = URL.createObjectURL(this.file);
|
||||||
|
loadInfo.blob = this.file;
|
||||||
}
|
}
|
||||||
|
loadInfo.size = this.file.size;
|
||||||
loadInfo.noCache = this.file.path !== undefined;
|
loadInfo.noCache = this.file.path !== undefined;
|
||||||
loadInfo.name = this.fileDisplayName;
|
loadInfo.name = this.fileDisplayName;
|
||||||
}
|
}
|
||||||
@@ -125,11 +127,11 @@ class Chooser extends LitElement
|
|||||||
<p class="control is-expanded">
|
<p class="control is-expanded">
|
||||||
<input class="file-name input" type="text"
|
<input class="file-name input" type="text"
|
||||||
name="filename" id="filename"
|
name="filename" id="filename"
|
||||||
pattern="((file|http|https|s3):\/\/.*\.(warc|warc.gz|har|zip|wacz))|(googledrive:\/\/.+)"
|
pattern="((file|http|https|s3):\/\/.*\.(warc|warc.gz|zip|wacz))|(googledrive:\/\/.+)"
|
||||||
.value="${this.fileDisplayName}"
|
.value="${this.fileDisplayName}"
|
||||||
@input="${this.onInput}"
|
@input="${this.onInput}"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
placeholder="Enter a URL or click 'Choose File' to select a (WARC, HAR, WBN, or WACZ) archive source">
|
placeholder="Enter a URL or click 'Choose File' to select a WARC or WACZ archive source">
|
||||||
</p>
|
</p>
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<button type="submit" class="button is-hidden-mobile is-primary">Load</button>
|
<button type="submit" class="button is-hidden-mobile is-primary">Load</button>
|
||||||
|
|||||||
+1
-1
@@ -88,7 +88,7 @@ class GDrive extends LitElement
|
|||||||
onLoad() {
|
onLoad() {
|
||||||
this.scriptLoaded = true;
|
this.scriptLoaded = true;
|
||||||
this.gauth('none', (response) => {
|
this.gauth('none', (response) => {
|
||||||
if (response.error === "immediate_failed") {
|
if (response.error) {
|
||||||
if (this.state !== "implicitonly") {
|
if (this.state !== "implicitonly") {
|
||||||
this.state = "trymanual";
|
this.state = "trymanual";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import { LitElement, html, css } from 'lit-element';
|
import { LitElement, html, css } from 'lit-element';
|
||||||
import { wrapCss } from './misc';
|
import { wrapCss } from './misc';
|
||||||
|
|
||||||
|
import prettyBytes from 'pretty-bytes';
|
||||||
|
|
||||||
import { parseURLSchemeHostPath, initDBWorker } from './pageutils';
|
import { parseURLSchemeHostPath, initDBWorker } from './pageutils';
|
||||||
|
|
||||||
|
|
||||||
@@ -16,6 +18,9 @@ class Loader extends LitElement
|
|||||||
this.state = "waiting";
|
this.state = "waiting";
|
||||||
this.loadInfo = null;
|
this.loadInfo = null;
|
||||||
|
|
||||||
|
this.currentSize = 0;
|
||||||
|
this.totalSize = 0;
|
||||||
|
|
||||||
this.dbworker = initDBWorker();
|
this.dbworker = initDBWorker();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,6 +31,8 @@ class Loader extends LitElement
|
|||||||
state: { type: String },
|
state: { type: String },
|
||||||
progress: { type: Number },
|
progress: { type: Number },
|
||||||
percent: { type: Number },
|
percent: { type: Number },
|
||||||
|
currentSize: { type: Number },
|
||||||
|
totalSize: { type: Number },
|
||||||
error: { type: String},
|
error: { type: String},
|
||||||
total: { type: Number },
|
total: { type: Number },
|
||||||
status: { type: String },
|
status: { type: String },
|
||||||
@@ -48,6 +55,10 @@ class Loader extends LitElement
|
|||||||
this.error = event.data.error;
|
this.error = event.data.error;
|
||||||
this.state = "errored";
|
this.state = "errored";
|
||||||
}
|
}
|
||||||
|
if (event.data.currentSize && event.data.totalSize) {
|
||||||
|
this.currentSize = event.data.currentSize;
|
||||||
|
this.totalSize = event.data.totalSize;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -69,6 +80,8 @@ class Loader extends LitElement
|
|||||||
let sourceUrl = this.sourceUrl;
|
let sourceUrl = this.sourceUrl;
|
||||||
let source = null;
|
let source = null;
|
||||||
|
|
||||||
|
this.percent = this.currentSize = this.totalSize = 0;
|
||||||
|
|
||||||
// custom protocol handlers here...
|
// custom protocol handlers here...
|
||||||
try {
|
try {
|
||||||
const {scheme, host, path} = parseURLSchemeHostPath(sourceUrl);
|
const {scheme, host, path} = parseURLSchemeHostPath(sourceUrl);
|
||||||
@@ -161,6 +174,10 @@ You can select a file to upload from the main page by clicking the \'Choose File
|
|||||||
line-height: 1.5rem;
|
line-height: 1.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.loaded-prog {
|
||||||
|
margin-bottom: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
.error {
|
.error {
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
margin-bottom: 2em;
|
margin-bottom: 2em;
|
||||||
@@ -197,6 +214,9 @@ You can select a file to upload from the main page by clicking the \'Choose File
|
|||||||
<progress id="progress" class="progress is-primary is-large"
|
<progress id="progress" class="progress is-primary is-large"
|
||||||
value="${this.percent}" max="100"></progress>
|
value="${this.percent}" max="100"></progress>
|
||||||
<label class="progress-label" for="progress">${this.percent}%</label>
|
<label class="progress-label" for="progress">${this.percent}%</label>
|
||||||
|
${this.currentSize && this.totalSize ? html`
|
||||||
|
<p class="loaded-prog">Loaded <b>${prettyBytes(this.currentSize)}</b> of <b>${prettyBytes(this.totalSize)}</b></p>` : html``}
|
||||||
|
|
||||||
<button @click="${this.onCancel}" class="button is-danger">Cancel</button>
|
<button @click="${this.onCancel}" class="button is-danger">Cancel</button>
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
||||||
|
|||||||
@@ -76,10 +76,6 @@ function getTS(iso) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
async function sourceToId(url) {
|
async function sourceToId(url) {
|
||||||
try {
|
|
||||||
url = new URL(url, window.location.origin).href;
|
|
||||||
} catch(e) {}
|
|
||||||
|
|
||||||
const digest = await digestMessage(url, 'SHA-256');
|
const digest = await digestMessage(url, 'SHA-256');
|
||||||
const coll = "id-" + digest.slice(0, 12);
|
const coll = "id-" + digest.slice(0, 12);
|
||||||
return {url, coll};
|
return {url, coll};
|
||||||
|
|||||||
@@ -6006,7 +6006,7 @@ vm-browserify@^1.0.1:
|
|||||||
|
|
||||||
"wabac@github:https://github.com/webrecorder/wabac.js#develop":
|
"wabac@github:https://github.com/webrecorder/wabac.js#develop":
|
||||||
version "2.0.0"
|
version "2.0.0"
|
||||||
resolved "https://codeload.github.com/webrecorder/wabac.js/tar.gz/43a612b488b665ca385512955cd007a162d6ce31"
|
resolved "https://codeload.github.com/webrecorder/wabac.js/tar.gz/ebb69d2e03d1fbbbd0e1e8a6650cf6d7eb41f68b"
|
||||||
dependencies:
|
dependencies:
|
||||||
brotli "github:foliojs/brotli.js"
|
brotli "github:foliojs/brotli.js"
|
||||||
fast-xml-parser "^3.15.1"
|
fast-xml-parser "^3.15.1"
|
||||||
|
|||||||
Reference in New Issue
Block a user