mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-10-26 01:34:51 +08:00
A Codex provider link could carry a full config.toml, but import only pulled the key, endpoint and model out of it and rebuilt a fixed template, silently dropping the provider's auth mode, headers, websocket support and model catalog URL. When a link carries a config, keep the parts that belong to the provider, using the same field lists the live projection writes on switch: - from the selected [model_providers.*] table: connection and auth fields (wire_api, requires_openai_auth, http_headers, query_params, supports_websockets, retries/timeouts, capabilities, ...); the route is always renamed to `custom` - model_catalog_url only on the same origin as the endpoint, since Codex sends the provider's credentials when fetching it - top-level key and provider-exclusive fields (model, reasoning effort, web_search, context window, subagent model) Global settings ([features], [tools], MCP, approval_policy, notify, local file paths) are not imported. Links whose provider table makes Codex run a command or read local credentials (auth, aws, gateway_oauth, env_http_headers) are rejected; env_key is dropped in favor of the link's own key, and an env_key-only link is rejected. URL params still take priority, and a table's bearer token is reset to the final key. Links without a config keep the old template byte for byte; a new golden snapshot locks the shape of config-carrying imports. The confirm dialog notes that only provider settings are imported, and the manual documents the rules (and that configUrl is rejected). Refs #7438, #7942, #5510