feat: 重构CNB管理模块,添加清理记录功能,更新中间件为统一认证方式,优化工作空间相关路由

This commit is contained in:
xiongxiao
2026-03-09 18:54:33 +08:00
committed by cnb
parent 21ba07e55b
commit 382c4809ea
25 changed files with 296 additions and 73 deletions

View File

@@ -1,5 +1,5 @@
import { createSkill } from '@kevisual/router';
import { app, cnb } from '../../app.ts';
import { app, cnbManager } from '../../app.ts';
import { tool } from '@opencode-ai/plugin/tool';
@@ -7,7 +7,7 @@ app.route({
path: 'cnb',
key: 'user-check',
description: '检查用户登录状态参数checkToken,default true; checkCookie, default false',
middleware: ['auth-admin'],
middleware: ['auth'],
metadata: {
tags: ['opencode'],
...createSkill({
@@ -24,6 +24,7 @@ app.route({
const checkToken = ctx.query?.checkToken ?? true;
const checkCookie = ctx.query?.checkCookie ?? false;
let content = '';
const cnb = await cnbManager.getContext(ctx);
if (checkToken) {
const res = await cnb.user.getUser();
if (res?.code !== 200) {