Files
cnb/agent/routes/cnb-manager/index.ts

24 lines
632 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { app, cnbManager } from '../../app.ts';
// "列出我的代码仓库search blog"
// 列出我的知识库的代码仓库
app.route({
path: 'cnb',
key: 'clear-me-manager',
description: '清理我的cnb-manager记录',
middleware: ['auth'],
}).define(async (ctx) => {
const tokenUser = ctx.tokenUser;
if (!tokenUser) {
ctx.throw(401, '未授权');
}
const username = tokenUser.username;
if (!username) {
ctx.throw(400, '无效的用户信息');
}
if (username !== 'default') {
cnbManager.clearUsername(username);
}
ctx.body = { content: '已清理cnb-manager记录' };
}).addTo(app);