Skip to content

设置:接口地址去斜杠和取 origin 只在 settings.js 写一份 - #435

Merged
PathGao merged 1 commit into
mainfrom
refactor/ai-provider-url
Oct 27, 2026
Merged

PathGao merged 1 commit into
mainfrom
refactor/ai-provider-url

Conversation

@PathGao

@PathGao PathGao commented Oct 27, 2026

Copy link
Copy Markdown
Owner

改了什么

设置页和后台各有一份一样的「接口地址去空格和结尾斜杠」(normalizeBaseUrl / trimBaseUrl)和「取 origin」(urlOrigin / dropMovedKeys 里的 origin),合到 MdgSettings.trimBaseUrl 和 MdgSettings.urlOrigin。两边原本都加载 settings.js,行为不变。

必填项检查没合并:设置页和后台的检查顺序不同,设置页还把已保存的 Key 算作已填,合并会改变用户先看到哪条报错。

验证

  • node scripts/selftest.mjs:39 个通过。settings.selftest.js 加了结尾斜杠、空格、空值、非法地址的用例。
  • 把 urlOrigin 改成恒返回空、去掉去斜杠,options.selftest.js 和 background.selftest.js 的现有测试失败。

设置页和后台各有一份相同的 trimBaseUrl / urlOrigin,合到 MdgSettings。
@PathGao
PathGao merged commit c4f1a3f into main Oct 27, 2026
2 checks passed
@PathGao
PathGao deleted the refactor/ai-provider-url branch October 27, 2026 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant