@oxiaom/adoremix 1.0.10 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxiaom/adoremix",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "AdoreMix broadcast server - cross-platform installer, runner and service manager",
5
5
  "bin": {
6
6
  "adoremix": "./bin/adoremix.js"
package/src/install.js CHANGED
@@ -17,7 +17,8 @@ const NODE_HELPER_DEPS = {
17
17
  'mysql': '^2.18.1',
18
18
  'request': '^2.88.2',
19
19
  'sqlite': '^4.2.0',
20
- 'ws': '^8.13.0'
20
+ 'ws': '^8.13.0',
21
+ 'ini': '^4.1.3'
21
22
  };
22
23
 
23
24
  function isWorkdirInitialized(workdir) {
package/src/tts-deps.js CHANGED
@@ -84,13 +84,19 @@ function nodeModuleInstalled(workdir, modName) {
84
84
  }
85
85
 
86
86
  function getCredValue(cfg, dottedKey) {
87
+ // 直接读
87
88
  const parts = dottedKey.split('.');
88
89
  let cur = cfg;
89
90
  for (const p of parts) {
90
91
  if (cur == null || typeof cur !== 'object') return undefined;
91
92
  cur = cur[p];
92
93
  }
93
- return cur;
94
+ if (cur) return cur;
95
+ // 兼容 Qt 已有字段:TTS.xf_appid → Settings.ttsxfAPPID
96
+ if (dottedKey === 'TTS.xf_appid' && cfg.Settings && cfg.Settings.ttsxfAPPID) return cfg.Settings.ttsxfAPPID;
97
+ if (dottedKey === 'TTS.xf_apiSecret' && cfg.Settings && cfg.Settings.ttsxfAPISecret) return cfg.Settings.ttsxfAPISecret;
98
+ if (dottedKey === 'TTS.xf_apiKey' && cfg.Settings && cfg.Settings.ttsxfAPIKey) return cfg.Settings.ttsxfAPIKey;
99
+ return undefined;
94
100
  }
95
101
 
96
102
  function detectAptLike() {
package/tts/tts.js CHANGED
@@ -45,10 +45,12 @@ async function main() {
45
45
  // 读 config.ini 找 provider
46
46
  const cfgPath = path.join(process.cwd(), 'config.ini');
47
47
  let ttsSection = {};
48
+ let settings = {};
48
49
  if (fs.existsSync(cfgPath)) {
49
50
  try {
50
51
  const cfg = ini.parse(fs.readFileSync(cfgPath, 'utf-8'));
51
52
  ttsSection = cfg.TTS || {};
53
+ settings = cfg.Settings || {};
52
54
  } catch (e) { err(`config.ini 解析失败: ${e.message}`); }
53
55
  }
54
56
  const providerName = (ttsSection.provider || 'xf').toLowerCase();
@@ -65,7 +67,6 @@ async function main() {
65
67
 
66
68
  // 凭证:优先 config.ini,命令行参数兼容旧版 xf
67
69
  // 兼容 Qt 已有字段:Settings.ttsxfAPPID / ttsxfAPISecret / ttsxfAPIKey
68
- const settings = cfg.Settings || {};
69
70
  const creds = {
70
71
  xf_appid: ttsSection.xf_appid || settings.ttsxfAPPID || appidArg || '',
71
72
  xf_apiSecret: ttsSection.xf_apiSecret || settings.ttsxfAPISecret || apiSecretArg || '',