From 4f15c3f5c53a4506c49432434459efe7a73deff8 Mon Sep 17 00:00:00 2001 From: Supra4E8C Date: Mon, 10 Nov 2025 12:16:46 +0800 Subject: [PATCH] feat(app.js, i18n): enforce required base URL for Codex API configuration - Updated the Codex API configuration modals to mark the Base URL field as required. - Added validation to ensure the Base URL is provided before submission, with appropriate error notifications. - Updated internationalization strings to reflect the change in the Base URL label from "Optional" to "Required" in both English and Chinese. --- app.js | 12 ++++++++++-- i18n.js | 10 ++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/app.js b/app.js index dbcc275..4cfc450 100644 --- a/app.js +++ b/app.js @@ -2961,7 +2961,7 @@ class CLIProxyManager {
- +
@@ -2994,6 +2994,10 @@ class CLIProxyManager { this.showNotification(i18n.t('notification.field_required'), 'error'); return; } + if (!baseUrl) { + this.showNotification(i18n.t('notification.codex_base_url_required'), 'error'); + return; + } try { const data = await this.makeRequest('/codex-api-key'); @@ -3030,7 +3034,7 @@ class CLIProxyManager {
- +
@@ -3063,6 +3067,10 @@ class CLIProxyManager { this.showNotification(i18n.t('notification.field_required'), 'error'); return; } + if (!baseUrl) { + this.showNotification(i18n.t('notification.codex_base_url_required'), 'error'); + return; + } try { const listResponse = await this.makeRequest('/codex-api-key'); diff --git a/i18n.js b/i18n.js index 9ad1c0c..6d2eb44 100644 --- a/i18n.js +++ b/i18n.js @@ -154,13 +154,13 @@ const i18n = { 'ai_providers.codex_add_modal_title': '添加Codex API配置', 'ai_providers.codex_add_modal_key_label': 'API密钥:', 'ai_providers.codex_add_modal_key_placeholder': '请输入Codex API密钥', - 'ai_providers.codex_add_modal_url_label': 'Base URL (可选):', + 'ai_providers.codex_add_modal_url_label': 'Base URL (必填):', 'ai_providers.codex_add_modal_url_placeholder': '例如: https://api.example.com', 'ai_providers.codex_add_modal_proxy_label': '代理 URL (可选):', 'ai_providers.codex_add_modal_proxy_placeholder': '例如: socks5://proxy.example.com:1080', 'ai_providers.codex_edit_modal_title': '编辑Codex API配置', 'ai_providers.codex_edit_modal_key_label': 'API密钥:', - 'ai_providers.codex_edit_modal_url_label': 'Base URL (可选):', + 'ai_providers.codex_edit_modal_url_label': 'Base URL (必填):', 'ai_providers.codex_edit_modal_proxy_label': '代理 URL (可选):', 'ai_providers.codex_delete_confirm': '确定要删除这个Codex配置吗?', @@ -415,6 +415,7 @@ const i18n = { 'notification.codex_config_added': 'Codex配置添加成功', 'notification.codex_config_updated': 'Codex配置更新成功', 'notification.codex_config_deleted': 'Codex配置删除成功', + 'notification.codex_base_url_required': '请填写Codex Base URL', 'notification.claude_config_added': 'Claude配置添加成功', 'notification.claude_config_updated': 'Claude配置更新成功', 'notification.claude_config_deleted': 'Claude配置删除成功', @@ -612,13 +613,13 @@ const i18n = { 'ai_providers.codex_add_modal_title': 'Add Codex API Configuration', 'ai_providers.codex_add_modal_key_label': 'API Key:', 'ai_providers.codex_add_modal_key_placeholder': 'Please enter Codex API key', - 'ai_providers.codex_add_modal_url_label': 'Base URL (Optional):', + 'ai_providers.codex_add_modal_url_label': 'Base URL (Required):', 'ai_providers.codex_add_modal_url_placeholder': 'e.g.: https://api.example.com', 'ai_providers.codex_add_modal_proxy_label': 'Proxy URL (Optional):', 'ai_providers.codex_add_modal_proxy_placeholder': 'e.g.: socks5://proxy.example.com:1080', 'ai_providers.codex_edit_modal_title': 'Edit Codex API Configuration', 'ai_providers.codex_edit_modal_key_label': 'API Key:', - 'ai_providers.codex_edit_modal_url_label': 'Base URL (Optional):', + 'ai_providers.codex_edit_modal_url_label': 'Base URL (Required):', 'ai_providers.codex_edit_modal_proxy_label': 'Proxy URL (Optional):', 'ai_providers.codex_delete_confirm': 'Are you sure you want to delete this Codex configuration?', @@ -872,6 +873,7 @@ const i18n = { 'notification.codex_config_added': 'Codex configuration added successfully', 'notification.codex_config_updated': 'Codex configuration updated successfully', 'notification.codex_config_deleted': 'Codex configuration deleted successfully', + 'notification.codex_base_url_required': 'Please enter the Codex Base URL', 'notification.claude_config_added': 'Claude configuration added successfully', 'notification.claude_config_updated': 'Claude configuration updated successfully', 'notification.claude_config_deleted': 'Claude configuration deleted successfully',