Commit Graph

337 Commits

  • - merge: merge origin/main, resolve conflicts and preserve both feature sets
    - feat(tauri): register import/export and file dialogs; keep endpoint speed test and custom endpoints
    - feat(api): add updateTrayMenu and onProviderSwitched; wire import/export APIs
    - feat(types): extend global API declarations (import/export)
    - chore(presets): GLM preset supports both new and legacy model keys
    - chore(rust): add chrono dependency; refresh lockfile
  • refactor: improve endpoint management button UX
    Replace ambiguous "Advanced" text with intuitive "Manage & Test" label accompanied by Zap icon, making the endpoint management panel entry point more discoverable and self-explanatory for both Claude and Codex configurations.
  • feat: add endpoint candidates support and code formatting improvements
    - Add endpointCandidates field to ProviderPreset and CodexProviderPreset interfaces
    - Integrate preset endpoint candidates into speed test endpoint selection
    - Add multiple endpoint options for PackyCode providers (Claude & Codex)
    - Apply consistent code formatting (trailing commas, line breaks)
    - Improve template value type safety and readability
  • - feat(types): add Provider.meta and ProviderMeta (snake_case) with custom_endpoints map
    - feat(provider-form): persist custom endpoints on provider create by merging EndpointSpeedTest’s custom URLs into meta.custom_endpoints on submit
    
    - feat(endpoint-speed-test): add onCustomEndpointsChange callback emitting normalized custom URLs; wire it for both Claude/Codex modals
    
    - fix(api): send alias param names (app/appType/app_type and provider_id/providerId) in Tauri invokes to avoid “missing providerId” with older backends
    
    - storage: custom endpoints are stored in ~/.cc-switch/config.json under providers[<id>].meta.custom_endpoints (not in settings.json)
    
    - behavior: edit flow remains immediate writes; create flow now writes once via addProvider, removing the providerId dependency during creation
  • feat: persist custom endpoints to settings.json
    - Extend AppSettings to store custom endpoints for Claude and Codex
    - Add Tauri commands: get/add/remove/update custom endpoints
    - Update frontend API with endpoint persistence methods
    - Modify EndpointSpeedTest to load/save custom endpoints via API
    - Track endpoint last used time for future sorting/cleanup
    - Store endpoints per app type in settings.json instead of localStorage
  • refactor: improve endpoint list UI consistency
    - Show delete button for all endpoints on hover for uniform UI
    - Change selected state to use blue theme matching main interface:
      * Blue border (border-blue-500) for selected items
      * Light blue background (bg-blue-50/dark:bg-blue-900/20)
      * Blue indicator dot (bg-blue-500/dark:bg-blue-400)
    - Switch from compact list (space-y-px) to card-based layout (space-y-2)
    - Add rounded corners to each endpoint item for better visual separation
  • refactor: unify speed test panel UI with project design system
    UI improvements:
    - Update modal border radius from rounded-lg to rounded-xl
    - Unify header padding from px-6 py-4 to p-6
    - Change speed test button color to blue theme (bg-blue-500) for consistency
    - Update footer background from bg-gray-50 to bg-gray-100
    - Style "Done" button as primary action button with blue theme
    - Adjust footer button spacing and hover states
    
    Simplify endpoint display:
    - Remove endpoint labels (e.g., "Current Address", "Custom 1")
    - Display only URL for cleaner interface
    - Clean up all label-related logic:
      * Remove label field from EndpointCandidate interface
      * Remove label generation in buildInitialEntries function
      * Remove label handling in useEffect merge logic
      * Remove label generation in handleAddEndpoint
      * Remove label parameters from claudeSpeedTestEndpoints
      * Remove label parameters from codexSpeedTestEndpoints
  • fix: prevent modal cascade closing when ESC is pressed
    - Add state checks to prevent parent modal from closing when child modals (endpoint speed test or template wizard) are open
    - Update ESC key handler dependencies to track all modal states
    - Ensures only the topmost modal responds to ESC key
  • refactor: convert endpoint speed test to modal dialog
    - Transform EndpointSpeedTest component into a modal dialog
    - Add "Advanced" button next to base URL input to open modal
    - Support ESC key and backdrop click to close modal
    - Apply Linear design principles: minimal styling, clean layout
    - Remove unused showBaseUrlInput variable
    - Implement same modal pattern for both Claude and Codex
  • feat: add unified endpoint speed test for API providers
    Add a comprehensive endpoint latency testing system that allows users to:
    - Test multiple API endpoints concurrently
    - Auto-select the fastest endpoint based on latency
    - Add/remove custom endpoints dynamically
    - View latency results with color-coded indicators
    
    Backend (Rust):
    - Implement parallel HTTP HEAD requests with configurable timeout
    - Handle various error scenarios (timeout, connection failure, invalid URL)
    - Return structured latency data with status codes
    
    Frontend (React):
    - Create interactive speed test UI component with auto-sort by latency
    - Support endpoint management (add/remove custom endpoints)
    - Extract and update Codex base_url from TOML configuration
    - Integrate with provider presets for default endpoint candidates
    
    This feature improves user experience when selecting optimal API endpoints,
    especially useful for users with multiple provider options or proxy setups.
  • chore: bump version to 3.4.0
    - Add i18next internationalization with Chinese/English support
    - Add Claude plugin sync alongside VS Code integration
    - Extend provider presets with new models (DeepSeek-V3.2-Exp, Qwen3-Max, GLM-4.6)
    - Support portable mode and single instance enforcement
    - Add tray minimize and macOS Dock visibility management
    - Improve Settings UI with scrollable layout and save icon
    - Fix layout shifts and provider toggle consistency
    - Remove unnecessary OpenAI auth requirement
    - Update Windows MSI installer to target per-user LocalAppData
  • fix: eliminate layout shift when switching app types with Claude plugin sync
    - Separate sync button containers for Codex and Claude modes
    - Only render the container in corresponding app type to prevent layout jumping
    - Apply same fix pattern as commit 0bcc04a for VS Code sync button
  • feat: add optional apiKeyUrl field to provider presets
    Allow third-party providers to specify a dedicated API key URL separate from the main website URL for easier key acquisition.
  • Update AI model versions in provider presets
    - Update DeepSeek model from V3.1-Terminus to V3.2-Exp
    - Update ModelScope model from GLM-4.5 to GLM-4.6
  • feat: add macOS Dock visibility management for tray mode
    - Hide Dock icon when minimizing to tray
    - Show Dock icon when restoring window from tray
    - Apply appropriate activation policy (Accessory/Regular) based on window state
    - Add error handling with logging for Dock operations
  • fix: eliminate layout shift when switching between Claude and Codex
    - Wrap VS Code sync button in fixed-width container to maintain stable layout
    - Only render the container in Codex mode to avoid unnecessary space in Claude mode
    - Change card transition from 'all' to specific properties (border-color, box-shadow) to prevent layout animations
    - These changes prevent the horizontal position jumping of provider cards during app switching
  • feat: integrate language switcher into settings with modern segment control UI
    - Move language switcher from header to settings modal for better organization
    - Implement modern segment control UI instead of radio buttons for language selection
    - Add language preference persistence in localStorage and backend settings
    - Support instant language preview with cancel/revert functionality
    - Remove standalone LanguageSwitcher component
    - Improve initial language detection logic (localStorage -> browser -> default)
    - Add proper i18n keys for language settings UI text
  • feat: integrate i18next for internationalization support (#65)
    * feat: integrate i18next for internationalization support
    
    - Added i18next and react-i18next dependencies for localization.
    - Updated various components to utilize translation functions for user-facing text.
    - Enhanced user experience by providing multilingual support across the application.
    
    * feat: improve i18n implementation with better translations and accessibility
    
    - Add proper i18n keys for language switcher tooltips and aria-labels
    - Replace hardcoded Chinese console error messages with i18n keys
    - Add missing translation keys for new UI elements
    - Improve accessibility with proper aria-label attributes
    
    ---------
    
    Co-authored-by: Jason <farion1231@gmail.com>
  • fix: remove unnecessary openai auth requirement from third-party config
    Remove the env_key and requires_openai_auth fields from third-party provider config generation as they are not needed for custom API endpoints.
  • feat: improve SettingsModal UX with scrolling and save icon
    - Add scrollable content area with max height constraint
    - Add Save icon to save button for better visual clarity
  • feat: support minimizing window to tray on close (#41)
    fix: grant set_skip_taskbar permission through default capability
    
    chore: align settings casing and defaults between Rust and frontend
    
    Co-authored-by: Jason <farion1231@gmail.com>
  • refactor: consolidate chatgpt.config cleanup logic
    Merged duplicate try-catch blocks that handle invalid chatgpt.config values.
    Now handles all edge cases (scalar values, arrays, empty objects) in a single
    unified check, reducing code duplication and improving performance by parsing
    JSON only once.
  • refactor: reorganize documentation structure
    - Remove docs/ from .gitignore to track documentation files
    - Delete completed plan documents (encrypted-config-plan.md, updater-plan.md)
    - Add roadmap.md with project milestones and future features
  • feat: add portable mode support and improve update handling
    - Add portable.ini marker file creation in GitHub Actions for portable builds
    - Implement is_portable_mode() command to detect portable execution
    - Redirect portable users to GitHub releases page for manual updates
    - Change update URL to point to latest releases page
    - Integrate portable mode detection in Settings UI
  • fix: improve per-user MSI installer component tracking
    - Change File KeyPath to "no" and use registry value as KeyPath instead
    - Add registry entry for better component state tracking
    - Enhance uninstall cleanup to remove LocalAppData files and folders
  • feat: add single instance plugin to prevent multiple app instances
    Integrates tauri_plugin_single_instance to ensure only one instance of the application
    runs at a time. When attempting to launch a second instance, it will focus the existing
    window instead.
  • release: bump version to v3.3.1
    Add support for DeepSeek-V3.1-Terminus model with emergency hotfix release
  • release: bump version to 3.3.0
    Update version across all package files and add comprehensive changelog for v3.3.0 release featuring VS Code integration, shared config snippets, enhanced Codex wizard, and cross-platform improvements.
  • fix: stabilize provider action button width and improve visual consistency
    - Set fixed width (76px) for enable/active buttons to prevent layout shift
    - Hide play icon in active state to optimize space usage
    - Add center alignment and nowrap to ensure consistent appearance
  • refactor: optimize React state updates and improve UI text clarity
    - Use functional setState to ensure proper state updates in ProviderForm
    - Improve Chinese UI text consistency in CodexConfigEditor:
      - Change "API 基础地址" to "API 请求地址" for clarity
      - Simplify "供应商官网" to "官网地址"
      - Update placeholder text for consistency
    - Move requires_openai_auth to model_providers section in Codex config template
  • fix: correct HTML pattern attribute regex escape in Codex config wizard
    Fixed validation pattern in provider name input field by removing incorrect double backslash escape (\S to \S) to properly validate non-whitespace input
  • refactor: update VSCode apply button style to match Linear design theme
    - Changed from solid emerald button to bordered style for better visual hierarchy
    - Apply action: gray border, blue on hover (consistent with theme color)
    - Remove action: gray border, red on hover (indicates destructive action)
    - Better distinction between apply/remove states while maintaining Linear's minimalist aesthetic
  • feat: add created_at timestamp field to Provider struct
    - Add optional created_at field to track provider creation time
    - Serialize field as camelCase (createdAt) for JSON compatibility
    - Skip serialization when field is None to maintain backward compatibility
  • feat: add dedicated API key URL support for third-party providers
    - Add optional apiKeyUrl field to ProviderPreset interface for third-party providers
    - Update ProviderForm to prioritize apiKeyUrl over websiteUrl for third-party category
    - Make provider display name required in CodexConfigEditor with validation
    - Configure PackyCode preset with affiliate API key URL
    
    This allows third-party providers to have separate URLs for their service homepage
    and API key acquisition, improving user experience when obtaining API keys.
  • feat: enhance Codex provider configuration wizard with display name field
    - Add separate display name field for provider (supports Chinese)
    - Keep provider code field for internal identifier (English only)
    - Add onNameChange callback to update provider name from wizard
    - Improve code formatting consistency in ProviderForm
  • refactor: improve form validation in CodexConfigEditor using HTML5 validation API
    - Replace custom error state with native HTML5 form validation
    - Add useRef hooks for input field validation management
    - Add pattern attributes to enforce non-empty input validation
    - Leverage browser's built-in validation UI for better UX
    - Extract closeTemplateModal function for consistent modal closing
  • feat: add configuration wizard for custom Codex providers
    - Add quick configuration wizard modal for custom providers
    - Generate auth.json and config.toml from simple inputs (API key, base URL, model name)
    - Extract generation logic into reusable functions (generateThirdPartyAuth, generateThirdPartyConfig)
    - Pre-populate custom template when selecting custom option
    - Add wizard button link in PresetSelector for custom mode
    - Update PackyCode preset to use the new generation functions
  • fix: prevent text wrapping in VSCode apply button on Windows
    Add whitespace-nowrap class to ensure button text stays on single line
    across different font rendering systems
  • Merge pull request #44 from farion1231/feature/wsl-support
    feat: improve WSL config directory support