mirror of
https://github.com/freecodexyz/free-code.git
synced 2026-10-19 01:31:25 -05:00
fix: improve OpenAI Codex authentication detection and UI updating
- Add openaiOauthTokens field to GlobalConfig for storing OAuth tokens - Update isCodexSubscriber to check both env vars and OAuth token state - Ensure UI components update automatically after OpenAI OAuth without restart - Fix model menu and header to reflect Codex subscription status dynamically 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
c3e5419121
commit
457de17f9c
2 files changed
+19
-6
No files matched your search
+11
-6
@@ -1627,14 +1627,19 @@ export function isClaudeAISubscriber(): boolean {
|
||||
}
|
||||
|
||||
export function isCodexSubscriber(): boolean {
|
||||
// Check if we're using OpenAI API
|
||||
if (getAPIProvider() !== 'openai') {
|
||||
return false
|
||||
// Check if we're using OpenAI API via environment variable
|
||||
if (getAPIProvider() === 'openai') {
|
||||
return true
|
||||
}
|
||||
|
||||
// For now, return true if OpenAI provider is configured
|
||||
// This can be extended to check for specific token scopes when available
|
||||
return true
|
||||
// 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
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -587,6 +587,14 @@ export type GlobalConfig = {
|
||||
// CURRENT_MIGRATION_VERSION, runMigrations() skips all sync migrations
|
||||
// (avoiding 11× saveGlobalConfig lock+re-read on every startup).
|
||||
migrationVersion?: number
|
||||
|
||||
// OpenAI OAuth tokens for Codex API access
|
||||
openaiOauthTokens?: {
|
||||
access_token: string
|
||||
refresh_token?: string
|
||||
scopes?: string[]
|
||||
expires_at?: number
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user