feat: 更新获取配置接口,增加动态获取访问地址功能

This commit is contained in:
2026-02-28 04:33:24 +08:00
parent acd88fb815
commit 73d0fb9730
2 changed files with 28 additions and 5 deletions

View File

@@ -1,5 +1,7 @@
import { app, assistantConfig } from '@/app.ts';
import { reload } from '../../module/reload-server.ts';
import { useKey } from '@kevisual/context';
import { getCNBUrl } from '@/lib.ts';
app
.route({
@@ -29,13 +31,15 @@ app
app.route({
path: 'config',
key: 'getId',
description: '获取appId',
description: '获取appId和访问地址',
}).define(async (ctx) => {
const config = assistantConfig.getCacheAssistantConfig();
const appId = config?.app?.id || null;
let kevisualUrl = getCNBUrl() || 'https://kevisual.cn';
ctx.body = {
id: appId,
url: kevisualUrl,
}
}).addTo(app);
}).addTo(app);