File tree Expand file tree Collapse file tree 2 files changed +5
-6
lines changed
docs/.vitepress/theme/components/state Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -16,12 +16,11 @@ export function deserializeState(serializedString) {
16
16
}
17
17
18
18
try {
19
- // For backward compatibility, it can address non-compressed data.
20
- const compressed = ! serializedString . startsWith ( "eyJj" ) ;
21
19
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
+ ) ;
25
24
const json = JSON . parse ( jsonText ) ;
26
25
27
26
if ( typeof json === "object" && json != null ) {
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ export function serializeState(state) {
25
25
rules : state . rules ? getEnabledRules ( state . rules ) : undefined ,
26
26
} ;
27
27
const jsonString = JSON . stringify ( saveData ) ;
28
- const compressedString = pako . deflate ( jsonString , { to : "string" } ) ;
28
+ const compressedString = String . fromCharCode ( ... pako . deflate ( jsonString ) ) ;
29
29
const base64 =
30
30
( typeof window !== "undefined" && window . btoa ( compressedString ) ) ||
31
31
compressedString ;
You can’t perform that action at this time.
0 commit comments