From 8ff3ad824e1c6fa58b8e4055ad7044bd00098baf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Sat, 19 Apr 2025 20:03:00 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E7=A6=81=E7=94=A8ffmpeg=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/framework/napcat.ts | 16 +++++++++------- src/shell/base.ts | 16 +++++++++------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/framework/napcat.ts b/src/framework/napcat.ts index 9f19cecf..8a8282ee 100644 --- a/src/framework/napcat.ts +++ b/src/framework/napcat.ts @@ -38,13 +38,15 @@ export async function NCoreInitFramework( const logger = new LogWrapper(pathWrapper.logsPath); const basicInfoWrapper = new QQBasicInfoWrapper({ logger }); const wrapper = loadQQWrapper(basicInfoWrapper.getFullQQVesion()); - downloadFFmpegIfNotExists(logger).then(({ path, reset }) => { - if (reset && path) { - FFmpegService.setFfmpegPath(path,logger); - } - }).catch(e => { - logger.logError('[Ffmpeg] Error:', e); - }); + if (!process.env['NAPCAT_DISABLE_FFMPEG_DOWNLOAD']) { + downloadFFmpegIfNotExists(logger).then(({ path, reset }) => { + if (reset && path) { + FFmpegService.setFfmpegPath(path, logger); + } + }).catch(e => { + logger.logError('[Ffmpeg] Error:', e); + }); + } //直到登录成功后,执行下一步 const selfInfo = await new Promise((resolveSelfInfo) => { const loginListener = new NodeIKernelLoginListener(); diff --git a/src/shell/base.ts b/src/shell/base.ts index 540e19cb..17258697 100644 --- a/src/shell/base.ts +++ b/src/shell/base.ts @@ -314,13 +314,15 @@ export async function NCoreInitShell() { const logger = new LogWrapper(pathWrapper.logsPath); handleUncaughtExceptions(logger); await connectToNamedPipe(logger).catch(e => logger.logError('命名管道连接失败', e)); - downloadFFmpegIfNotExists(logger).then(({ path, reset }) => { - if (reset && path) { - FFmpegService.setFfmpegPath(path, logger); - } - }).catch(e => { - logger.logError('[Ffmpeg] Error:', e); - }); + if (!process.env['NAPCAT_DISABLE_FFMPEG_DOWNLOAD']) { + downloadFFmpegIfNotExists(logger).then(({ path, reset }) => { + if (reset && path) { + FFmpegService.setFfmpegPath(path, logger); + } + }).catch(e => { + logger.logError('[Ffmpeg] Error:', e); + }); + } const basicInfoWrapper = new QQBasicInfoWrapper({ logger }); const wrapper = loadQQWrapper(basicInfoWrapper.getFullQQVesion());