mirror of
https://github.com/router-for-me/Cli-Proxy-API-Management-Center.git
synced 2026-02-03 03:10:50 +08:00
Add files via upload
This commit is contained in:
35
app.js
35
app.js
@@ -538,7 +538,6 @@ class CLIProxyManager {
|
|||||||
const updateRetry = document.getElementById('update-retry');
|
const updateRetry = document.getElementById('update-retry');
|
||||||
const switchProjectToggle = document.getElementById('switch-project-toggle');
|
const switchProjectToggle = document.getElementById('switch-project-toggle');
|
||||||
const switchPreviewToggle = document.getElementById('switch-preview-model-toggle');
|
const switchPreviewToggle = document.getElementById('switch-preview-model-toggle');
|
||||||
const allowLocalhostToggle = document.getElementById('allow-localhost-toggle');
|
|
||||||
|
|
||||||
if (debugToggle) {
|
if (debugToggle) {
|
||||||
debugToggle.addEventListener('change', (e) => this.updateDebug(e.target.checked));
|
debugToggle.addEventListener('change', (e) => this.updateDebug(e.target.checked));
|
||||||
@@ -558,9 +557,6 @@ class CLIProxyManager {
|
|||||||
if (switchPreviewToggle) {
|
if (switchPreviewToggle) {
|
||||||
switchPreviewToggle.addEventListener('change', (e) => this.updateSwitchPreviewModel(e.target.checked));
|
switchPreviewToggle.addEventListener('change', (e) => this.updateSwitchPreviewModel(e.target.checked));
|
||||||
}
|
}
|
||||||
if (allowLocalhostToggle) {
|
|
||||||
allowLocalhostToggle.addEventListener('change', (e) => this.updateAllowLocalhost(e.target.checked));
|
|
||||||
}
|
|
||||||
|
|
||||||
// API 密钥管理
|
// API 密钥管理
|
||||||
const addApiKey = document.getElementById('add-api-key');
|
const addApiKey = document.getElementById('add-api-key');
|
||||||
@@ -1001,10 +997,6 @@ class CLIProxyManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 本地访问设置
|
|
||||||
if (config['allow-localhost-unauthenticated'] !== undefined) {
|
|
||||||
document.getElementById('allow-localhost-toggle').checked = config['allow-localhost-unauthenticated'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// API 密钥
|
// API 密钥
|
||||||
if (config['api-keys']) {
|
if (config['api-keys']) {
|
||||||
@@ -1039,7 +1031,6 @@ class CLIProxyManager {
|
|||||||
this.loadProxySettings(),
|
this.loadProxySettings(),
|
||||||
this.loadRetrySettings(),
|
this.loadRetrySettings(),
|
||||||
this.loadQuotaSettings(),
|
this.loadQuotaSettings(),
|
||||||
this.loadLocalhostSettings(),
|
|
||||||
this.loadApiKeys(),
|
this.loadApiKeys(),
|
||||||
this.loadGeminiKeys(),
|
this.loadGeminiKeys(),
|
||||||
this.loadCodexKeys(),
|
this.loadCodexKeys(),
|
||||||
@@ -1192,32 +1183,6 @@ class CLIProxyManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 加载本地访问设置
|
|
||||||
async loadLocalhostSettings() {
|
|
||||||
try {
|
|
||||||
const config = await this.getConfig();
|
|
||||||
if (config['allow-localhost-unauthenticated'] !== undefined) {
|
|
||||||
document.getElementById('allow-localhost-toggle').checked = config['allow-localhost-unauthenticated'];
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error('加载本地访问设置失败:', error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 更新本地访问设置
|
|
||||||
async updateAllowLocalhost(enabled) {
|
|
||||||
try {
|
|
||||||
await this.makeRequest('/allow-localhost-unauthenticated', {
|
|
||||||
method: 'PUT',
|
|
||||||
body: JSON.stringify({ value: enabled })
|
|
||||||
});
|
|
||||||
this.clearCache(); // 清除缓存
|
|
||||||
this.showNotification(i18n.t('notification.localhost_updated'), 'success');
|
|
||||||
} catch (error) {
|
|
||||||
this.showNotification(`${i18n.t('notification.update_failed')}: ${error.message}`, 'error');
|
|
||||||
document.getElementById('allow-localhost-toggle').checked = !enabled;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 加载API密钥
|
// 加载API密钥
|
||||||
async loadApiKeys() {
|
async loadApiKeys() {
|
||||||
|
|||||||
18
i18n.js
18
i18n.js
@@ -103,8 +103,6 @@ const i18n = {
|
|||||||
'basic_settings.quota_title': '配额超出行为',
|
'basic_settings.quota_title': '配额超出行为',
|
||||||
'basic_settings.quota_switch_project': '自动切换项目',
|
'basic_settings.quota_switch_project': '自动切换项目',
|
||||||
'basic_settings.quota_switch_preview': '切换到预览模型',
|
'basic_settings.quota_switch_preview': '切换到预览模型',
|
||||||
'basic_settings.localhost_title': '本地访问',
|
|
||||||
'basic_settings.localhost_allow': '允许本地未认证访问',
|
|
||||||
|
|
||||||
// API 密钥管理
|
// API 密钥管理
|
||||||
'api_keys.title': 'API 密钥管理',
|
'api_keys.title': 'API 密钥管理',
|
||||||
@@ -253,7 +251,6 @@ const i18n = {
|
|||||||
'notification.retry_updated': '重试设置已更新',
|
'notification.retry_updated': '重试设置已更新',
|
||||||
'notification.quota_switch_project_updated': '项目切换设置已更新',
|
'notification.quota_switch_project_updated': '项目切换设置已更新',
|
||||||
'notification.quota_switch_preview_updated': '预览模型切换设置已更新',
|
'notification.quota_switch_preview_updated': '预览模型切换设置已更新',
|
||||||
'notification.localhost_updated': '本地访问设置已更新',
|
|
||||||
'notification.api_key_added': 'API密钥添加成功',
|
'notification.api_key_added': 'API密钥添加成功',
|
||||||
'notification.api_key_updated': 'API密钥更新成功',
|
'notification.api_key_updated': 'API密钥更新成功',
|
||||||
'notification.api_key_deleted': 'API密钥删除成功',
|
'notification.api_key_deleted': 'API密钥删除成功',
|
||||||
@@ -297,7 +294,11 @@ const i18n = {
|
|||||||
'theme.dark': '暗色',
|
'theme.dark': '暗色',
|
||||||
'theme.switch_to_light': '切换到亮色模式',
|
'theme.switch_to_light': '切换到亮色模式',
|
||||||
'theme.switch_to_dark': '切换到暗色模式',
|
'theme.switch_to_dark': '切换到暗色模式',
|
||||||
'theme.auto': '跟随系统'
|
'theme.auto': '跟随系统',
|
||||||
|
|
||||||
|
// 页脚
|
||||||
|
'footer.version': '版本',
|
||||||
|
'footer.author': '作者'
|
||||||
},
|
},
|
||||||
|
|
||||||
'en-US': {
|
'en-US': {
|
||||||
@@ -397,8 +398,6 @@ const i18n = {
|
|||||||
'basic_settings.quota_title': 'Quota Exceeded Behavior',
|
'basic_settings.quota_title': 'Quota Exceeded Behavior',
|
||||||
'basic_settings.quota_switch_project': 'Auto Switch Project',
|
'basic_settings.quota_switch_project': 'Auto Switch Project',
|
||||||
'basic_settings.quota_switch_preview': 'Switch to Preview Model',
|
'basic_settings.quota_switch_preview': 'Switch to Preview Model',
|
||||||
'basic_settings.localhost_title': 'Local Access',
|
|
||||||
'basic_settings.localhost_allow': 'Allow Localhost Unauthenticated Access',
|
|
||||||
|
|
||||||
// API Keys management
|
// API Keys management
|
||||||
'api_keys.title': 'API Keys Management',
|
'api_keys.title': 'API Keys Management',
|
||||||
@@ -547,7 +546,6 @@ const i18n = {
|
|||||||
'notification.retry_updated': 'Retry settings updated',
|
'notification.retry_updated': 'Retry settings updated',
|
||||||
'notification.quota_switch_project_updated': 'Project switch settings updated',
|
'notification.quota_switch_project_updated': 'Project switch settings updated',
|
||||||
'notification.quota_switch_preview_updated': 'Preview model switch settings updated',
|
'notification.quota_switch_preview_updated': 'Preview model switch settings updated',
|
||||||
'notification.localhost_updated': 'Localhost access settings updated',
|
|
||||||
'notification.api_key_added': 'API key added successfully',
|
'notification.api_key_added': 'API key added successfully',
|
||||||
'notification.api_key_updated': 'API key updated successfully',
|
'notification.api_key_updated': 'API key updated successfully',
|
||||||
'notification.api_key_deleted': 'API key deleted successfully',
|
'notification.api_key_deleted': 'API key deleted successfully',
|
||||||
@@ -591,7 +589,11 @@ const i18n = {
|
|||||||
'theme.dark': 'Dark',
|
'theme.dark': 'Dark',
|
||||||
'theme.switch_to_light': 'Switch to light mode',
|
'theme.switch_to_light': 'Switch to light mode',
|
||||||
'theme.switch_to_dark': 'Switch to dark mode',
|
'theme.switch_to_dark': 'Switch to dark mode',
|
||||||
'theme.auto': 'Follow system'
|
'theme.auto': 'Follow system',
|
||||||
|
|
||||||
|
// Footer
|
||||||
|
'footer.version': 'Version',
|
||||||
|
'footer.author': 'Author'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
24
index.html
24
index.html
@@ -309,21 +309,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 本地访问设置 -->
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3><i class="fas fa-home"></i> <span data-i18n="basic_settings.localhost_title">本地访问</span></h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-content">
|
|
||||||
<div class="toggle-group">
|
|
||||||
<label class="toggle-switch">
|
|
||||||
<input type="checkbox" id="allow-localhost-toggle">
|
|
||||||
<span class="slider"></span>
|
|
||||||
</label>
|
|
||||||
<span class="toggle-label" data-i18n="basic_settings.localhost_allow">允许本地未认证访问</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!-- API 密钥管理 -->
|
<!-- API 密钥管理 -->
|
||||||
@@ -590,6 +575,15 @@
|
|||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
<!-- 版本信息 -->
|
||||||
|
<footer class="version-footer">
|
||||||
|
<div class="version-info">
|
||||||
|
<span data-i18n="footer.version">版本</span>: v0.0.3
|
||||||
|
<span class="separator">•</span>
|
||||||
|
<span data-i18n="footer.author">作者</span>: Supra4E8C
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 模态框 -->
|
<!-- 模态框 -->
|
||||||
|
|||||||
31
styles.css
31
styles.css
@@ -1816,3 +1816,34 @@ input:checked + .slider:before {
|
|||||||
background: var(--bg-tertiary);
|
background: var(--bg-tertiary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 版本信息样式 */
|
||||||
|
.version-footer {
|
||||||
|
margin-top: 2rem;
|
||||||
|
padding: 1rem 0;
|
||||||
|
border-top: 1px solid var(--border);
|
||||||
|
background: var(--bg-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.version-info {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.version-info .separator {
|
||||||
|
margin: 0 0.75rem;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 暗黑主题下的版本信息 */
|
||||||
|
[data-theme="dark"] .version-footer {
|
||||||
|
border-top-color: var(--border);
|
||||||
|
background: var(--bg-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-theme="dark"] .version-info {
|
||||||
|
color: var(--text-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user