diff --git a/src/main/config/app.ts b/src/main/config/app.ts index 64fdc00..eacc1a2 100644 --- a/src/main/config/app.ts +++ b/src/main/config/app.ts @@ -9,7 +9,7 @@ let appConfig: IAppConfig // config.yaml export async function getAppConfig(force = false): Promise { if (force || !appConfig) { const data = await readFile(appConfigPath(), 'utf-8') - appConfig = yaml.parse(data) || defaultConfig + appConfig = yaml.parse(data, { merge: true }) || defaultConfig } if (typeof appConfig !== 'object') appConfig = defaultConfig return appConfig diff --git a/src/main/config/controledMihomo.ts b/src/main/config/controledMihomo.ts index e5b7f37..016eb34 100644 --- a/src/main/config/controledMihomo.ts +++ b/src/main/config/controledMihomo.ts @@ -12,7 +12,7 @@ let controledMihomoConfig: Partial // mihomo.yaml export async function getControledMihomoConfig(force = false): Promise> { if (force || !controledMihomoConfig) { const data = await readFile(controledMihomoConfigPath(), 'utf-8') - controledMihomoConfig = yaml.parse(data) || defaultControledMihomoConfig + controledMihomoConfig = yaml.parse(data, { merge: true }) || defaultControledMihomoConfig } if (typeof controledMihomoConfig !== 'object') controledMihomoConfig = defaultControledMihomoConfig diff --git a/src/main/config/override.ts b/src/main/config/override.ts index f5a05ce..89f0595 100644 --- a/src/main/config/override.ts +++ b/src/main/config/override.ts @@ -10,7 +10,7 @@ let overrideConfig: IOverrideConfig // override.yaml export async function getOverrideConfig(force = false): Promise { if (force || !overrideConfig) { const data = await readFile(overrideConfigPath(), 'utf-8') - overrideConfig = yaml.parse(data) || { items: [] } + overrideConfig = yaml.parse(data, { merge: true }) || { items: [] } } if (typeof overrideConfig !== 'object') overrideConfig = { items: [] } return overrideConfig diff --git a/src/main/config/profile.ts b/src/main/config/profile.ts index a9f8e8a..f976370 100644 --- a/src/main/config/profile.ts +++ b/src/main/config/profile.ts @@ -14,7 +14,7 @@ let profileConfig: IProfileConfig // profile.yaml export async function getProfileConfig(force = false): Promise { if (force || !profileConfig) { const data = await readFile(profileConfigPath(), 'utf-8') - profileConfig = yaml.parse(data) || { items: [] } + profileConfig = yaml.parse(data, { merge: true }) || { items: [] } } if (typeof profileConfig !== 'object') profileConfig = { items: [] } return profileConfig @@ -169,7 +169,7 @@ export async function setProfileStr(id: string, content: string): Promise export async function getProfile(id: string | undefined): Promise { const profile = await getProfileStr(id) - let result = yaml.parse(profile) || {} + let result = yaml.parse(profile, { merge: true }) || {} if (typeof result !== 'object') result = {} return result } diff --git a/src/main/core/factory.ts b/src/main/core/factory.ts index d0fc5a2..a95fd61 100644 --- a/src/main/core/factory.ts +++ b/src/main/core/factory.ts @@ -44,7 +44,7 @@ async function overrideProfile( profile = runOverrideScript(profile, content, item) break case 'yaml': { - let patch = yaml.parse(content) || {} + let patch = yaml.parse(content, { merge: true }) || {} if (typeof patch !== 'object') patch = {} profile = deepMerge(profile, patch) break diff --git a/src/main/core/mihomoApi.ts b/src/main/core/mihomoApi.ts index 17ff21b..90315f5 100644 --- a/src/main/core/mihomoApi.ts +++ b/src/main/core/mihomoApi.ts @@ -83,7 +83,6 @@ export const mihomoGroups = async (): Promise => { const runtime = await getRuntimeConfig() const groups: IMihomoMixedGroup[] = [] runtime?.['proxy-groups']?.forEach((group: { name: string; url?: string }) => { - group = Object.assign(group, group['<<']) const { name, url } = group if (proxies.proxies[name] && 'all' in proxies.proxies[name] && !proxies.proxies[name].hidden) { const newGroup = proxies.proxies[name] diff --git a/src/main/resolve/autoUpdater.ts b/src/main/resolve/autoUpdater.ts index a929f94..dfcbb14 100644 --- a/src/main/resolve/autoUpdater.ts +++ b/src/main/resolve/autoUpdater.ts @@ -21,7 +21,7 @@ export async function checkUpdate(): Promise { } } ) - const latest = yaml.parse(res.data) as IAppVersion + const latest = yaml.parse(res.data, { merge: true }) as IAppVersion const currentVersion = app.getVersion() if (latest.version !== currentVersion) { return latest