import { languages } from './languages' export const imageExts = ['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.webp'] export const videoExts = ['.mp4', '.avi', '.mov', '.wmv', '.flv', '.mkv'] export const audioExts = ['.mp3', '.wav', '.ogg', '.flac', '.aac'] export const documentExts = ['.pdf', '.doc', '.docx', '.pptx', '.xlsx', '.odt', '.odp', '.ods'] export const thirdPartyApplicationExts = ['.draftsExport'] export const bookExts = ['.epub'] /** * A flat array of all file extensions known by the linguist database. * This is the primary source for identifying code files. */ const linguistExtSet = new Set() for (const lang of Object.values(languages)) { if (lang.extensions) { for (const ext of lang.extensions) { linguistExtSet.add(ext) } } } export const codeLangExts = Array.from(linguistExtSet) /** * A categorized map of custom text-based file extensions that are NOT included * in the linguist database. This is for special cases or project-specific files. */ export const customTextExts = new Map([ [ 'language', [ '.R', // R '.ets', // OpenHarmony, '.uniswap', // DeFi '.usf', // Unreal shader format '.ush' // Unreal shader header ] ], [ 'template', [ '.vm' // Velocity ] ], [ 'config', [ '.babelrc', // Babel '.bashrc', '.browserslistrc', '.conf', '.config', // 通用配置 '.dockerignore', // Docker ignore '.eslintignore', '.eslintrc', // ESLint '.fishrc', // Fish shell配置 '.htaccess', // Apache配置 '.npmignore', '.npmrc', // npm '.prettierignore', '.prettierrc', // Prettier '.rc', '.robots', // robots.txt '.yarnrc', '.zshrc' ] ], [ 'document', [ '.authors', // 作者文件 '.changelog', // 变更日志 '.license', // 许可证 '.nfo', // 信息文件 '.readme', '.text' // 纯文本 ] ], [ 'data', [ '.atom', // Feed格式 '.ldif', '.map', '.ndjson' // 换行分隔JSON ] ], [ 'build', [ '.bazel', // Bazel '.build', // Meson '.pom' ] ], [ 'database', [ '.dml', // DDL/DML '.psql' // PostgreSQL ] ], [ 'web', [ '.openapi', // API文档 '.swagger' ] ], [ 'version', [ '.bzrignore', // Bazaar ignore '.gitattributes', // Git attributes '.githistory', // Git history '.hgignore', // Mercurial ignore '.svnignore' // SVN ignore ] ], [ 'subtitle', [ '.ass', // 字幕格式 '.sub' ] ], [ 'log', [ '.log', '.rpt' // 日志和报告 (移除了.out,因为通常是二进制可执行文件) ] ], [ 'eda', [ '.cir', '.def', // LEF/DEF '.edif', // EDIF '.il', '.ils', // SKILL '.lef', '.net', '.scs', // Spectre '.sdf', // SDF '.spi' ] ] ]) /** * A comprehensive list of all text-based file extensions, combining the * extensive list from the linguist database with our custom additions. * The Set ensures there are no duplicates. */ export const textExts = [...new Set([...Array.from(customTextExts.values()).flat(), ...codeLangExts])] export const ZOOM_LEVELS = [0.25, 0.33, 0.5, 0.67, 0.75, 0.8, 0.9, 1, 1.1, 1.25, 1.5, 1.75, 2, 2.5, 3, 4, 5] // 从 ZOOM_LEVELS 生成 Ant Design Select 所需的 options 结构 export const ZOOM_OPTIONS = ZOOM_LEVELS.map((level) => ({ value: level, label: `${Math.round(level * 100)}%` })) export const ZOOM_SHORTCUTS = [ { key: 'zoom_in', shortcut: ['CommandOrControl', '='], editable: false, enabled: true, system: true }, { key: 'zoom_out', shortcut: ['CommandOrControl', '-'], editable: false, enabled: true, system: true }, { key: 'zoom_reset', shortcut: ['CommandOrControl', '0'], editable: false, enabled: true, system: true } ] export const KB = 1024 export const MB = 1024 * KB export const GB = 1024 * MB export const defaultLanguage = 'en-US' export enum FeedUrl { PRODUCTION = 'https://releases.cherry-ai.com', GITHUB_LATEST = 'https://github.com/CherryHQ/cherry-studio/releases/latest/download' } export enum UpgradeChannel { LATEST = 'latest', // 最新稳定版本 RC = 'rc', // 公测版本 BETA = 'beta' // 预览版本 } export const defaultTimeout = 10 * 1000 * 60 export const occupiedDirs = ['logs', 'Network', 'Partitions/webview/Network'] export const defaultByPassRules = 'localhost,127.0.0.1,::1'