mirror of
https://github.com/ershisan99/www.git
synced 2025-12-18 21:09:23 +00:00
Update decompression method and joker string parsing logic for baltromp 0.2.10 (#5)
This commit is contained in:
@@ -1454,8 +1454,8 @@ async function decodePackedString(encodedString: string): Promise<JsonValue> {
|
|||||||
bytes[i] = binaryString.charCodeAt(i)
|
bytes[i] = binaryString.charCodeAt(i)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 2: Decompress using raw inflate
|
// Step 2: Decompress using gzip
|
||||||
const ds = new DecompressionStream('deflate-raw')
|
const ds = new DecompressionStream('gzip')
|
||||||
const decompressedStream = new Blob([bytes]).stream().pipeThrough(ds)
|
const decompressedStream = new Blob([bytes]).stream().pipeThrough(ds)
|
||||||
const decompressedBlob = await new Response(decompressedStream).blob()
|
const decompressedBlob = await new Response(decompressedStream).blob()
|
||||||
const decompressedString = await decompressedBlob.text()
|
const decompressedString = await decompressedBlob.text()
|
||||||
@@ -1477,9 +1477,10 @@ async function decodePackedString(encodedString: string): Promise<JsonValue> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function parseJokersFromString(str: string) {
|
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)
|
const decoded = await decodePackedString(str)
|
||||||
console.log(decoded)
|
|
||||||
if (decoded && typeof decoded === 'object' && 'cards' in decoded) {
|
if (decoded && typeof decoded === 'object' && 'cards' in decoded) {
|
||||||
return Object.values(decoded.cards as any).map(
|
return Object.values(decoded.cards as any).map(
|
||||||
(c: any) => c.save_fields.center
|
(c: any) => c.save_fields.center
|
||||||
|
|||||||
Reference in New Issue
Block a user