mirror of
https://github.com/paoloanzn/free-code.git
synced 2026-10-19 01:30:18 -05:00
Merge pull request #11 from paoloanzn/fix/codex-provider-sticking
fix: remove duplicate isCodexSubscriber causing provider lock-in
This commit is contained in:
1 file changed
+4
-18
+4
-18
@@ -1627,26 +1627,12 @@ export function isClaudeAISubscriber(): boolean {
|
||||
}
|
||||
|
||||
export function isCodexSubscriber(): boolean {
|
||||
// Check if we're using OpenAI API via environment variable
|
||||
if (getAPIProvider() === 'openai') {
|
||||
return true
|
||||
// Only treat as Codex subscriber when explicitly using OpenAI provider
|
||||
if (getAPIProvider() !== 'openai') {
|
||||
return false
|
||||
}
|
||||
|
||||
// Check if we have OpenAI OAuth tokens
|
||||
const config = getGlobalConfig()
|
||||
const openaiTokens = config?.openaiOauthTokens
|
||||
if (openaiTokens?.access_token && openaiTokens?.scopes?.includes('codex')) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the user is authenticated via OpenAI Codex OAuth.
|
||||
* Returns true when a valid Codex access token is present in the config.
|
||||
*/
|
||||
export function isCodexSubscriber(): boolean {
|
||||
// Verify we actually have valid Codex tokens
|
||||
const tokens = getCodexOAuthTokens()
|
||||
return !!tokens?.accessToken
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user