From b2f42ec7ecfb818e12e7164271e482339cae27ca Mon Sep 17 00:00:00 2001 From: infosave2007 Date: Sat, 24 Jan 2026 13:42:20 +0300 Subject: [PATCH] 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. --- inc/QrUtil.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/inc/QrUtil.php b/inc/QrUtil.php index 6bb8f62..e294506 100644 --- a/inc/QrUtil.php +++ b/inc/QrUtil.php @@ -68,10 +68,9 @@ class QrUtil throw new RuntimeException('gzcompress failed'); } $uncompressedLen = strlen($json); - $version = 0x07C00100; // Magic 1984 (07C0), Count 1, Id 0 - // Pack version (4 bytes) and uncompressed length (4 bytes) - // Note: we skipped compressedLen which was present in old format but invalid for qUncompress - $header = pack('NN', $version, $uncompressedLen); + $compressedLen = strlen($compressed) + 4; // +4 for the uncompressed length field + $version = 0x07C00100; // Amnezia magic version number + $header = pack('N3', $version, $compressedLen, $uncompressedLen); return self::urlsafe_b64_encode($header . $compressed); }