fix: remove envs introduced in v1.7.0 to make Linux TUN work properly (#1283)

This commit is contained in:
Moon 2025-10-18 20:46:43 +08:00 committed by GitHub
parent 67d378f3f3
commit f61072c309
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 68 deletions

View File

@ -118,11 +118,7 @@ export async function startCore(detached = false): Promise<Promise<void>[]> {
core = 'mihomo', core = 'mihomo',
autoSetDNS = true, autoSetDNS = true,
diffWorkDir = false, diffWorkDir = false,
mihomoCpuPriority = 'PRIORITY_NORMAL', mihomoCpuPriority = 'PRIORITY_NORMAL'
disableLoopbackDetector = false,
disableEmbedCA = false,
disableSystemCA = false,
skipSafePathCheck = false
} = await getAppConfig() } = await getAppConfig()
const { 'log-level': logLevel } = await getControledMihomoConfig() const { 'log-level': logLevel } = await getControledMihomoConfig()
if (existsSync(path.join(dataDir(), 'core.pid'))) { if (existsSync(path.join(dataDir(), 'core.pid'))) {
@ -167,19 +163,13 @@ export async function startCore(detached = false): Promise<Promise<void>[]> {
// 内核日志输出到独立的 core-日期.log 文件 // 内核日志输出到独立的 core-日期.log 文件
const stdout = createWriteStream(coreLogPath(), { flags: 'a' }) const stdout = createWriteStream(coreLogPath(), { flags: 'a' })
const stderr = createWriteStream(coreLogPath(), { flags: 'a' }) const stderr = createWriteStream(coreLogPath(), { flags: 'a' })
const env = {
DISABLE_LOOPBACK_DETECTOR: String(disableLoopbackDetector),
DISABLE_EMBED_CA: String(disableEmbedCA),
DISABLE_SYSTEM_CA: String(disableSystemCA),
SKIP_SAFE_PATH_CHECK: String(skipSafePathCheck)
}
child = spawn( child = spawn(
corePath, corePath,
['-d', diffWorkDir ? mihomoProfileWorkDir(current) : mihomoWorkDir(), ctlParam, dynamicIpcPath], ['-d', diffWorkDir ? mihomoProfileWorkDir(current) : mihomoWorkDir(), ctlParam, dynamicIpcPath],
{ {
detached: detached, detached: detached,
stdio: detached ? 'ignore' : undefined, stdio: detached ? 'ignore' : undefined
env: env
} }
) )
if (process.platform === 'win32' && child.pid) { if (process.platform === 'win32' && child.pid) {
@ -463,15 +453,12 @@ export async function quitWithoutCore(): Promise<void> {
async function checkProfile(): Promise<void> { async function checkProfile(): Promise<void> {
const { const {
core = 'mihomo', core = 'mihomo',
diffWorkDir = false, diffWorkDir = false
skipSafePathCheck = false
} = await getAppConfig() } = await getAppConfig()
const { current } = await getProfileConfig() const { current } = await getProfileConfig()
const corePath = mihomoCorePath(core) const corePath = mihomoCorePath(core)
const execFilePromise = promisify(execFile) const execFilePromise = promisify(execFile)
const env = {
SKIP_SAFE_PATH_CHECK: String(skipSafePathCheck)
}
try { try {
await execFilePromise(corePath, [ await execFilePromise(corePath, [
'-t', '-t',
@ -479,7 +466,7 @@ async function checkProfile(): Promise<void> {
diffWorkDir ? mihomoWorkConfigPath(current) : mihomoWorkConfigPath('work'), diffWorkDir ? mihomoWorkConfigPath(current) : mihomoWorkConfigPath('work'),
'-d', '-d',
mihomoTestDir() mihomoTestDir()
], { env }) ])
} catch (error) { } catch (error) {
await managerLogger.error('Profile check failed', error) await managerLogger.error('Profile check failed', error)

View File

@ -25,11 +25,7 @@ export const defaultConfig: IAppConfig = {
controlSniff: true, controlSniff: true,
floatingWindowCompatMode: true, floatingWindowCompatMode: true,
disableHardwareAcceleration: false, disableHardwareAcceleration: false,
disableLoopbackDetector: false,
hideConnectionCardWave: false, hideConnectionCardWave: false,
disableEmbedCA: false,
disableSystemCA: false,
skipSafePathCheck: false,
nameserverPolicy: {}, nameserverPolicy: {},
siderOrder: [ siderOrder: [
'sysproxy', 'sysproxy',

View File

@ -42,11 +42,8 @@ const Mihomo: React.FC = () => {
smartCoreCollectData = false, smartCoreCollectData = false,
smartCoreStrategy = 'sticky-sessions', smartCoreStrategy = 'sticky-sessions',
maxLogDays = 7, maxLogDays = 7,
sysProxy, sysProxy
disableLoopbackDetector, } = appConfig || {}
disableEmbedCA,
disableSystemCA,
skipSafePathCheck } = appConfig || {}
const { controledMihomoConfig, patchControledMihomoConfig } = useControledMihomoConfig() const { controledMihomoConfig, patchControledMihomoConfig } = useControledMihomoConfig()
interface WebUIPanel { interface WebUIPanel {
@ -1130,42 +1127,7 @@ const Mihomo: React.FC = () => {
}} }}
/> />
</SettingItem> </SettingItem>
<SettingItem title={t('mihomo.disableLoopbackDetector')} divider>
<Switch
size="sm"
isSelected={disableLoopbackDetector}
onValueChange={(v) => {
handleConfigChangeWithRestart('disableLoopbackDetector', v)
}}
/>
</SettingItem>
<SettingItem title={t('mihomo.skipSafePathCheck')} divider>
<Switch
size="sm"
isSelected={skipSafePathCheck}
onValueChange={(v) => {
handleConfigChangeWithRestart('skipSafePathCheck', v)
}}
/>
</SettingItem>
<SettingItem title={t('mihomo.disableEmbedCA')} divider>
<Switch
size="sm"
isSelected={disableEmbedCA}
onValueChange={(v) => {
handleConfigChangeWithRestart('disableEmbedCA', v)
}}
/>
</SettingItem>
<SettingItem title={t('mihomo.disableSystemCA')} divider>
<Switch
size="sm"
isSelected={disableSystemCA}
onValueChange={(v) => {
handleConfigChangeWithRestart('disableSystemCA', v)
}}
/>
</SettingItem>
<SettingItem title={t('mihomo.logRetentionDays')} divider> <SettingItem title={t('mihomo.logRetentionDays')} divider>
<Input <Input
size="sm" size="sm"

View File

@ -223,10 +223,6 @@ interface IAppConfig {
smartCoreUseLightGBM: boolean smartCoreUseLightGBM: boolean
smartCoreCollectData: boolean smartCoreCollectData: boolean
smartCoreStrategy: 'sticky-sessions' | 'round-robin' smartCoreStrategy: 'sticky-sessions' | 'round-robin'
disableLoopbackDetector: boolean
disableEmbedCA: boolean
disableSystemCA: boolean
skipSafePathCheck: boolean
proxyDisplayMode: 'simple' | 'full' proxyDisplayMode: 'simple' | 'full'
proxyDisplayOrder: 'default' | 'delay' | 'name' proxyDisplayOrder: 'default' | 'delay' | 'name'
profileDisplayDate?: 'expire' | 'update' profileDisplayDate?: 'expire' | 'update'