Commit Graph

11 Commits

  • refactor(auth): replace TokenRecord with coreauth.Auth and migrate TokenStore to coreauth.Store
    - Replaced `TokenRecord` with `coreauth.Auth` for centralized and consistent authentication data structures.
    - Migrated `TokenStore` interface to `coreauth.Store` for alignment with core CLIProxy authentication.
    - Updated related login methods, token persistence logic, and file storage handling to use the new `coreauth.Auth` model.
  • feat(logging): introduce centralized logging with custom format and Gin integration
    - Implemented a global logger with structured formatting for consistent log output.
    - Added support for rotating log files using Lumberjack.
    - Integrated new logging functionality with Gin HTTP server for unified log handling.
    - Replaced direct `log.Info` calls with `fmt.Printf` in non-critical paths to simplify core functionality.
  • refactor(auth): replace FileStore with FileTokenStore for unified token persistence
    - Removed `FileStore` in favor of the new `FileTokenStore`.
    - Centralized auth JSON handling and token operations through `FileTokenStore`.
    - Updated all components to utilize `FileTokenStore` for consistent storage operations.
    - Introduced `SetBaseDir` and directory locking mechanisms for flexible configurations.
    - Enhanced metadata management, including path resolution and deep JSON comparisons.
  • feat(auth): centralize token store management and enhance persistence
    - Introduced `RegisterTokenStore` and `GetTokenStore` to centralize token store access.
    - Replaced direct file operations with a unified token persistence API.
    - Updated all components to use the shared token store for consistent behavior.
    - Improved logging for token save operations to include file paths.
  • refactor(gemini-web): Remove auto-refresh, auto-close, and caching
    This commit simplifies the Gemini web client by removing several complex, stateful features. The previous implementation for auto-refreshing cookies and auto-closing the client involved background goroutines, timers, and file system caching, which made the client's lifecycle difficult to manage.
    
    The following features have been removed:
    - The cookie auto-refresh mechanism, including the background goroutine (`rotateCookies`) and related configuration fields.
    - The file-based caching for the `__Secure-1PSIDTS` token. The `rotate1PSIDTS` function now fetches a new token on every call.
    - The auto-close functionality, which used timers to close the client after a period of inactivity.
    - Associated configuration options and methods (`WithAccountLabel`, `WithOnCookiesRefreshed`, `Close`, etc.).
    
    By removing this logic, the client becomes more stateless and predictable. The responsibility for managing the client's lifecycle and handling token expiration is now shifted to the caller, leading to a simpler and more robust integration.
  • refactor(auth): remove unused Refresh methods from authenticators
    - Deleted `Refresh` implementations in Codex, Claude, Gemini, Qwen, and Gemini-web authenticators.
    - Updated the `Authenticator` interface to exclude `Refresh` for cleaner design.
    - Revised `Manager` and related components to handle refresh logic improvements.
    - Simplified token refresh behavior and eliminated redundant code paths.