From 08028f37ddb6d2c830ac0f649e8da9586318059d Mon Sep 17 00:00:00 2001 From: geekgeekrun Date: Sat, 12 Jul 2025 20:04:32 +0800 Subject: [PATCH] add fallback logic when find no JobSource enabled --- .../geek-auto-start-chat-with-boss/index.mjs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/packages/geek-auto-start-chat-with-boss/index.mjs b/packages/geek-auto-start-chat-with-boss/index.mjs index 2f799d6..a0aa7f0 100644 --- a/packages/geek-auto-start-chat-with-boss/index.mjs +++ b/packages/geek-auto-start-chat-with-boss/index.mjs @@ -155,18 +155,9 @@ if ( let { jobSourceList } = readConfigFile('boss.json') - -if (!jobSourceList?.length) { - jobSourceList = [ - { - type: "expect", - enabled: true - } - ] -} const normalizedJobSource = [] const addedSourceSet = new Set() -for (const source of jobSourceList) { +for (const source of (jobSourceList ?? [])) { if (addedSourceSet.has(source.type)) { continue } @@ -200,6 +191,11 @@ for (const source of jobSourceList) { addedSourceSet.add(source.type) } } +if (!normalizedJobSource?.length) { + normalizedJobSource.push({ + type: 'expect' + }) +} const localStoragePageUrl = `https://www.zhipin.com/desktop/` const recommendJobPageUrl = `https://www.zhipin.com/web/geek/jobs`