feat: add sidebar brand customization

The primary sidebar brand was fixed to the built-in name, subtitle, and logo. Appearance settings now let users preview and save a custom brand name, localized Chinese and English subtitles, and a validated local PNG, JPEG, or WebP logo, with default-logo and full-reset actions.

Customization remains device-local and limited to the top-left brand area; installer, update, Agent, and protocol identities remain GoodBuddy. The desktop package version is now 0.11.6.

Release note: 新增“外观 → 品牌定制”,可修改左上角品牌名称、中英文副标题和本地 Logo,并支持实时预览、恢复默认及本机持久化。
This commit is contained in:
mesalogo
2026-08-27 12:42:26 +08:00
parent 618e505b8b
commit 12463ad593
22 changed files with 1125 additions and 117 deletions
+1 -30
View File
@@ -1,4 +1,5 @@
import { extname } from 'node:path'
export { detectSupportedImage } from '../shared/image-media-type'
const mimeTypes: Readonly<Record<string, string>> = {
'.c': 'text/x-c',
@@ -40,33 +41,3 @@ export function mimeTypeFromFileName(
): string {
return mimeTypes[extname(name).toLocaleLowerCase()] ?? fallback
}
export function detectSupportedImage(data: Buffer): {
extension: 'jpg' | 'png' | 'webp'
mimeType: 'image/jpeg' | 'image/png' | 'image/webp'
} {
if (
data.byteLength >= 3 &&
data[0] === 0xff &&
data[1] === 0xd8 &&
data[2] === 0xff
) {
return { extension: 'jpg', mimeType: 'image/jpeg' }
}
if (
data.byteLength >= 8 &&
data.subarray(0, 8).equals(
Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a])
)
) {
return { extension: 'png', mimeType: 'image/png' }
}
if (
data.byteLength >= 12 &&
data.subarray(0, 4).toString('ascii') === 'RIFF' &&
data.subarray(8, 12).toString('ascii') === 'WEBP'
) {
return { extension: 'webp', mimeType: 'image/webp' }
}
throw new Error('图片格式不受支持')
}