Files
cindy/apps/mobile/scripts/lib/device-link-base.mjs
Lizi bb3f71d084 chore: Cindy 首次开源提交 / initial open-source release
Cindy 是心动网络 (X.D. Network Inc.) 的跨端 AI Agent 客户端。
本次提交包含 Desktop(Electron)、Mobile(Expo)及全部共享 packages
的完整源码,以 Apache-2.0 协议开源。

This is the first public release of Cindy, X.D. Network's cross-platform
AI agent client: the Electron desktop app, the Expo mobile app, and all
shared workspace packages, licensed under Apache-2.0.

- 许可与合规:根 LICENSE(Apache-2.0)+ NOTICE;第三方组件归属声明与
  SPDX SBOM 收口在 docs/legal/notices/,由 pnpm licenses:generate 生成。
- 社区文件:README / CONTRIBUTING / CODE_OF_CONDUCT / SECURITY / SUPPORT
  中英双语;issue / PR 模板与 CI workflow 在 .github/。
- 协议层以公开 submodule 引入:github.com/makecindy/cindy-protocol。
- 提交前已通过仓库门禁:全量 pnpm test:unit 与涉及 package 的 typecheck。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-24 08:30:44 +08:00

24 lines
858 B
JavaScript

/**
* device-link-base.mjs — 冒烟 / mock 脚本共享的 device-link API base 推导
* (原先 6 个脚本各持一份逐字节相同的副本,2026-07 端点收敛时抽到这里)。
* 只剩本地 e2e 语义:mock host 3333 → relay 3335 的端口替换。原"生产 API 域名
* → relay 域名"的 hostname 替换分支已随 apiBaseUrl(老主 server)2026-07-18
* 退役删除——生产域名不再存在,该分支永远走不到。
*/
/** 从本地 mock API base 推导 device-link relay base:3333 → 3335,其余原样返回。 */
export function deriveDeviceLinkApiBase(baseUrl) {
let url;
try {
url = new URL(baseUrl);
} catch {
// Keep the historical single-base behavior for unusual test URLs.
return baseUrl;
}
if (url.port === '3333') {
url.port = '3335';
return url.toString();
}
return baseUrl;
}