Skip to content

refactor: update User-Agent and architecture in headers, enhance fingerprint handling in account test service#1328

Open
b2r66sun wants to merge 9 commits intoWei-Shaw:mainfrom
b2r66sun:main
Open

refactor: update User-Agent and architecture in headers, enhance fingerprint handling in account test service#1328
b2r66sun wants to merge 9 commits intoWei-Shaw:mainfrom
b2r66sun:main

Conversation

@b2r66sun
Copy link
Copy Markdown

  • Updated User-Agent to "claude-cli/2.1.84" and architecture to "x64" in constants.
  • Enhanced fingerprint handling in the AccountTestService to utilize user agent from the fingerprint if available.
  • Added tests to ensure correct payload creation with updated headers and fingerprint data.
  • Adjusted session string generation to accept user agent as a parameter for consistency.

…erprint handling in account test service

- Updated User-Agent to "claude-cli/2.1.84" and architecture to "x64" in constants.
- Enhanced fingerprint handling in the AccountTestService to utilize user agent from the fingerprint if available.
- Added tests to ensure correct payload creation with updated headers and fingerprint data.
- Adjusted session string generation to accept user agent as a parameter for consistency.
- Added `github.com/google/subcommands v1.2.0` and `golang.org/x/tools v0.41.0` to `go.mod`.
- Updated `go.sum` to reflect new dependencies.
- Refactored service initialization in `wire_gen.go` to improve clarity and organization, including the addition of new services like `NewSoraGenerationService` and `NewSoraQuotaService`.
- Removed unused variables and streamlined handler registrations in `wire.go` files.
- Updated the OAuth client to use separate factories for browser and token clients.
- Introduced new request headers for browser authorization and token requests to ensure proper handling.
- Improved test coverage by capturing and validating headers in OAuth service tests.
- Refactored header setting in usage service to maintain wire casing for HTTP requests.ols/
…onization

- Introduced the X-Claude-Code-Session-Id header to the allowed headers list.
- Implemented synchronization of the X-Claude-Code-Session-Id header with the session_id from metadata.user_id in both buildUpstreamRequest and buildCountTokensRequest functions.
- Ensured consistent handling of session_id when masking is enabled or disabled.
- Removed content-type header for GET requests to align with CLI behavior.
- Added new headers: anthropic-dangerous-direct-browser-access and x-app for improved request handling.
- Ensured request headers maintain wire casing for consistency.
…ieval

- Added a new endpoint to retrieve the identity fingerprint for an account.
- Updated the AccountHandler to include identityCache for managing identity fingerprints.
- Modified related tests to accommodate the new identity fingerprint functionality.
- Ensured consistent handling of headers and request structure in the updated routes.
…efaults

- Enhanced the newOrderedH2Transport function to include HTTP/2 SETTINGS configuration.
- Set HeaderTableSize, InitialWindowSize, and other settings to align with nghttp2 client defaults.
- Updated SETTINGS frame field order for consistency with nghttp2 specifications.
- Maintained existing ReadIdleTimeout and PingTimeout settings.
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