mirror of
https://github.com/router-for-me/Cli-Proxy-API-Management-Center.git
synced 2026-02-19 11:10:49 +08:00
feat: update OAuth card visibility logic to retain iFlow card for Cookie login functionality and enhance comments for clarity
This commit is contained in:
26
app.js
26
app.js
@@ -235,7 +235,7 @@ class CLIProxyManager {
|
|||||||
const isLocalhost = hostname === 'localhost' || hostname === '127.0.0.1' || hostname === '::1';
|
const isLocalhost = hostname === 'localhost' || hostname === '127.0.0.1' || hostname === '::1';
|
||||||
|
|
||||||
if (!isLocalhost) {
|
if (!isLocalhost) {
|
||||||
// 隐藏所有 OAuth 登录卡片
|
// 隐藏所有 OAuth 登录卡片(除了iFlow,因为它有Cookie登录功能可远程使用)
|
||||||
OAUTH_CARD_IDS.forEach(cardId => {
|
OAUTH_CARD_IDS.forEach(cardId => {
|
||||||
const card = document.getElementById(cardId);
|
const card = document.getElementById(cardId);
|
||||||
if (card) {
|
if (card) {
|
||||||
@@ -243,21 +243,39 @@ class CLIProxyManager {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 对于 iFlow card,只隐藏 OAuth 部分,保留 Cookie 登录部分
|
||||||
|
const iflowCard = document.getElementById('iflow-oauth-card');
|
||||||
|
if (iflowCard) {
|
||||||
|
// 隐藏 OAuth 部分
|
||||||
|
const oauthContent = document.getElementById('iflow-oauth-content');
|
||||||
|
const oauthButton = iflowCard.querySelector('button[onclick*="startIflowOAuth"]');
|
||||||
|
const oauthStatus = document.getElementById('iflow-oauth-status');
|
||||||
|
const oauthUrlGroup = iflowCard.querySelector('.form-group:has(#iflow-oauth-url)');
|
||||||
|
|
||||||
|
if (oauthContent) oauthContent.style.display = 'none';
|
||||||
|
if (oauthButton) oauthButton.style.display = 'none';
|
||||||
|
if (oauthStatus) oauthStatus.style.display = 'none';
|
||||||
|
if (oauthUrlGroup) oauthUrlGroup.style.display = 'none';
|
||||||
|
|
||||||
|
// 保持整个card可见,因为Cookie登录部分仍然可用
|
||||||
|
iflowCard.style.display = 'block';
|
||||||
|
}
|
||||||
|
|
||||||
// 如果找不到具体的卡片 ID,尝试通过类名查找
|
// 如果找不到具体的卡片 ID,尝试通过类名查找
|
||||||
const oauthCardElements = document.querySelectorAll('.card');
|
const oauthCardElements = document.querySelectorAll('.card');
|
||||||
oauthCardElements.forEach(card => {
|
oauthCardElements.forEach(card => {
|
||||||
const cardText = card.textContent || '';
|
const cardText = card.textContent || '';
|
||||||
|
// 不再隐藏包含 'iFlow' 的卡片
|
||||||
if (cardText.includes('Codex OAuth') ||
|
if (cardText.includes('Codex OAuth') ||
|
||||||
cardText.includes('Anthropic OAuth') ||
|
cardText.includes('Anthropic OAuth') ||
|
||||||
cardText.includes('Antigravity OAuth') ||
|
cardText.includes('Antigravity OAuth') ||
|
||||||
cardText.includes('Gemini CLI OAuth') ||
|
cardText.includes('Gemini CLI OAuth') ||
|
||||||
cardText.includes('Qwen OAuth') ||
|
cardText.includes('Qwen OAuth')) {
|
||||||
cardText.includes('iFlow OAuth')) {
|
|
||||||
card.style.display = 'none';
|
card.style.display = 'none';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(`当前主机名: ${hostname},已隐藏 OAuth 登录框`);
|
console.log(`当前主机名: ${hostname},已隐藏 OAuth 登录框(保留 iFlow Cookie 登录)`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -111,14 +111,14 @@ export const REQUEST_TIMEOUT_MS = 30 * 1000;
|
|||||||
/**
|
/**
|
||||||
* OAuth 卡片元素 ID 列表
|
* OAuth 卡片元素 ID 列表
|
||||||
* 用于根据主机环境隐藏/显示不同的 OAuth 选项
|
* 用于根据主机环境隐藏/显示不同的 OAuth 选项
|
||||||
|
* 注意: iflow-oauth-card 不在此列表中,因为它包含Cookie登录功能,该功能可在远程使用
|
||||||
*/
|
*/
|
||||||
export const OAUTH_CARD_IDS = [
|
export const OAUTH_CARD_IDS = [
|
||||||
'codex-oauth-card',
|
'codex-oauth-card',
|
||||||
'anthropic-oauth-card',
|
'anthropic-oauth-card',
|
||||||
'antigravity-oauth-card',
|
'antigravity-oauth-card',
|
||||||
'gemini-cli-oauth-card',
|
'gemini-cli-oauth-card',
|
||||||
'qwen-oauth-card',
|
'qwen-oauth-card'
|
||||||
'iflow-oauth-card'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user