From ae0e92a6ae283fae78e16bcf27b693cc507379f0 Mon Sep 17 00:00:00 2001 From: hkfires <10558748+hkfires@users.noreply.github.com> Date: Mon, 17 Nov 2025 15:32:33 +0800 Subject: [PATCH] refactor(api-keys): fetch keys from API and reduce log limit --- src/modules/api-keys.js | 8 ++++---- src/utils/constants.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/modules/api-keys.js b/src/modules/api-keys.js index e5c0bb4..ef840d6 100644 --- a/src/modules/api-keys.js +++ b/src/modules/api-keys.js @@ -2,10 +2,10 @@ export const apiKeysModule = { // 加载API密钥 async loadApiKeys() { try { - const config = await this.getConfig(); - if (config['api-keys']) { - this.renderApiKeys(config['api-keys']); - } + const data = await this.makeRequest('/api-keys'); + const apiKeysValue = data?.['api-keys'] || []; + const keys = Array.isArray(apiKeysValue) ? apiKeysValue : []; + this.renderApiKeys(keys); } catch (error) { console.error('加载API密钥失败:', error); } diff --git a/src/utils/constants.js b/src/utils/constants.js index 28da0a9..a50a05c 100644 --- a/src/utils/constants.js +++ b/src/utils/constants.js @@ -51,7 +51,7 @@ export const OAUTH_MAX_POLL_DURATION_MS = 5 * 60 * 1000; * 最大日志显示行数 * 限制内存占用,避免大量日志导致页面卡顿 */ -export const MAX_LOG_LINES = 10000; +export const MAX_LOG_LINES = 2000; /** * 认证文件列表默认每页显示数量