From 2ef95985cd48acc46b21be04c00aaac3b843a933 Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Tue, 4 Mar 2025 11:37:20 -0800 Subject: [PATCH] downloadUrl support for multiWACZ + latest wabac (#407) main menu tweaks: - use downloadUrl for action menu download - don't show download menu if downloadUrl is null - don't show Archive Info if downloadUrl !== sourceUrl and in embed mode improved loading: update to wabac.js 2.21.3 bump to 2.3.3, update CHANGES for release --- CHANGES.md | 6 ++++++ package.json | 4 ++-- src/item.ts | 54 ++++++++++++++++++++++++++++++++-------------------- src/types.ts | 1 + yarn.lock | 8 ++++---- 5 files changed, 46 insertions(+), 27 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index f667659..6a8cff8 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,12 @@ ## CHANGES +v2.3.3 +- UI: Support custom 'downloadUrl' when loading from Multi-WACZ JSON source - don't show download if unset +- UI: Don't show 'Archive Info' menu option for Multi-WACZ JSON source in embed mode +- UI: Use localized data format for current language settings +- Loading: Use negative offset range requests (via wabac.js 2.21.3) + v2.3.2 - Loading: fix dynamic page lookup for URLs with query strings (via wabac.js 2.21.2) diff --git a/package.json b/package.json index 39c3ada..8c8be60 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "replaywebpage", "productName": "ReplayWeb.page", - "version": "2.3.2", + "version": "2.3.3", "description": "Serverless Web Archive Replay", "repository": "https://github.com/webrecorder/replayweb.page", "homepage": "https://replayweb.page/", @@ -18,7 +18,7 @@ "dependencies": { "@fortawesome/fontawesome-free": "^5.15.4", "@shoelace-style/shoelace": "~2.15.1", - "@webrecorder/wabac": "^2.21.2", + "@webrecorder/wabac": "^2.21.3", "bulma": "^0.9.3", "electron-log": "^4.4.1", "electron-updater": "^6.3.9", diff --git a/src/item.ts b/src/item.ts index bb71dff..570af0b 100644 --- a/src/item.ts +++ b/src/item.ts @@ -115,6 +115,9 @@ class Item extends LitElement { @property({ type: String }) sourceUrl: string | null = null; + @property({ type: String }) + downloadUrl: string | null = null; + @property({ type: Object, attribute: false }) loadInfo: LoadInfo | null = null; @@ -446,8 +449,16 @@ class Item extends LitElement { }); } - if (!this.itemInfo!.title) { - this.itemInfo!.title = this.itemInfo!.filename; + const { title, name, filename, downloadUrl } = this.itemInfo!; + + if (!title) { + this.itemInfo!.title = name || filename; + } + + if (downloadUrl === null) { + this.downloadUrl = null; + } else { + this.downloadUrl = downloadUrl || this.sourceUrl; } if (this.embed === "replayonly" || this.embed === "replay-with-info") { @@ -1357,11 +1368,11 @@ class Item extends LitElement { Purge Cache + Full Reload ` : html``} - ${(!this.editable && this.sourceUrl?.startsWith("http://")) || - this.sourceUrl?.startsWith("https://") + ${(!this.editable && this.downloadUrl?.startsWith("http://")) || + this.downloadUrl?.startsWith("https://") ? html` Capture Date${dateStr} ` : ""} - ${!this.editable + ${!this.editable && + (this.downloadUrl === this.sourceUrl || !this.embed) ? html` - - - - Archive Info - - ` + href="#" + role="button" + class="dropdown-item" + @click="${this.onShowInfoDialog}" + > + + + + Archive Info + ` : ``} +