feat: ffmpeg download auto

This commit is contained in:
手瓜一十雪
2025-04-17 14:28:51 +08:00
parent fc37288827
commit e4b21e94f5
7 changed files with 336 additions and 18 deletions

View File

@@ -31,6 +31,8 @@ import { WebUiDataRuntime } from '@/webui/src/helper/Data';
import { napCatVersion } from '@/common/version';
import { NodeIO3MiscListener } from '@/core/listeners/NodeIO3MiscListener';
import { sleep } from '@/common/helper';
import { downloadFFmpegIfNotExists } from '@/common/download-ffmpeg';
import { FFmpegService } from '@/common/ffmpeg';
// NapCat Shell App ES 入口文件
async function handleUncaughtExceptions(logger: LogWrapper) {
@@ -311,6 +313,11 @@ export async function NCoreInitShell() {
const pathWrapper = new NapCatPathWrapper();
const logger = new LogWrapper(pathWrapper.logsPath);
handleUncaughtExceptions(logger);
downloadFFmpegIfNotExists(logger).then(({ path, isExist }) => {
if (!isExist && path) {
FFmpegService.setFfmpegPath(path);
}
});
const basicInfoWrapper = new QQBasicInfoWrapper({ logger });
const wrapper = loadQQWrapper(basicInfoWrapper.getFullQQVesion());

View File

@@ -1,7 +1,6 @@
import { NCoreInitShell } from './base';
import * as net from 'net'; // 引入 net 模块
import * as net from 'net';
import * as process from 'process';
if (process.platform === 'win32') {
const pid = process.pid;
const pipePath = `\\\\.\\pipe\\NapCat_${pid}`;