diff --git a/src/common/utils/system.ts b/src/common/utils/system.ts index 77b5ea6f..a0873b0a 100644 --- a/src/common/utils/system.ts +++ b/src/common/utils/system.ts @@ -1,10 +1,18 @@ import os from 'node:os'; import path from 'node:path'; +// 缓解Win7设备兼容性问题 +let osName: string; +try { + osName = os.hostname(); +} catch (e) { + osName = "NapCat" + +} export const systemPlatform = os.platform(); export const cpuArch = os.arch(); export const systemVersion = os.release(); -export const hostname = os.hostname(); +export const hostname = osName; const homeDir = os.homedir(); export const downloadsPath = path.join(homeDir, 'Downloads'); export const systemName = os.type(); diff --git a/vite.config.ts b/vite.config.ts index 281cbba0..e651ac77 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -7,7 +7,6 @@ import { PluginOption, Plugin } from 'vite'; import nodeResolve from '@rollup/plugin-node-resolve'; import commonjs from '@rollup/plugin-commonjs'; import { builtinModules } from 'module'; -import os from 'node:os'; import fs from 'node:fs'; const external = ['silk-wasm', 'ws', 'express', 'uuid', 'fluent-ffmpeg', 'sqlite3', 'log4js',