From a42b6e536743ca4a49e24d5d20528ce061dfd213 Mon Sep 17 00:00:00 2001 From: Asvel Date: Sun, 23 Feb 2025 20:28:09 +0800 Subject: [PATCH] fix image compatibility under Firefox --- client/StaticData.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/client/StaticData.cs b/client/StaticData.cs index 7453575..656012d 100644 --- a/client/StaticData.cs +++ b/client/StaticData.cs @@ -13,11 +13,17 @@ internal class StaticData { public static readonly JsonSerializerOptions JsonOptions = new() { Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping }; public static readonly byte[] BmpHeader = [ - 0x42, 0x4D, 0x46, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x38, 0x00, + 0x42, 0x4D, 0x7A, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7A, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0xD8, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x20, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x60, 0x09, 0x00, 0x00, 0x60, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, + // Firefox 不支持只带 alpha mask 不带后续 color space 内容的 DIB header,加个无效的 bV4CSType=-1 哄哄它 + // https://hg.mozilla.org/mozilla-central/file/tip/image/decoders/nsBMPDecoder.cpp + 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, ]; public readonly Dictionary Jsons = [];