Skip to content

Commit 32984e2

Browse files
committed
chore: fix site
1 parent fdf71e5 commit 32984e2

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

docs/.vitepress/theme/components/state/deserialize.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@ export function deserializeState(serializedString) {
1616
}
1717

1818
try {
19-
// For backward compatibility, it can address non-compressed data.
20-
const compressed = !serializedString.startsWith("eyJj");
2119
const decodedText = window.atob(serializedString);
22-
const jsonText = compressed
23-
? pako.inflate(decodedText, { to: "string" })
24-
: decodedText;
20+
const jsonText = pako.inflate(
21+
Uint8Array.from(decodedText, (c) => c.charCodeAt(0)),
22+
{ to: "string" },
23+
);
2524
const json = JSON.parse(jsonText);
2625

2726
if (typeof json === "object" && json != null) {

docs/.vitepress/theme/components/state/serialize.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export function serializeState(state) {
2525
rules: state.rules ? getEnabledRules(state.rules) : undefined,
2626
};
2727
const jsonString = JSON.stringify(saveData);
28-
const compressedString = pako.deflate(jsonString, { to: "string" });
28+
const compressedString = String.fromCharCode(...pako.deflate(jsonString));
2929
const base64 =
3030
(typeof window !== "undefined" && window.btoa(compressedString)) ||
3131
compressedString;

0 commit comments

Comments
 (0)