29 lines
628 B
TypeScript
29 lines
628 B
TypeScript
import { app } from '../../app.ts';
|
|
import './cnb-dev-env.ts';
|
|
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: 'exit',
|
|
description: 'cnb的工作环境退出程序',
|
|
middleware: ['auth-admin'],
|
|
}).define(async (ctx) => {
|
|
const cmd = 'kill 1';
|
|
execCommand(cmd);
|
|
}).addTo(app); |