mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-27 21:20:29 +08:00
nameserver policy can not delete
This commit is contained in:
parent
ed69c1261d
commit
6240351cb9
@ -14,6 +14,9 @@ export async function getAppConfig(force = false): Promise<IAppConfig> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function patchAppConfig(patch: Partial<IAppConfig>): Promise<void> {
|
export async function patchAppConfig(patch: Partial<IAppConfig>): Promise<void> {
|
||||||
|
if (patch.nameserverPolicy) {
|
||||||
|
appConfig.nameserverPolicy = patch.nameserverPolicy
|
||||||
|
}
|
||||||
appConfig = deepMerge(appConfig, patch)
|
appConfig = deepMerge(appConfig, patch)
|
||||||
await writeFile(appConfigPath(), yaml.stringify(appConfig))
|
await writeFile(appConfigPath(), yaml.stringify(appConfig))
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,6 +39,10 @@ export async function patchControledMihomoConfig(patch: Partial<IMihomoConfig>):
|
|||||||
if (patch.hosts) {
|
if (patch.hosts) {
|
||||||
controledMihomoConfig.hosts = patch.hosts
|
controledMihomoConfig.hosts = patch.hosts
|
||||||
}
|
}
|
||||||
|
if (patch.dns?.['nameserver-policy']) {
|
||||||
|
controledMihomoConfig.dns = controledMihomoConfig.dns || {}
|
||||||
|
controledMihomoConfig.dns['nameserver-policy'] = patch.dns['nameserver-policy']
|
||||||
|
}
|
||||||
controledMihomoConfig = deepMerge(controledMihomoConfig, patch)
|
controledMihomoConfig = deepMerge(controledMihomoConfig, patch)
|
||||||
if (!useNameserverPolicy) {
|
if (!useNameserverPolicy) {
|
||||||
delete controledMihomoConfig?.dns?.['nameserver-policy']
|
delete controledMihomoConfig?.dns?.['nameserver-policy']
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user