diff --git a/electron/config/default-subtitle-templates.json b/electron/config/default-subtitle-templates.json index c24620a..b1f4749 100644 --- a/electron/config/default-subtitle-templates.json +++ b/electron/config/default-subtitle-templates.json @@ -2874,5 +2874,5 @@ "is_system": 1 } ], - "timestamp": "2026-06-16T08:45:31.753Z" + "timestamp": "2026-06-20T10:27:18.332Z" } diff --git a/electron/config/system-templates.json b/electron/config/system-templates.json index c9952f7..7b6dae8 100644 --- a/electron/config/system-templates.json +++ b/electron/config/system-templates.json @@ -4294,5 +4294,5 @@ "is_system": 1 } ], - "timestamp": "2026-06-16T08:45:31.753Z" + "timestamp": "2026-06-20T10:27:18.332Z" } diff --git a/scripts/analyze-all-template-sources.cjs b/scripts/analyze-all-template-sources.cjs index 1eaa87e..6abec6a 100644 --- a/scripts/analyze-all-template-sources.cjs +++ b/scripts/analyze-all-template-sources.cjs @@ -7,7 +7,7 @@ console.log('=== 全面分析所有配置源和数据库中的模板差异 ===\n // 1. 收集所有配置文件 const configFiles = [ { name: 'C盘根目录', path: 'C:\\system-templates.json' }, - { name: '项目打包配置', path: 'electron/resources/extra/common/config/system-templates.json' }, + { name: '项目打包配置', path: 'packaging/resources/common/config/system-templates.json' }, { name: '项目开发配置', path: 'electron/config/system-templates.json' }, { name: '历史配置v2', path: 'electron/config/default-subtitle-templates-v2.json' }, { name: 'TypeScript源文件', path: 'src/config/systemSubtitleTemplates.ts' }, diff --git a/scripts/check-project-config.cjs b/scripts/check-project-config.cjs index 4025588..1b32766 100644 --- a/scripts/check-project-config.cjs +++ b/scripts/check-project-config.cjs @@ -1,6 +1,6 @@ const fs = require('fs'); -const content = fs.readFileSync('electron/resources/extra/common/config/system-templates.json', 'utf-8'); +const content = fs.readFileSync('packaging/resources/common/config/system-templates.json', 'utf-8'); const data = JSON.parse(content); console.log('模板数量:', data.subtitleTemplates.length); diff --git a/scripts/compare-c-drive-config.cjs b/scripts/compare-c-drive-config.cjs index 8b27ff6..3d7dfe7 100644 --- a/scripts/compare-c-drive-config.cjs +++ b/scripts/compare-c-drive-config.cjs @@ -3,7 +3,7 @@ const path = require('path'); // 读取 C 盘根目录的配置文件 const cDriveFile = 'C:\\system-templates.json'; -const projectFile = path.join(__dirname, '../electron/resources/extra/common/config/system-templates.json'); +const projectFile = path.join(__dirname, '../packaging/resources/common/config/system-templates.json'); console.log('=== 对比 C 盘配置 vs 项目配置 ===\n'); diff --git a/scripts/compare-c-vs-project.cjs b/scripts/compare-c-vs-project.cjs index ad5cf3a..92540d3 100644 --- a/scripts/compare-c-vs-project.cjs +++ b/scripts/compare-c-vs-project.cjs @@ -1,7 +1,7 @@ const fs = require('fs'); const cDriveFile = 'C:\\system-templates.json'; -const projectFile = 'electron/resources/extra/common/config/system-templates.json'; +const projectFile = 'packaging/resources/common/config/system-templates.json'; const cConfig = JSON.parse(fs.readFileSync(cDriveFile, 'utf-8')); const pConfig = JSON.parse(fs.readFileSync(projectFile, 'utf-8')); @@ -71,4 +71,3 @@ Object.keys(pGroups).forEach(key => { console.log(`模板 ${pGroups[key].join(', ')} 配置相同`); } }); - diff --git a/scripts/compare-historical-config.cjs b/scripts/compare-historical-config.cjs index 790f423..4022ca9 100644 --- a/scripts/compare-historical-config.cjs +++ b/scripts/compare-historical-config.cjs @@ -6,7 +6,7 @@ const historicalFile = path.join(__dirname, '../electron/config/default-subtitle const historical = JSON.parse(fs.readFileSync(historicalFile, 'utf-8')); // 读取当前配置 -const currentFile = path.join(__dirname, '../electron/resources/extra/common/config/system-templates.json'); +const currentFile = path.join(__dirname, '../packaging/resources/common/config/system-templates.json'); const current = JSON.parse(fs.readFileSync(currentFile, 'utf-8')); console.log('=== 历史配置 vs 当前配置对比 ===\n'); diff --git a/scripts/compare-templates.cjs b/scripts/compare-templates.cjs index 8d153b6..aa87902 100644 --- a/scripts/compare-templates.cjs +++ b/scripts/compare-templates.cjs @@ -2,7 +2,7 @@ const fs = require('fs'); const path = require('path'); // 读取 JSON 配置文件 -const jsonFile = path.join(__dirname, '../electron/resources/extra/common/config/system-templates.json'); +const jsonFile = path.join(__dirname, '../packaging/resources/common/config/system-templates.json'); const data = JSON.parse(fs.readFileSync(jsonFile, 'utf-8')); console.log('=== 模板标题字幕配置对比 ===\n'); diff --git a/scripts/find-8-different-templates.cjs b/scripts/find-8-different-templates.cjs index c2c1c93..4451163 100644 --- a/scripts/find-8-different-templates.cjs +++ b/scripts/find-8-different-templates.cjs @@ -6,7 +6,7 @@ console.log('=== 查找8个模板的不同配置(普通字幕字体、特效 // 检查所有可能的配置文件 const filesToCheck = [ { name: 'default-ipagent-config.json', path: 'electron/config/default-ipagent-config.json' }, - { name: 'default-ipagent-config.json (resources)', path: 'electron/resources/extra/common/config/default-ipagent-config.json' }, + { name: 'default-ipagent-config.json (resources)', path: 'packaging/resources/common/config/default-ipagent-config.json' }, { name: 'default-subtitle-templates.json', path: 'electron/config/default-subtitle-templates.json' }, { name: 'C盘配置', path: 'C:\\system-templates.json' }, ]; diff --git a/scripts/find-different-templates.cjs b/scripts/find-different-templates.cjs index bc540db..1d2c43f 100644 --- a/scripts/find-different-templates.cjs +++ b/scripts/find-different-templates.cjs @@ -5,7 +5,7 @@ console.log('=== 查找8个模板的不同配置 ===\n'); // 检查所有可能的配置文件 const filesToCheck = [ - { name: 'default-templates.json (subtitleStyles)', path: 'electron/resources/extra/common/config/default-templates.json' }, + { name: 'default-templates.json (subtitleStyles)', path: 'packaging/resources/common/config/default-templates.json' }, { name: 'default-subtitle-templates.json', path: 'electron/config/default-subtitle-templates.json' }, { name: 'C盘配置', path: 'C:\\system-templates.json' }, ]; diff --git a/scripts/generate-template-analysis-report.cjs b/scripts/generate-template-analysis-report.cjs index 1e27b7f..1e6e195 100644 --- a/scripts/generate-template-analysis-report.cjs +++ b/scripts/generate-template-analysis-report.cjs @@ -6,7 +6,7 @@ console.log('=== 8个模板配置差异全面分析报告 ===\n'); // 读取所有配置源 const sources = { 'C盘根目录': 'C:\\system-templates.json', - '项目打包配置': 'electron/resources/extra/common/config/system-templates.json', + '项目打包配置': 'packaging/resources/common/config/system-templates.json', '项目开发配置': 'electron/config/system-templates.json', '历史配置v2': 'electron/config/default-subtitle-templates-v2.json', 'TypeScript源': 'src/config/systemSubtitleTemplates.ts', diff --git a/scripts/reduce-subtitle-font-sizes.cjs b/scripts/reduce-subtitle-font-sizes.cjs index 95ba463..37e15df 100644 --- a/scripts/reduce-subtitle-font-sizes.cjs +++ b/scripts/reduce-subtitle-font-sizes.cjs @@ -6,7 +6,7 @@ const fs = require('fs'); const path = require('path'); -const configPath = path.join(__dirname, '../electron/resources/extra/common/config/system-templates.json'); +const configPath = path.join(__dirname, '../packaging/resources/common/config/system-templates.json'); console.log('📖 读取配置文件:', configPath); diff --git a/scripts/reduce-title-subtitle-sizes.cjs b/scripts/reduce-title-subtitle-sizes.cjs index c7eb9a9..a5d99fa 100644 --- a/scripts/reduce-title-subtitle-sizes.cjs +++ b/scripts/reduce-title-subtitle-sizes.cjs @@ -5,7 +5,7 @@ const fs = require('fs'); const path = require('path'); -const configPath = path.join(__dirname, '../electron/resources/extra/common/config/system-templates.json'); +const configPath = path.join(__dirname, '../packaging/resources/common/config/system-templates.json'); console.log('📖 读取配置文件:', configPath); diff --git a/scripts/sync-system-subtitle-sources.cjs b/scripts/sync-system-subtitle-sources.cjs index 4b5b38f..97a72f4 100644 --- a/scripts/sync-system-subtitle-sources.cjs +++ b/scripts/sync-system-subtitle-sources.cjs @@ -3,9 +3,10 @@ const path = require('path'); const repoRoot = path.join(__dirname, '..'); const tsSourcePath = path.join(repoRoot, 'src', 'config', 'systemSubtitleTemplates.ts'); +const packagingResourceRoot = path.join(repoRoot, 'packaging', 'resources'); const runtimeDatabasePath = path.join(repoRoot, 'data', 'database.db'); const runtimeExportPath = path.join(repoRoot, 'build', 'runtime-system-subtitle-templates.json'); -const previewAssetDir = path.join(repoRoot, 'electron', 'resources', 'extra', 'common', 'cover-templates'); +const previewAssetDir = path.join(packagingResourceRoot, 'common', 'cover-templates'); const packagedPreviewPrefix = 'extra/common/cover-templates'; const inlineTemplateIds = new Set([ 'template_system_11', @@ -27,12 +28,12 @@ const defaultTriggeredSoundConfig = { const systemTemplateJsonPaths = [ path.join(repoRoot, 'electron', 'config', 'system-templates.json'), - path.join(repoRoot, 'electron', 'resources', 'extra', 'common', 'config', 'system-templates.json'), + path.join(packagingResourceRoot, 'common', 'config', 'system-templates.json'), ]; const defaultSubtitleTemplateJsonPaths = [ path.join(repoRoot, 'electron', 'config', 'default-subtitle-templates.json'), - path.join(repoRoot, 'electron', 'resources', 'extra', 'common', 'config', 'default-subtitle-templates.json'), + path.join(packagingResourceRoot, 'common', 'config', 'default-subtitle-templates.json'), ]; const isAbsoluteLocalPath = (value) => /^[a-zA-Z]:[\\/]/.test(value) || value.startsWith('\\\\'); @@ -148,6 +149,19 @@ const readTemplatesFromTsSource = () => { return templates; }; +const readTemplatesFromJsonFile = (filePath) => { + if (!fs.existsSync(filePath)) { + return null; + } + + const json = JSON.parse(fs.readFileSync(filePath, 'utf8')); + const templates = json.subtitleTemplates; + if (!Array.isArray(templates) || templates.length !== 16) { + return null; + } + return templates; +}; + const readCanonicalTemplates = () => { const dbTemplates = readTemplatesFromRuntimeDatabase(); if (dbTemplates) { @@ -157,6 +171,16 @@ const readCanonicalTemplates = () => { }; } + for (const filePath of systemTemplateJsonPaths) { + const jsonTemplates = readTemplatesFromJsonFile(filePath); + if (jsonTemplates) { + return { + source: filePath, + templates: jsonTemplates.map(normalizeTemplateForPackaging), + }; + } + } + return { source: 'ts-source', templates: readTemplatesFromTsSource().map(normalizeTemplateForPackaging), diff --git a/scripts/update-system-templates-from-ts.cjs b/scripts/update-system-templates-from-ts.cjs index aec38df..4885848 100644 --- a/scripts/update-system-templates-from-ts.cjs +++ b/scripts/update-system-templates-from-ts.cjs @@ -3,7 +3,7 @@ const path = require('path'); // 读取 TypeScript 配置文件 const tsFilePath = path.join(__dirname, '../src/config/systemSubtitleTemplates.ts'); -const jsonFilePath = path.join(__dirname, '../electron/resources/extra/common/config/system-templates.json'); +const jsonFilePath = path.join(__dirname, '../packaging/resources/common/config/system-templates.json'); console.log('读取 TypeScript 配置文件:', tsFilePath); const tsContent = fs.readFileSync(tsFilePath, 'utf-8'); diff --git a/scripts/verify-templates.cjs b/scripts/verify-templates.cjs index f210e58..dd3de14 100644 --- a/scripts/verify-templates.cjs +++ b/scripts/verify-templates.cjs @@ -1,7 +1,7 @@ const fs = require('fs'); const path = require('path'); -const jsonFilePath = path.join(__dirname, '../electron/resources/extra/common/config/system-templates.json'); +const jsonFilePath = path.join(__dirname, '../packaging/resources/common/config/system-templates.json'); const data = JSON.parse(fs.readFileSync(jsonFilePath, 'utf-8')); console.log('验证字幕模板配置:\n');