Skip to content

Commit

Permalink
Merge pull request #1551 from terwer/dev
Browse files Browse the repository at this point in the history
fix: halo config change not work
  • Loading branch information
terwer authored Dec 21, 2024
2 parents 6275d29 + 3ba3ae3 commit 5dc1520
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/adaptors/web/haloweb/useHalowebWeb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,20 @@ const useHalowebWeb = async (key?: string, newCfg?: HalowebConfig) => {
const dynCfg = getHaloDynCfg(setting)
cfg = JsonUtil.safeParse<HalowebConfig>(setting[key], {} as HalowebConfig)
// 如果配置为空,则使用默认的环境变量值,并记录日志
const url = new URL(dynCfg.authUrl)
if (ObjectUtil.isEmptyObject(cfg)) {
// 从环境变量获取Csdn的cookie
const middlewareUrl = Utils.emptyOrDefault(process.env.VITE_MIDDLEWARE_URL, LEGENCY_SHARED_PROXT_MIDDLEWARE)
const url = new URL(dynCfg.authUrl)
cfg = new HalowebConfig(url.origin, middlewareUrl)
cfg.picbedService = PicbedServiceTypeEnum.Bundled
logger.debug("Configuration is empty, using default environment variables.")
} else {
if (url.origin !== cfg.home || url.origin !== cfg.apiUrl) {
// 说明已经改变了
cfg.home = url.origin
cfg.apiUrl = url.origin
logger.info("authUrl has changed, update cfg.home and cfg.apiUrl")
}
logger.info("Using configuration from settings...")
}
// 下面是强制设置的配置
Expand Down

0 comments on commit 5dc1520

Please sign in to comment.