From 71aa72afb41e5eb6d5f25dc3ac163f7fbce7b8ef Mon Sep 17 00:00:00 2001 From: Toha Date: Tue, 11 Nov 2025 15:34:00 +0700 Subject: [PATCH] Fix merge polluting default config. Signed-off-by: Toha --- scripts/commands/epg/grab.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/scripts/commands/epg/grab.ts b/scripts/commands/epg/grab.ts index 9ef58dc05..3f951cdab 100644 --- a/scripts/commands/epg/grab.ts +++ b/scripts/commands/epg/grab.ts @@ -80,10 +80,10 @@ async function main() { const logger = new Logger({ level: options.debug ? LOG_LEVELS['debug'] : LOG_LEVELS['info'] }) logger.info('starting...') - let globalConfig: epgGrabber.Types.SiteConfig = {} + const globalConfig: epgGrabber.Types.SiteConfig = {} if (typeof options.timeout === 'number') - globalConfig = merge(globalConfig, { request: { timeout: options.timeout } }) + merge(globalConfig, { request: { timeout: options.timeout } }) if (options.proxy !== undefined) { const proxy = parseProxy(options.proxy) if ( @@ -91,11 +91,11 @@ async function main() { ['socks', 'socks5', 'socks5h', 'socks4', 'socks4a'].includes(String(proxy.protocol)) ) { const socksProxyAgent = new SocksProxyAgent(options.proxy) - globalConfig = merge(globalConfig, { + merge(globalConfig, { request: { httpAgent: socksProxyAgent, httpsAgent: socksProxyAgent } }) } else { - globalConfig = merge(globalConfig, { request: { proxy } }) + merge(globalConfig, { request: { proxy } }) } } @@ -194,8 +194,7 @@ async function main() { channel.index = index++ if (!channel.site || !channel.site_id || !channel.name) continue - let config = await loadJs(channel.getConfigPath()) - config = merge(defaultConfig, config) + const config = merge({}, defaultConfig, await loadJs(channel.getConfigPath())) if (!channel.xmltv_id) channel.xmltv_id = channel.site_id