mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-31 08:25:35 +00:00
Merge pull request #4269 from catoncat/agent/sub2api-agent-identity
feat(openai): support Codex Agent Identity authentication
This commit is contained in:
@@ -276,7 +276,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Codex OAuth/session JSON batch import -->
|
||||
<!-- Codex auth.json / session credential batch import -->
|
||||
<div v-if="inputMethod === 'codex_session'" class="space-y-4">
|
||||
<div
|
||||
class="rounded-lg border border-blue-300 bg-white/80 p-4 dark:border-blue-600 dark:bg-gray-800/80"
|
||||
|
||||
@@ -77,6 +77,7 @@ const { t } = useI18n()
|
||||
interface Props {
|
||||
platform: AccountPlatform
|
||||
type: AccountType
|
||||
authMode?: string
|
||||
planType?: string
|
||||
privacyMode?: string
|
||||
subscriptionExpiresAt?: string
|
||||
@@ -92,7 +93,15 @@ const platformLabel = computed(() => {
|
||||
return 'Gemini'
|
||||
})
|
||||
|
||||
const normalizedAuthMode = computed(() =>
|
||||
(props.authMode || '').trim().toLowerCase().replace(/[\s_-]+/g, '')
|
||||
)
|
||||
|
||||
const typeLabel = computed(() => {
|
||||
if (props.platform === 'openai' && props.type === 'oauth') {
|
||||
if (normalizedAuthMode.value === 'agentidentity') return 'Agent Identity'
|
||||
if (normalizedAuthMode.value === 'personalaccesstoken') return 'PAT'
|
||||
}
|
||||
switch (props.type) {
|
||||
case 'oauth':
|
||||
return 'OAuth'
|
||||
|
||||
@@ -62,3 +62,24 @@ describe('PlatformTypeBadge Grok plans', () => {
|
||||
expect(wrapper.findAll('path')).toHaveLength(2)
|
||||
})
|
||||
})
|
||||
|
||||
describe('PlatformTypeBadge OpenAI authentication modes', () => {
|
||||
it('distinguishes Agent Identity, PAT, and OAuth accounts', async () => {
|
||||
const wrapper = mount(PlatformTypeBadge, {
|
||||
props: {
|
||||
platform: 'openai',
|
||||
type: 'oauth',
|
||||
authMode: 'agentIdentity',
|
||||
},
|
||||
})
|
||||
|
||||
expect(wrapper.text()).toContain('Agent Identity')
|
||||
|
||||
await wrapper.setProps({ authMode: 'personalAccessToken' })
|
||||
expect(wrapper.text()).toContain('PAT')
|
||||
expect(wrapper.text()).not.toContain('Agent Identity')
|
||||
|
||||
await wrapper.setProps({ authMode: undefined })
|
||||
expect(wrapper.text()).toContain('OAuth')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user