From 482852c13411ee04bcf6c77b95317eb53a882abe Mon Sep 17 00:00:00 2001 From: Renato Rotenberg <38757897+Brawmario@users.noreply.github.com> Date: Mon, 9 Jun 2025 15:05:58 -0300 Subject: [PATCH] Update decompression method and joker string parsing logic for baltromp 0.2.10 (#5) --- src/app/(home)/log-parser/page.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/app/(home)/log-parser/page.tsx b/src/app/(home)/log-parser/page.tsx index c3ea68f..1700106 100644 --- a/src/app/(home)/log-parser/page.tsx +++ b/src/app/(home)/log-parser/page.tsx @@ -1454,8 +1454,8 @@ async function decodePackedString(encodedString: string): Promise { bytes[i] = binaryString.charCodeAt(i) } - // Step 2: Decompress using raw inflate - const ds = new DecompressionStream('deflate-raw') + // Step 2: Decompress using gzip + const ds = new DecompressionStream('gzip') const decompressedStream = new Blob([bytes]).stream().pipeThrough(ds) const decompressedBlob = await new Response(decompressedStream).blob() const decompressedString = await decompressedBlob.text() @@ -1477,9 +1477,10 @@ async function decodePackedString(encodedString: string): Promise { } async function parseJokersFromString(str: string) { - if (str.toLowerCase().startsWith('7z')) { + // Check if the string starts with 'H4' indicating a packed string + // This is a common prefix for base64 encoded gzip strings + if (str.startsWith('H4')) { const decoded = await decodePackedString(str) - console.log(decoded) if (decoded && typeof decoded === 'object' && 'cards' in decoded) { return Object.values(decoded.cards as any).map( (c: any) => c.save_fields.center