feat: 重构CNB管理模块,添加清理记录功能,更新中间件为统一认证方式,优化工作空间相关路由
This commit is contained in:
@@ -1,23 +1,13 @@
|
||||
import { app } from '../../app.ts';
|
||||
import { app, notCNBCheck } from '../../app.ts';
|
||||
import { useKey } from '@kevisual/context'
|
||||
import { getLiveMdContent } from './live/live-content.ts';
|
||||
import z from 'zod';
|
||||
const notCNBCheck = (ctx: any) => {
|
||||
const isCNB = useKey('CNB');
|
||||
if (!isCNB) {
|
||||
ctx.body = {
|
||||
title: '非 cnb-board 环境',
|
||||
list: []
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
app.route({
|
||||
path: 'cnb_board',
|
||||
key: 'live',
|
||||
description: '获取cnb-board live的mdContent内容',
|
||||
middleware: ['auth-admin'],
|
||||
middleware: ['auth'],
|
||||
metadata: {
|
||||
args: {
|
||||
more: z.boolean().optional().describe('是否获取更多系统信息,默认false'),
|
||||
@@ -37,7 +27,7 @@ app.route({
|
||||
path: 'cnb_board',
|
||||
key: 'live_repo_info',
|
||||
description: '获取cnb-board live的repo信息',
|
||||
middleware: ['auth-admin']
|
||||
middleware: ['auth']
|
||||
}).define(async (ctx) => {
|
||||
const repoSlug = useKey('CNB_REPO_SLUG') || '';
|
||||
const repoName = useKey('CNB_REPO_NAME') || '';
|
||||
@@ -90,7 +80,7 @@ app.route({
|
||||
path: 'cnb_board',
|
||||
key: 'live_build_info',
|
||||
description: '获取cnb-board live的构建信息',
|
||||
middleware: ['auth-admin']
|
||||
middleware: ['auth']
|
||||
}).define(async (ctx) => {
|
||||
if (notCNBCheck(ctx)) return;
|
||||
const labels = [
|
||||
|
||||
Reference in New Issue
Block a user