refactor(oauth): derive auth-code providers from OAUTH_FLOW_TYPES (DRY)

- Update checkAuthCodePorts() to filter from CLIPROXY_PROFILES

- Update header comment to list all OAuth ports including Claude

- Addresses PR #384 review round 3
This commit is contained in:
kaitranntt
2026-01-27 22:25:31 -05:00
parent 5c62e06d02
commit c713d48d08
+6 -1
View File
@@ -8,7 +8,11 @@
* - Gemini: 8085
* - Codex: 1455
* - Agy: 51121
* - iFlow: 11451
* - Kiro: 9876
* - Claude: 54545
* - Qwen: Device Code Flow (no port needed)
* - GHCP: Device Code Flow (no port needed)
*/
import {
@@ -156,7 +160,8 @@ export async function checkAllOAuthPorts(): Promise<OAuthPortDiagnostic[]> {
* Check OAuth ports for providers that use Authorization Code flow only
*/
export async function checkAuthCodePorts(): Promise<OAuthPortDiagnostic[]> {
const providers: CLIProxyProvider[] = ['gemini', 'codex', 'agy', 'iflow', 'kiro', 'claude'];
// Filter providers that use authorization_code flow (DRY: derive from OAUTH_FLOW_TYPES)
const providers = CLIPROXY_PROFILES.filter((p) => OAUTH_FLOW_TYPES[p] === 'authorization_code');
const results: OAuthPortDiagnostic[] = [];
for (const provider of providers) {