From cf74f314ceb98654a4926de816a41d334156485d Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Tue, 19 Nov 2024 17:51:57 -0800 Subject: [PATCH 1/4] ui: add a 'Preferences' tab to the Settings tab that allows enabling saving of cookies and localStorage (actual support for this in separate PR) --- src/ui/app.ts | 73 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 2 deletions(-) diff --git a/src/ui/app.ts b/src/ui/app.ts index 3804f12f..d1b0308d 100644 --- a/src/ui/app.ts +++ b/src/ui/app.ts @@ -65,7 +65,7 @@ class ArchiveWebApp extends ReplayWebApp { this.settingsError = ""; - this.settingsTab = localStorage.getItem("settingsTab") || "browsertrix"; + this.settingsTab = localStorage.getItem("settingsTab") || "prefs"; try { const res = localStorage.getItem("ipfsOpts"); @@ -91,6 +91,10 @@ class ArchiveWebApp extends ReplayWebApp { this.btrixOpts = null; } + if (!self.localStorage.getItem("archiveCookies")) { + self.localStorage.setItem("archiveCookies", "1"); + } + getLocalOption("autorunBehaviors").then( (res) => (this.autorun = res === "1"), ); @@ -987,10 +991,19 @@ class ArchiveWebApp extends ReplayWebApp { } renderSettingsModal() { + let archiveCookies = false, + archiveStorage = false; + if (this.settingsTab === "prefs") { + archiveCookies = self.localStorage.getItem("archiveCookies") === "1"; + archiveStorage = self.localStorage.getItem("archiveStorage") === "1"; + } return html`
    +
  • + (this.settingsTab = "prefs")}>Preferences +
  • @@ -1008,6 +1021,45 @@ class ArchiveWebApp extends ReplayWebApp { class="is-flex is-flex-direction-column is-size-7" @submit="${this.onSaveSettings}" > + ${this.settingsTab === "prefs" + ? html`
    +
    + Below settings control if certain private data is archived. +
    +
    + Archive Cookies +

    + Archiving Cookies may expose private information that is + normally only shared with the site. When enabled, + users should exercise caution about sharing these web + archives publicly. +

    +
    +
    + Archive Local Storage +

    + Archiving Local Storage will archive information that is + generally always private. When enabled, archives + created with this setting should be kept private. Sharing of + paywalled content with this setting *could* result in + compromise of logged in credentials. Archives created with + this settings should generally be kept private. +

    +
    +
    ` + : ``} ${this.settingsTab === "ipfs" ? html`

    Configure settings for sharing archived items to IPFS. @@ -1276,7 +1328,7 @@ class ArchiveWebApp extends ReplayWebApp { } // @ts-expect-error - TS7006 - Parameter 'event' implicitly has an 'any' type. - async onTitle(event) { + override async onTitle(event): void { super.onTitle(event); if ( @@ -1363,6 +1415,23 @@ class ArchiveWebApp extends ReplayWebApp { } } + const archiveCookies = this.renderRoot.querySelector("#archiveCookies"); + const archiveStorage = this.renderRoot.querySelector("#archiveStorage"); + + if (archiveCookies) { + self.localStorage.setItem( + "archiveCookies", + (archiveCookies as HTMLInputElement).checked ? "1" : "0", + ); + } + + if (archiveStorage) { + self.localStorage.setItem( + "archiveStorage", + (archiveStorage as HTMLInputElement).checked ? "1" : "0", + ); + } + localStorage.setItem("settingsTab", this.settingsTab); // @ts-expect-error - TS2339 - Property 'showSettings' does not exist on type 'ArchiveWebApp'. From 34c4826c1dfe8f3c6dee985a6c0946935c344866 Mon Sep 17 00:00:00 2001 From: Henry Wilkinson Date: Tue, 19 Nov 2024 21:24:56 -0500 Subject: [PATCH 2/4] Update disclaimer text - Rename panel to Archiving Privacy --- src/ui/app.ts | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/src/ui/app.ts b/src/ui/app.ts index d1b0308d..e1c7264f 100644 --- a/src/ui/app.ts +++ b/src/ui/app.ts @@ -1002,7 +1002,9 @@ class ArchiveWebApp extends ReplayWebApp {

    • - (this.settingsTab = "prefs")}>Preferences + (this.settingsTab = "prefs")} + >Archiving Privacy
    • - Below settings control if certain private data is archived. + Control archiving of sensitive browser data.
      Archive Cookies -

      - Archiving Cookies may expose private information that is - normally only shared with the site. When enabled, + />Archive cookies +

      + Archiving cookies may expose private information that is + normally only shared with the site. When enabled, users should exercise caution about sharing these web archives publicly.

      @@ -1048,14 +1050,20 @@ class ArchiveWebApp extends ReplayWebApp { class="checkbox" type="checkbox" ?checked="${archiveStorage}" - />Archive Local Storage -

      - Archiving Local Storage will archive information that is - generally always private. When enabled, archives - created with this setting should be kept private. Sharing of - paywalled content with this setting *could* result in - compromise of logged in credentials. Archives created with - this settings should generally be kept private. + />Archive local storage +

      + Archiving local storage will archive information that is + generally always private. Archiving local storage + may be required for certain paywalled sites but should be + avoided where possible. +

      +

      + Sharing content created with this setting enabled may + compromise your login credentials. +
      Archived items created with this settings should + generally be kept private!

      ` From 285b9d55c92933a00815c4801938459157d3f4b1 Mon Sep 17 00:00:00 2001 From: Henry Wilkinson Date: Tue, 19 Nov 2024 21:38:45 -0500 Subject: [PATCH 3/4] Update Browsertrix description and link --- src/ui/app.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/ui/app.ts b/src/ui/app.ts index e1c7264f..6054c6b1 100644 --- a/src/ui/app.ts +++ b/src/ui/app.ts @@ -1114,14 +1114,13 @@ class ArchiveWebApp extends ReplayWebApp { ? html`

      Configure your credentials to upload archived items to - Browsertrix. + Browsertrix: Webrecorder's cloud-based crawling service.

      - Don't have a Browsertrix account? Visit - https://browsertrix.com/Sign up today! - for more info.

      From 912bf2f9418e47828a72a071d4afe917b9164f51 Mon Sep 17 00:00:00 2001 From: Henry Wilkinson Date: Tue, 19 Nov 2024 21:42:29 -0500 Subject: [PATCH 4/4] =?UTF-8?q?Web=20archives=20=E2=86=92=20Archived=20ite?= =?UTF-8?q?ms?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ui/app.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/app.ts b/src/ui/app.ts index 6054c6b1..de9fdde1 100644 --- a/src/ui/app.ts +++ b/src/ui/app.ts @@ -1039,8 +1039,8 @@ class ArchiveWebApp extends ReplayWebApp {

      Archiving cookies may expose private information that is normally only shared with the site. When enabled, - users should exercise caution about sharing these web - archives publicly. + users should exercise caution about sharing these archived + items publicly.