Archive verification info + Embed improvements + Embed Receipts UI (#125)

info panel verification/integrity additions, (fixes on #113)
- info panel: display number of hashes verified valid (and invalid), observer domain (if any), and certificate fingerprint, creation software, and package digest
- info: ensure replayTS is updated, not just replayUrl, to ensure correct stats

404 page: improved formatting on 404 page (via wabac.js)

embeds:
- new embed 'replay-with-info mode, displays replay-only with dropdown showing archival 'receipt, which includes condensed info and verification (hashes valid/invalid, observer domain, cert fingerprint)
- support 'newWindowBase' attribute for specifying base replay URL for opening new window. default: use current url if deepLink enabled, otherwise use https://replayweb.page/
use transparent for embeds
- embed dropdown/receipt styling from @Shrinks99 
- automatically setting noCache and noWebWorker for older browsers (eg. safari < 16)
- add 'hideOffscreen' attribute to enable unloading embed when offscreen

dependencies: update to wabac.js 2.13.0-beta.0

bump version to 1.7.0-beta.0

Embed receipt styling co-authored-by: @Shrinks99
This commit is contained in:
Ilya Kreymer
2022-10-01 18:22:30 -07:00
committed by GitHub
parent 4cb52b4480
commit 27a8524aac
18 changed files with 1225 additions and 315 deletions
+32
View File
@@ -10,6 +10,8 @@ var scriptSrc = document.currentScript && document.currentScript.src;
var defaultReplayFile = "";
const DEFAULT_REPLAY_BASE = "https://replayweb.page/";
// ===========================================================================
class Embed extends LitElement
@@ -30,6 +32,7 @@ class Embed extends LitElement
this.coll = "";
this.paramString = null;
this.deepLink = false;
this.newWindowBase = "";
this.swInited = false;
this.embed = null;
this.reloadCount = 0;
@@ -72,6 +75,9 @@ class Embed extends LitElement
noSandbox: { type: Boolean },
noWebWorker: { type: Boolean },
noCache: { type: Boolean },
hideOffscreen: { type: Boolean },
newWindowBase: { type: String },
errorMessage: { type: String }
};
@@ -118,6 +124,23 @@ class Embed extends LitElement
this.updateFromHash();
window.addEventListener("hashchange", () => this.updateFromHash());
}
this.loadBrowserDefaults();
}
loadBrowserDefaults() {
// set defaults for older browsers (eg. Safari < 16) based on recommendations from:
// https://lil.law.harvard.edu/blog/2022/09/15/opportunities-and-challenges-of-client-side-playback/
// likely safari < 16, don't use web workers due to issues with split storage state
if (window.GestureEvent !== undefined && window.SharedWorker === undefined ){
this.noWebWorker = true;
}
// if no storage manager or estimate, don't cache
if (!navigator.storage || !navigator.storage.estimate) {
this.noCache = true;
}
}
updateFromHash() {
@@ -173,9 +196,14 @@ class Embed extends LitElement
customColl: this.coll,
config,
basePageUrl: window.location.href.split("#")[0],
baseUrlSourcePrefix: this.newWindowBase,
embed: this.embed,
};
if (!this.deepLink && !params.baseUrlSourcePrefix) {
params.baseUrlSourcePrefix = DEFAULT_REPLAY_BASE;
}
if (this.noWebWorker) {
params.noWebWorker = "1";
}
@@ -184,6 +212,10 @@ class Embed extends LitElement
params.noCache = "1";
}
if (this.hideOffscreen) {
params.hideOffscreen = "1";
}
this.paramString = new URLSearchParams(params).toString();
this.hashString = new URLSearchParams({