Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove btoa() from localStorage, just encode string as json, #214

Merged
merged 4 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@webrecorder/wabac",
"version": "2.20.5",
"version": "2.20.6",
"main": "index.js",
"type": "module",
"exports": {
Expand All @@ -19,7 +19,7 @@
"@peculiar/asn1-schema": "^2.3.3",
"@peculiar/x509": "^1.9.2",
"@types/js-levenshtein": "^1.1.3",
"@webrecorder/wombat": "^3.8.6",
"@webrecorder/wombat": "^3.8.7",
"acorn": "^8.10.0",
"auto-js-ipfs": "^2.1.1",
"base64-js": "^1.5.1",
Expand Down
10 changes: 6 additions & 4 deletions src/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -524,9 +524,11 @@ window.home = "${this.rootPrefix}";
// @ts-expect-error [TODO] - TS4111 - Property 'pixelRatio' comes from an index signature, so it must be accessed with ['pixelRatio']. | TS4111 - Property 'pixelRatio' comes from an index signature, so it must be accessed with ['pixelRatio'].
extraOpts && Number(extraOpts.pixelRatio) ? extraOpts.pixelRatio : 1;
// @ts-expect-error [TODO] - TS4111 - Property 'storage' comes from an index signature, so it must be accessed with ['storage']. | TS4111 - Property 'storage' comes from an index signature, so it must be accessed with ['storage'].
// [TODO]
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
const storage = extraOpts?.storage ? btoa(extraOpts.storage) : "";

const storage = extraOpts?.storage
? // @ts-expect-error [TODO] - TS4111 - Property 'storage' comes from an index signature, so it must be accessed with ['storage']. | TS4111 - Property 'storage' comes from an index signature, so it must be accessed with ['storage'].
JSON.stringify(extraOpts.storage)
: '""';
const presetCookieStr = presetCookie ? JSON.stringify(presetCookie) : '""';
return `
<!-- WB Insert -->
Expand Down Expand Up @@ -569,7 +571,7 @@ ${this.injectRelCanon ? `<link rel="canonical" href="${url}"/>` : ""}
wbinfo.static_prefix = "${this.staticPrefix}";
wbinfo.enable_auto_fetch = true;
wbinfo.presetCookie = ${presetCookieStr};
wbinfo.storage = "${storage}";
wbinfo.storage = ${storage};
wbinfo.isSW = true;
wbinfo.injectDocClose = true;
wbinfo.pixel_ratio = ${pixelRatio};
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -896,10 +896,10 @@
resolved "https://registry.yarnpkg.com/@webpack-cli/serve/-/serve-1.5.2.tgz#ea584b637ff63c5a477f6f21604b5a205b72c9ec"
integrity sha512-vgJ5OLWadI8aKjDlOH3rb+dYyPd2GTZuQC/Tihjct6F9GpXGZINo3Y/IVuZVTM1eDQB+/AOsjPUWH/WySDaXvw==

"@webrecorder/wombat@^3.8.6":
version "3.8.6"
resolved "https://registry.yarnpkg.com/@webrecorder/wombat/-/wombat-3.8.6.tgz#3aa99d9519f6263434a9e0b963f6ef86d3e0494a"
integrity sha512-+IxV0bkoc6QdHYzwejsPFPC31dRjaxa6zGuR9F08aFb4Ooeekf9AK16ZIYweizs/wm7nvTG5E12ZwW0LUUzX8w==
"@webrecorder/wombat@^3.8.7":
version "3.8.7"
resolved "https://registry.yarnpkg.com/@webrecorder/wombat/-/wombat-3.8.7.tgz#51c7465c589e0020be064121127c7c10a38ec21f"
integrity sha512-bW5V7cBweTkTazOIN8oZZGwHLevsGNv1luY3t0RYdEZhs5BDpTmUHN33zEbrXDOiPUlY3N3I8+73VA+PuxihoQ==
dependencies:
warcio "^2.4.0"

Expand Down