mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-03 13:00:52 +08:00
- 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.
30 lines
946 B
Go
30 lines
946 B
Go
package auth
|
|
|
|
import (
|
|
"time"
|
|
|
|
cliproxyauth "github.com/router-for-me/CLIProxyAPI/v6/sdk/cliproxy/auth"
|
|
)
|
|
|
|
func init() {
|
|
registerRefreshLead("codex", func() Authenticator { return NewCodexAuthenticator() })
|
|
registerRefreshLead("claude", func() Authenticator { return NewClaudeAuthenticator() })
|
|
registerRefreshLead("qwen", func() Authenticator { return NewQwenAuthenticator() })
|
|
registerRefreshLead("gemini", func() Authenticator { return NewGeminiAuthenticator() })
|
|
registerRefreshLead("gemini-cli", func() Authenticator { return NewGeminiAuthenticator() })
|
|
registerRefreshLead("gemini-web", func() Authenticator { return NewGeminiWebAuthenticator() })
|
|
}
|
|
|
|
func registerRefreshLead(provider string, factory func() Authenticator) {
|
|
cliproxyauth.RegisterRefreshLeadProvider(provider, func() *time.Duration {
|
|
if factory == nil {
|
|
return nil
|
|
}
|
|
auth := factory()
|
|
if auth == nil {
|
|
return nil
|
|
}
|
|
return auth.RefreshLead()
|
|
})
|
|
}
|