Skip to content

Commit 2892141

Browse files
authored
deps: update to latest wabac.js + add ruffle as option (#296)
deps: update to wabac.js 2.22.16 for facebook / instagram fixes (fix for #295 included), latest RWP deps: update RWP to 2.3.7 deps: update behaviors to fix instagram behavior better non-detectability features: - don't use Runtime.enable, not needed! - make ruffle injection optional, enable via settings ci: fix actions bump to 0.15.0
1 parent 7e6967c commit 2892141

File tree

7 files changed

+292
-238
lines changed

7 files changed

+292
-238
lines changed

.github/workflows/buildapp.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ jobs:
1919
uses: actions/checkout@v2
2020

2121
- name: Install Node.js, NPM and Yarn
22-
uses: actions/setup-node@v1
22+
uses: actions/setup-node@v3
2323
with:
24-
node-version: 18
24+
node-version: 20
2525

2626
- name: Cache Dirs
27-
uses: actions/cache@v2
27+
uses: actions/cache@v4
2828
with:
2929
path: |
3030
~/.cache/electron

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@webrecorder/archivewebpage",
33
"productName": "ArchiveWeb.page",
4-
"version": "0.14.2",
4+
"version": "0.15.0",
55
"main": "index.js",
66
"description": "Create Web Archives directly in your browser",
77
"repository": {
@@ -14,9 +14,9 @@
1414
"@fortawesome/fontawesome-free": "^5.13.0",
1515
"@ipld/car": "^5.3.1",
1616
"@webrecorder/awp-sw": "^0.5.3",
17-
"@webrecorder/wabac": "^2.20.8",
17+
"@webrecorder/wabac": "^2.22.16",
1818
"auto-js-ipfs": "^2.3.0",
19-
"browsertrix-behaviors": "^0.6.4",
19+
"browsertrix-behaviors": "^0.8.5",
2020
"btoa": "^1.2.1",
2121
"bulma": "^0.9.3",
2222
"client-zip": "^2.2.2",
@@ -26,12 +26,12 @@
2626
"node-fetch": "2.6.7",
2727
"pdfjs-dist": "2.2.228",
2828
"pretty-bytes": "^5.6.0",
29-
"replaywebpage": "^2.2.5",
29+
"replaywebpage": "^2.3.7",
3030
"stream-browserify": "^3.0.0",
3131
"tsconfig-paths-webpack-plugin": "^4.1.0",
3232
"unused-filename": "^4.0.1",
3333
"uuid": "^8.3.2",
34-
"warcio": "^2.4.2"
34+
"warcio": "^2.4.4"
3535
},
3636
"devDependencies": {
3737
"@typescript-eslint/eslint-plugin": "^6.15.0",
@@ -58,13 +58,13 @@
5858
"ts-loader": "^9.5.1",
5959
"ts-migrate": "^0.1.35",
6060
"typescript": "^5.3.3",
61-
"webpack": "^5.91.0",
61+
"webpack": "^5.99.7",
6262
"webpack-cli": "^5.1.4",
6363
"webpack-dev-server": "^5.0.4",
6464
"webpack-extension-reloader": "^1.1.4"
6565
},
6666
"resolutions": {
67-
"@webrecorder/wabac": "^2.20.8"
67+
"@webrecorder/wabac": "^2.22.16"
6868
},
6969
"files": [
7070
"src/",

src/localstorage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function setLocalOption(name, value) {
1919
}
2020

2121
// ===========================================================================
22-
export function getLocalOption(name: string) : Promise<string | null> {
22+
export function getLocalOption(name: string): Promise<string | null> {
2323
// @ts-expect-error - TS2339 - Property 'chrome' does not exist on type 'Window & typeof globalThis'. | TS2339 - Property 'chrome' does not exist on type 'Window & typeof globalThis'.
2424
if (self.chrome?.storage) {
2525
return new Promise<string>((resolve) => {

src/recorder.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ import {
2222
} from "./consts";
2323
import { getLocalOption } from "./localstorage";
2424

25-
// @ts-expect-error - TS2554 - Expected 0 arguments, but got 1.
26-
const encoder = new TextEncoder("utf-8");
25+
const encoder = new TextEncoder();
2726

2827
const MAX_CONCURRENT_FETCH = 6;
2928

@@ -58,6 +57,7 @@ type FetchEntry = {
5857
class Recorder {
5958
archiveStorage = false;
6059
archiveCookies = false;
60+
archiveFlash = false;
6161

6262
_fetchQueue: FetchEntry[] = [];
6363

@@ -155,8 +155,9 @@ class Recorder {
155155
}
156156

157157
async initOpts() {
158-
this.archiveCookies = (await getLocalOption("archiveCookies") === "1");
159-
this.archiveStorage = (await getLocalOption("archiveStorage") === "1");
158+
this.archiveCookies = (await getLocalOption("archiveCookies")) === "1";
159+
this.archiveStorage = (await getLocalOption("archiveStorage")) === "1";
160+
this.archiveFlash = (await getLocalOption("archiveFlash")) === "1";
160161
}
161162

162163
// @ts-expect-error - TS7006 - Parameter 'autorun' implicitly has an 'any' type.
@@ -190,8 +191,8 @@ class Recorder {
190191
this.behaviorInitStr
191192
});
192193
193-
window.addEventListener("beforeunload", () => {});` +
194-
this.getFlashInjectScript()
194+
window.addEventListener("beforeunload", () => {});\n` +
195+
(this.archiveFlash ? this.getFlashInjectScript() : "")
195196
);
196197
}
197198

@@ -550,8 +551,6 @@ class Recorder {
550551

551552
await this.send("Page.enable");
552553

553-
await this.send("Runtime.enable");
554-
555554
await this.send("DOMSnapshot.enable");
556555

557556
await this.initPixRatio();
@@ -632,7 +631,6 @@ class Recorder {
632631

633632
async sessionClose(sessions = []) {
634633
await this.send("Page.disable");
635-
await this.send("Runtime.disable");
636634
await this.send("DOMSnapshot.disable");
637635

638636
await this.send("Debugger.disable");

src/ui/app.ts

Lines changed: 37 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ class ArchiveWebApp extends ReplayWebApp {
5858

5959
archiveCookies: boolean | null = null;
6060
archiveStorage: boolean | null = null;
61+
archiveFlash: boolean | null = null;
62+
63+
showIpfsShareFailed = false;
6164

6265
constructor() {
6366
super();
@@ -106,7 +109,7 @@ class ArchiveWebApp extends ReplayWebApp {
106109
}
107110

108111
async initOpts() {
109-
this.autorun = (await getLocalOption("autorunBehaviors") === "1");
112+
this.autorun = (await getLocalOption("autorunBehaviors")) === "1";
110113

111114
const archiveCookies = await getLocalOption("archiveCookies");
112115

@@ -118,7 +121,9 @@ class ArchiveWebApp extends ReplayWebApp {
118121
this.archiveCookies = archiveCookies === "1";
119122
}
120123

121-
this.archiveStorage = await getLocalOption("archiveStorage") === "1";
124+
this.archiveStorage = (await getLocalOption("archiveStorage")) === "1";
125+
126+
this.archiveFlash = (await getLocalOption("archiveFlash")) === "1";
122127
}
123128

124129
async doBtrixLogin() {
@@ -526,10 +531,7 @@ class ArchiveWebApp extends ReplayWebApp {
526531
@show-start=${this.onShowStart}
527532
@show-import=${this.onShowImport}
528533
@colls-updated=${this.onCollsLoaded}
529-
@ipfs-share-failed=${
530-
// @ts-expect-error - TS2339 - Property 'showIpfsShareFailed' does not exist on type 'ArchiveWebApp'.
531-
() => (this.showIpfsShareFailed = true)
532-
}
534+
@ipfs-share-failed=${() => (this.showIpfsShareFailed = true)}
533535
@do-upload=${
534536
// @ts-expect-error - TS2339 - Property 'uploadCollOpts' does not exist on type 'ArchiveWebApp'.
535537
(e) => (this.uploadCollOpts = e.detail)
@@ -558,10 +560,7 @@ class ArchiveWebApp extends ReplayWebApp {
558560
// @ts-expect-error - TS2339 - Property 'showSettings' does not exist on type 'ArchiveWebApp'.
559561
this.showSettings ? this.renderSettingsModal() : ""
560562
}
561-
${
562-
// @ts-expect-error - TS2339 - Property 'showIpfsShareFailed' does not exist on type 'ArchiveWebApp'.
563-
this.showIpfsShareFailed ? this.renderIPFSShareFailedModal() : ""
564-
}
563+
${this.showIpfsShareFailed ? this.renderIPFSShareFailedModal() : ""}
565564
${
566565
// @ts-expect-error - TS2339 - Property 'uploadCollOpts' does not exist on type 'ArchiveWebApp'. | TS2339 - Property 'btrixOpts' does not exist on type 'ArchiveWebApp'.
567566
this.uploadCollOpts && this.btrixOpts ? this.renderBtrixUploadModal() : ""
@@ -778,11 +777,8 @@ class ArchiveWebApp extends ReplayWebApp {
778777
}
779778

780779
renderIPFSShareFailedModal() {
781-
return html` <wr-modal
782-
@modal-closed="${
783-
// @ts-expect-error - TS2339 - Property 'showIpfsShareFailed' does not exist on type 'ArchiveWebApp'.
784-
() => (this.showIpfsShareFailed = false)
785-
}"
780+
return html`<wr-modal
781+
@modal-closed="${() => (this.showIpfsShareFailed = false)}"
786782
title="IPFS Connection Failed"
787783
>
788784
<div>
@@ -1011,7 +1007,7 @@ class ArchiveWebApp extends ReplayWebApp {
10111007
<ul>
10121008
<li class="${this.settingsTab === "prefs" ? "is-active" : ""}">
10131009
<a @click=${() => (this.settingsTab = "prefs")}
1014-
>Archiving Privacy</a
1010+
>Archiving Settings</a
10151011
>
10161012
</li>
10171013
<li
@@ -1032,9 +1028,24 @@ class ArchiveWebApp extends ReplayWebApp {
10321028
@submit="${this.onSaveSettings}"
10331029
>
10341030
${this.settingsTab === "prefs"
1035-
? html` <fieldset>
1031+
? html`<fieldset>
10361032
<div class="is-size-6">
1037-
Control archiving of sensitive browser data.
1033+
Control archiving of optional extensions and sensitive browser
1034+
data.
1035+
</div>
1036+
<div class="field is-size-6 mt-4">
1037+
<input
1038+
name="prefArchiveFlash"
1039+
id="archiveFlash"
1040+
class="checkbox"
1041+
type="checkbox"
1042+
?checked="${this.archiveFlash}"
1043+
/><span class="ml-1">Enable Ruffle for Flash</span>
1044+
<p class="is-size-7 mt-1">
1045+
Enables archiving Flash content via injecting the Ruffle
1046+
emulator into the page. May cause issues with some pages,
1047+
enable only when archiving websites that contain Flash.
1048+
</p>
10381049
</div>
10391050
<div class="field is-size-6 mt-4">
10401051
<input
@@ -1432,21 +1443,21 @@ class ArchiveWebApp extends ReplayWebApp {
14321443

14331444
const archiveCookies = this.renderRoot.querySelector("#archiveCookies");
14341445
const archiveStorage = this.renderRoot.querySelector("#archiveStorage");
1446+
const archiveFlash = this.renderRoot.querySelector("#archiveFlash");
14351447

14361448
if (archiveCookies) {
14371449
this.archiveCookies = (archiveCookies as HTMLInputElement).checked;
1438-
await setLocalOption(
1439-
"archiveCookies",
1440-
this.archiveCookies ? "1" : "0",
1441-
);
1450+
await setLocalOption("archiveCookies", this.archiveCookies ? "1" : "0");
14421451
}
14431452

14441453
if (archiveStorage) {
14451454
this.archiveStorage = (archiveStorage as HTMLInputElement).checked;
1446-
await setLocalOption(
1447-
"archiveStorage",
1448-
this.archiveStorage ? "1" : "0",
1449-
);
1455+
await setLocalOption("archiveStorage", this.archiveStorage ? "1" : "0");
1456+
}
1457+
1458+
if (archiveFlash) {
1459+
this.archiveFlash = (archiveFlash as HTMLInputElement).checked;
1460+
await setLocalOption("archiveFlash", this.archiveFlash ? "1" : "0");
14501461
}
14511462

14521463
localStorage.setItem("settingsTab", this.settingsTab);

src/ui/coll.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ class WrRecColl extends Item {
205205
class="button is-primary-new"
206206
role="button"
207207
download="my-archive.wacz"
208-
href="${this.downloadUrl}"
208+
href="${this.getDownloadUrl()}"
209209
target="_blank"
210210
>Download</a
211211
>
@@ -251,7 +251,7 @@ class WrRecColl extends Item {
251251
if (window.parent !== window) {
252252
window.parent.postMessage({
253253
type: "awp-finish",
254-
downloadUrl: this.downloadUrl,
254+
downloadUrl: this.getDownloadUrl(),
255255
});
256256
}
257257
}
@@ -280,7 +280,7 @@ class WrRecColl extends Item {
280280
super.navigateTo(value);
281281
}
282282

283-
get downloadUrl() {
283+
getDownloadUrl() {
284284
return new URL(
285285
`${apiPrefix}/c/${this.item}/dl?format=wacz&pages=all`,
286286
window.location.href,

0 commit comments

Comments
 (0)