feat: 更新依赖版本,添加 cnb-board 环境检查功能
This commit is contained in:
@@ -21,11 +21,11 @@ app.route({
|
||||
})
|
||||
},
|
||||
}).define(async (ctx) => {
|
||||
const { path, key = '' } = ctx.query;
|
||||
const { path, key = '' } = ctx.args;
|
||||
if (!path) {
|
||||
ctx.throw('路径path不能为空');
|
||||
}
|
||||
const res = await ctx.run({ path, key, payload: ctx.query.payload || {} }, {
|
||||
const res = await ctx.run({ path, key, payload: ctx.args.payload || {} }, {
|
||||
...ctx
|
||||
});
|
||||
ctx.forward(res);
|
||||
|
||||
@@ -33,7 +33,8 @@ app.route({
|
||||
title: '查看客户端 IP 地址',
|
||||
summary: '获取当前客户端的 IP 地址信息',
|
||||
})
|
||||
}
|
||||
},
|
||||
middleware: ['auth-admin']
|
||||
})
|
||||
.define(async (ctx) => {
|
||||
const networkInterfaces = os.networkInterfaces();
|
||||
|
||||
@@ -76,10 +76,6 @@ app.route({
|
||||
message: '客户端重启命令已执行',
|
||||
};
|
||||
} catch (error) {
|
||||
ctx.status = 500;
|
||||
ctx.body = {
|
||||
message: '重启客户端失败',
|
||||
error: error.message,
|
||||
};
|
||||
ctx.throw(500, '重启客户端失败');
|
||||
}
|
||||
}).addTo(app);
|
||||
|
||||
@@ -3,6 +3,20 @@ import { getLiveMdContent } from './live/live-content.ts';
|
||||
import './cnb-dev-env.ts';
|
||||
import z from 'zod';
|
||||
import { execCommand } from '@/module/npm-install.ts';
|
||||
import { useKey } from '@kevisual/context';
|
||||
|
||||
app.route({
|
||||
path: 'cnb-board',
|
||||
key: 'is-cnb-board',
|
||||
description: '检查是否是 cnb-board 环境',
|
||||
middleware: ['auth-admin']
|
||||
}).define(async (ctx) => {
|
||||
const isCNB = useKey('CNB');
|
||||
ctx.body = {
|
||||
isCNB: !!isCNB,
|
||||
};
|
||||
}).addTo(app);
|
||||
|
||||
app.route({
|
||||
path: 'cnb-board',
|
||||
key: 'live',
|
||||
|
||||
1
assistant/src/routes/cnb-board/modules/index.ts
Normal file
1
assistant/src/routes/cnb-board/modules/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './is-cnb.ts';
|
||||
6
assistant/src/routes/cnb-board/modules/is-cnb.ts
Normal file
6
assistant/src/routes/cnb-board/modules/is-cnb.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { useKey } from "@kevisual/context";
|
||||
|
||||
export const isCnb = () => {
|
||||
const CNB = useKey('CNB');
|
||||
return !!CNB;
|
||||
}
|
||||
Reference in New Issue
Block a user