feat: Introduce advanced TLS client with browser fingerprinting and new backend modules for API processing, authentication, mail, and ChatGPT registration.
This commit is contained in:
@@ -296,8 +296,27 @@ func (c *CodexAPIAuth) GetSessionID() string {
|
||||
return c.sessionID
|
||||
}
|
||||
|
||||
// ObtainAuthorizationCode 获取授权码
|
||||
// ObtainAuthorizationCode 获取授权码(全局 3 分钟超时)
|
||||
func (c *CodexAPIAuth) ObtainAuthorizationCode() (string, error) {
|
||||
type authResult struct {
|
||||
code string
|
||||
err error
|
||||
}
|
||||
resultCh := make(chan authResult, 1)
|
||||
go func() {
|
||||
code, err := c.obtainAuthorizationCodeInternal()
|
||||
resultCh <- authResult{code, err}
|
||||
}()
|
||||
select {
|
||||
case r := <-resultCh:
|
||||
return r.code, r.err
|
||||
case <-time.After(3 * time.Minute):
|
||||
return "", fmt.Errorf("授权超时 (3分钟)")
|
||||
}
|
||||
}
|
||||
|
||||
// obtainAuthorizationCodeInternal ObtainAuthorizationCode 的内部实现
|
||||
func (c *CodexAPIAuth) obtainAuthorizationCodeInternal() (string, error) {
|
||||
c.logStep(StepNavigate, "开始 Codex API 授权流程...")
|
||||
|
||||
// 选择使用固定 URL 还是 S2A 生成的 URL
|
||||
|
||||
Reference in New Issue
Block a user