mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-27 05:00:30 +08:00
fix dns
This commit is contained in:
parent
7f539ad75a
commit
72417e8ef6
@ -3,6 +3,7 @@ import yaml from 'yaml'
|
||||
import fs from 'fs'
|
||||
import { getAxios, startMihomoMemory, startMihomoTraffic } from '../core/mihomoApi'
|
||||
import { generateProfile } from '../resolve/factory'
|
||||
import { getAppConfig } from './app'
|
||||
|
||||
export let controledMihomoConfig: Partial<IMihomoConfig> // mihomo.yaml
|
||||
|
||||
@ -14,6 +15,7 @@ export function getControledMihomoConfig(force = false): Partial<IMihomoConfig>
|
||||
}
|
||||
|
||||
export function setControledMihomoConfig(patch: Partial<IMihomoConfig>): void {
|
||||
const { useNameserverPolicy } = getAppConfig()
|
||||
if (patch.tun) {
|
||||
const oldTun = controledMihomoConfig.tun || {}
|
||||
const newTun = Object.assign(oldTun, patch.tun)
|
||||
@ -21,8 +23,10 @@ export function setControledMihomoConfig(patch: Partial<IMihomoConfig>): void {
|
||||
}
|
||||
if (patch.dns) {
|
||||
const oldDns = controledMihomoConfig.dns || {}
|
||||
const newDns = { ...patch.dns }
|
||||
newDns.enable = oldDns.enable
|
||||
const newDns = Object.assign(oldDns, patch.dns)
|
||||
if (!useNameserverPolicy) {
|
||||
delete newDns['nameserver-policy']
|
||||
}
|
||||
patch.dns = newDns
|
||||
}
|
||||
if (patch.sniffer) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user