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,并支持实时预览、恢复默认及本机持久化。
44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
import { extname } from 'node:path'
|
|
export { detectSupportedImage } from '../shared/image-media-type'
|
|
|
|
const mimeTypes: Readonly<Record<string, string>> = {
|
|
'.c': 'text/x-c',
|
|
'.cpp': 'text/x-c++',
|
|
'.css': 'text/css',
|
|
'.csv': 'text/csv',
|
|
'.docx':
|
|
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
'.htm': 'text/html',
|
|
'.html': 'text/html',
|
|
'.java': 'text/x-java-source',
|
|
'.jpeg': 'image/jpeg',
|
|
'.jpg': 'image/jpeg',
|
|
'.js': 'text/javascript',
|
|
'.json': 'application/json',
|
|
'.log': 'text/plain',
|
|
'.md': 'text/markdown',
|
|
'.pdf': 'application/pdf',
|
|
'.png': 'image/png',
|
|
'.pptx':
|
|
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
|
'.py': 'text/x-python',
|
|
'.sql': 'text/plain',
|
|
'.ts': 'text/typescript',
|
|
'.tsx': 'text/typescript',
|
|
'.txt': 'text/plain',
|
|
'.webp': 'image/webp',
|
|
'.xlsx':
|
|
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
'.xml': 'application/xml',
|
|
'.yaml': 'application/yaml',
|
|
'.yml': 'application/yaml',
|
|
'.zip': 'application/zip'
|
|
}
|
|
|
|
export function mimeTypeFromFileName(
|
|
name: string,
|
|
fallback = 'application/octet-stream'
|
|
): string {
|
|
return mimeTypes[extname(name).toLocaleLowerCase()] ?? fallback
|
|
}
|