Skip to content

Commit

Permalink
updated at 2023-10-17 20:08 by mc git-up
Browse files Browse the repository at this point in the history
  • Loading branch information
magicdawn committed Oct 17, 2023
1 parent c6d1078 commit a982983
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions packages/ui/src/util/gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,30 @@ export default async function genConfig({ forceUpdate = false }: { forceUpdate?:
})
}

/* #region build proxies */
if (!Array.isArray(config.proxies)) config.proxies = []
if (!Array.isArray(config['proxy-groups'])) config['proxy-groups'] = []

// batch update subscribe
await pmap(
subscribeItems,
(item) =>
rootActions.librarySubscribe.update({
url: item.url,
silent: true,
forceUpdate,
}),
5
)

for (const item of subscribeItems) {
const { url } = item
const servers = rootState.librarySubscribe.detail[url] || []
config.proxies = config.proxies.concat(servers)
}
/* #endregion */

/* #region build rules */
// 批量更新远程规则
const remoteRuleItems = ruleItems.filter((item) => item.type === 'remote')
await pmap(
Expand All @@ -116,28 +140,6 @@ export default async function genConfig({ forceUpdate = false }: { forceUpdate?:
continue
}
}

/* #region subscribe */
if (!Array.isArray(config.proxies)) config.proxies = []
if (!Array.isArray(config['proxy-groups'])) config['proxy-groups'] = []

// batch update subscribe
await pmap(
subscribeItems,
(item) =>
rootActions.librarySubscribe.update({
url: item.url,
silent: true,
forceUpdate,
}),
5
)

for (const item of subscribeItems) {
const { url } = item
const servers = rootState.librarySubscribe.detail[url] || []
config.proxies = config.proxies.concat(servers)
}
/* #endregion */

/* #region proxy-groups */
Expand Down

0 comments on commit a982983

Please sign in to comment.