mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-27 13:10:30 +08:00
16 lines
635 B
TypeScript
16 lines
635 B
TypeScript
import { getControledMihomoConfig, getCurrentProfile } from '../config'
|
|
import { mihomoWorkConfigPath } from '../utils/dirs'
|
|
import yaml from 'yaml'
|
|
import fs from 'fs'
|
|
|
|
export function generateProfile(): void {
|
|
const currentProfile = getCurrentProfile()
|
|
const controledMihomoConfig = getControledMihomoConfig()
|
|
const { tun: profileTun = {} } = currentProfile
|
|
const { tun: controledTun } = controledMihomoConfig
|
|
const tun = Object.assign(profileTun, controledTun)
|
|
const profile = Object.assign(currentProfile, controledMihomoConfig)
|
|
profile.tun = tun
|
|
fs.writeFileSync(mihomoWorkConfigPath(), yaml.stringify(profile))
|
|
}
|