@oxiaom/adoremix 1.0.47 → 1.0.49

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.47",
3
+ "version": "1.0.49",
4
4
  "description": "AdoreMix broadcast server - cross-platform installer, runner and service manager",
5
5
  "bin": {
6
6
  "adoremix": "./bin/adoremix.js"
@@ -174,12 +174,13 @@ const AUDIO8_HEALTH_URL = `http://127.0.0.1:${AUDIO8_DEFAULT_PORT}/v1/models`;
174
174
  const AUDIO8_MODEL_DIR = '~/audio8_models/audio8-TTS-0.1B-ONNX-INT8';
175
175
 
176
176
  // 包管理器嗅探(apt/dnf/yum/apk/pacman)
177
+ // 用 which 而非 command -v(Debian/Ubuntu 12+ 的 /bin/sh 没有 command 内建,且 PATH 不一定对)
177
178
  function detectPkgMgr() {
178
- // 用 shell 执行 command -v,输出非空即表示存在(避免 execFileSync 在 exit 0 也抛 raiseForStatus)
179
179
  function exists(cmd) {
180
180
  try {
181
- const out = execSync('command -v ' + cmd, { stdio: ['pipe', 'ignore', 'ignore'], encoding: 'utf8' });
182
- return out && out.trim().length > 0;
181
+ const out = execSync('/bin/sh -c "which ' + cmd + ' 2>/dev/null || echo NOT_FOUND"', { encoding: 'utf8' });
182
+ const t = out.trim();
183
+ return t !== '' && t !== 'NOT_FOUND';
183
184
  } catch (e) { return false; }
184
185
  }
185
186
  if (exists('apt-get')) return 'apt';
@@ -297,12 +298,32 @@ function install(opts) {
297
298
  }
298
299
  }
299
300
 
300
- // git clone
301
- try {
302
- logger.log('=== 克隆 Audio8_TTS 仓库 ===');
303
- execSync(`mkdir -p ~/audio8 && if [ ! -d ~/audio8/.git ]; then git clone ${AUDIO8_REPO} ~/audio8_temp && mv ~/audio8_temp/* ~/audio8_temp/.[!.]* ~/audio8/ 2>/dev/null; rm -rf ~/audio8_temp; else cd ~/audio8 && git pull; fi`, { stdio: 'inherit', shell: '/bin/bash' });
304
- } catch (e) {
305
- logger.error('克隆失败: ' + e.message.slice(0, 200));
301
+ // git clone(带重试和国内镜像备选,github 在公司网常断)
302
+ const MIRRORS = [
303
+ AUDIO8_REPO, // 官方
304
+ 'https://ghproxy.cn/https://github.com/Audio8-AI/Audio8_TTS.git', // 国内代理
305
+ 'https://mirror.ghproxy.com/https://github.com/Audio8-AI/Audio8_TTS.git'
306
+ ];
307
+ let cloned = false;
308
+ for (let attempt = 1; attempt <= 2; attempt++) {
309
+ for (const url of MIRRORS) {
310
+ try {
311
+ logger.log(`=== 克隆 Audio8_TTS(第 ${attempt} 次尝试): ${url} ===`);
312
+ execSync(`rm -rf ~/audio8_temp && git clone --depth=1 "${url}" ~/audio8_temp 2>&1 | tail -3`, { stdio: 'inherit', shell: '/bin/bash' });
313
+ execSync(`sh -c "cd ~/audio8_temp && (shopt -s dotglob; mv -- * ~/audio8/ 2>/dev/null || true)"`, { stdio: 'inherit', shell: '/bin/bash' });
314
+ execSync('rm -rf ~/audio8_temp', { stdio: 'ignore', shell: '/bin/bash' });
315
+ cloned = true;
316
+ break;
317
+ } catch (e) {
318
+ logger.warn(`克隆失败(${url.slice(0, 60)}...): ${String(e.message).slice(0, 100)}`);
319
+ }
320
+ }
321
+ if (cloned) break;
322
+ execSync('sleep 5', { stdio: 'ignore', shell: '/bin/bash' });
323
+ }
324
+ if (!cloned) {
325
+ logger.error('所有镜像和重试都失败,无法克隆 Audio8_TTS 仓库');
326
+ logger.warn('解决:手动在 ~/audio8 下放好 Audio8_TTS 源码再重试 install(跳过 git clone 步骤)');
306
327
  return 1;
307
328
  }
308
329