feat: 更新获取配置接口,增加动态获取访问地址功能
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user