Skip to content

Commit

Permalink
Nested WACZ + embed reloading fix (#374)
Browse files Browse the repository at this point in the history
- Loading: Fix for loading nested WACZ files (via wabac.js 2.20.7)
- Embeds: Support full reload on embeds via fullReload() call on embed
web component
  • Loading branch information
ikreymer authored Nov 23, 2024
1 parent bf6da1e commit 9fa008b
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## CHANGES

v2.2.4
- Loading: Fix for loading nested WACZ files (via wabac.js 2.20.7)
- Embeds: Support full reload on embeds via fullReload() call on embed web component

v2.2.3
- Fidelity: Update to wabac.js 2.20.6, wombat 3.8.7, improved support for localStorage replay, if available
- Fidelity: Improved upport for FB video replay (via wabac.js 2.20.6)
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "replaywebpage",
"productName": "ReplayWeb.page",
"version": "2.2.3",
"version": "2.2.4",
"description": "Serverless Web Archive Replay",
"repository": "https://github.com/webrecorder/replayweb.page",
"homepage": "https://replayweb.page/",
Expand All @@ -18,7 +18,7 @@
"dependencies": {
"@fortawesome/fontawesome-free": "^5.15.4",
"@shoelace-style/shoelace": "~2.15.1",
"@webrecorder/wabac": "^2.20.6",
"@webrecorder/wabac": "^2.20.7",
"bulma": "^0.9.3",
"electron-log": "^4.4.1",
"electron-updater": "^6.3.9",
Expand Down
7 changes: 7 additions & 0 deletions src/embed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ class Embed extends LitElement {
}
}

fullReload() {
const iframe = this.renderRoot.querySelector("iframe");
if (iframe?.contentWindow) {
iframe.contentWindow.postMessage({ type: "fullReload" });
}
}

handleMessage(event: IframeMessage) {
const iframe = this.renderRoot.querySelector("iframe");

Expand Down
10 changes: 10 additions & 0 deletions src/item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,16 @@ class Item extends LitElement {

this.observer.observe(this);
}

if (this.embed) {
window.addEventListener("message", (event: MessageEvent) => {
if (event.source === window.parent) {
if (event.data.type === "fullReload") {
void this.deleteFully(true);
}
}
});
}
}

async runUpdateLoop() {
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1021,10 +1021,10 @@
resolved "https://registry.yarnpkg.com/@webpack-cli/serve/-/serve-2.0.5.tgz#325db42395cd49fe6c14057f9a900e427df8810e"
integrity sha512-lqaoKnRYBdo1UgDX8uF24AfGMifWK19TxPmM5FHc2vAGxrJ/qtyUyFBWoY1tISZdelsQ5fBcOusifo5o5wSJxQ==

"@webrecorder/wabac@^2.20.6":
version "2.20.6"
resolved "https://registry.yarnpkg.com/@webrecorder/wabac/-/wabac-2.20.6.tgz#8b28b58d5ae900faebd7be30224eadc620838f9e"
integrity sha512-bCvHgfnKHFzEuwPkIxdYIVuBmVTzOgxf96DeDTdZkhPI99iP7AUrz/Y6+qgoD9Vjn4usozUff25vdViD5mtiUg==
"@webrecorder/wabac@^2.20.7":
version "2.20.7"
resolved "https://registry.yarnpkg.com/@webrecorder/wabac/-/wabac-2.20.7.tgz#577fdf44f3c278ee0966b188174b57ac05a22dfc"
integrity sha512-SXy+0aofoVvBzsHn97r+JIE7g4q8sNYox2FyYa5KA3Nv2fO6T+NF9jdrLmLCu+pruz3pvVlJbZqA9djLqE+sNg==
dependencies:
"@peculiar/asn1-ecc" "^2.3.4"
"@peculiar/asn1-schema" "^2.3.3"
Expand Down

0 comments on commit 9fa008b

Please sign in to comment.