fix: improve mode toggle robustness and add i18n support
- Make mode detection more robust (handle ::1, 0.0.0.0) - Add getProxyPort() to parse port from ANTHROPIC_BASE_URL dynamically - Add i18n translation keys for mode toggle in all 5 languages - Update settings.html to use translation keys and dynamic port Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,20 @@ window.Components.claudeConfig = () => ({
|
||||
currentMode: 'proxy', // 'proxy' or 'paid'
|
||||
modeLoading: false,
|
||||
|
||||
/**
|
||||
* Extract port from ANTHROPIC_BASE_URL for display
|
||||
* @returns {string} Port number or '8080' as fallback
|
||||
*/
|
||||
getProxyPort() {
|
||||
const baseUrl = this.config?.env?.ANTHROPIC_BASE_URL || '';
|
||||
try {
|
||||
const url = new URL(baseUrl);
|
||||
return url.port || '8080';
|
||||
} catch {
|
||||
return '8080';
|
||||
}
|
||||
},
|
||||
|
||||
// Presets state
|
||||
presets: [],
|
||||
selectedPresetName: '',
|
||||
|
||||
Reference in New Issue
Block a user