fix(qr): Return to 12-byte Amnezia header but keep config wrapping

Reverting header to 12-byte format (0x07C00100 + compressedLen + uncompressedLen).
This header format is known to be scanned correctly by Amnezia app.
Previous failure with this header was due to missing config wrapping.
Now we have both: correct header AND correct content structure.
This commit is contained in:
infosave2007
2026-01-24 13:42:20 +03:00
parent 939cba70b7
commit b2f42ec7ec
+3 -4
View File
@@ -68,10 +68,9 @@ class QrUtil
throw new RuntimeException('gzcompress failed'); throw new RuntimeException('gzcompress failed');
} }
$uncompressedLen = strlen($json); $uncompressedLen = strlen($json);
$version = 0x07C00100; // Magic 1984 (07C0), Count 1, Id 0 $compressedLen = strlen($compressed) + 4; // +4 for the uncompressed length field
// Pack version (4 bytes) and uncompressed length (4 bytes) $version = 0x07C00100; // Amnezia magic version number
// Note: we skipped compressedLen which was present in old format but invalid for qUncompress $header = pack('N3', $version, $compressedLen, $uncompressedLen);
$header = pack('NN', $version, $uncompressedLen);
return self::urlsafe_b64_encode($header . $compressed); return self::urlsafe_b64_encode($header . $compressed);
} }