mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-28 05:30:29 +08:00
fix start error when using silent log-level
This commit is contained in:
parent
dfdf044b48
commit
c4618b4ddb
@ -5,3 +5,7 @@
|
|||||||
### New Features
|
### New Features
|
||||||
|
|
||||||
- 支持自动开启轻量模式
|
- 支持自动开启轻量模式
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- 修复日志等级为静默时,无法正常启动的问题
|
||||||
|
|||||||
@ -21,6 +21,8 @@ export async function generateProfile(): Promise<void> {
|
|||||||
const currentProfile = await overrideProfile(current, await getProfile(current))
|
const currentProfile = await overrideProfile(current, await getProfile(current))
|
||||||
const controledMihomoConfig = await getControledMihomoConfig()
|
const controledMihomoConfig = await getControledMihomoConfig()
|
||||||
const profile = deepMerge(currentProfile, controledMihomoConfig)
|
const profile = deepMerge(currentProfile, controledMihomoConfig)
|
||||||
|
// 确保可以拿到基础日志信息
|
||||||
|
profile['log-level'] = 'info'
|
||||||
runtimeConfig = profile
|
runtimeConfig = profile
|
||||||
runtimeConfigStr = yaml.stringify(profile)
|
runtimeConfigStr = yaml.stringify(profile)
|
||||||
await writeFile(mihomoWorkConfigPath(), runtimeConfigStr)
|
await writeFile(mihomoWorkConfigPath(), runtimeConfigStr)
|
||||||
|
|||||||
@ -24,7 +24,8 @@ import {
|
|||||||
stopMihomoConnections,
|
stopMihomoConnections,
|
||||||
stopMihomoTraffic,
|
stopMihomoTraffic,
|
||||||
stopMihomoLogs,
|
stopMihomoLogs,
|
||||||
stopMihomoMemory
|
stopMihomoMemory,
|
||||||
|
patchMihomoConfig
|
||||||
} from './mihomoApi'
|
} from './mihomoApi'
|
||||||
import chokidar from 'chokidar'
|
import chokidar from 'chokidar'
|
||||||
import { readFile, rm, writeFile } from 'fs/promises'
|
import { readFile, rm, writeFile } from 'fs/promises'
|
||||||
@ -47,6 +48,7 @@ let retry = 10
|
|||||||
|
|
||||||
export async function startCore(detached = false): Promise<Promise<void>[]> {
|
export async function startCore(detached = false): Promise<Promise<void>[]> {
|
||||||
const { core = 'mihomo', autoSetDNS = true, encryptedPassword } = await getAppConfig()
|
const { core = 'mihomo', autoSetDNS = true, encryptedPassword } = await getAppConfig()
|
||||||
|
const { 'log-level': logLevel } = await getControledMihomoConfig()
|
||||||
if (existsSync(path.join(dataDir(), 'core.pid'))) {
|
if (existsSync(path.join(dataDir(), 'core.pid'))) {
|
||||||
const pid = parseInt(await readFile(path.join(dataDir(), 'core.pid'), 'utf-8'))
|
const pid = parseInt(await readFile(path.join(dataDir(), 'core.pid'), 'utf-8'))
|
||||||
try {
|
try {
|
||||||
@ -136,6 +138,7 @@ export async function startCore(detached = false): Promise<Promise<void>[]> {
|
|||||||
} catch {
|
} catch {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
|
await patchMihomoConfig({ 'log-level': logLevel })
|
||||||
resolve()
|
resolve()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user