fix: 优化connect ws的模块

This commit is contained in:
2026-01-26 18:51:59 +08:00
parent 915f7aff6b
commit 14f2dad837
4 changed files with 15 additions and 6 deletions

View File

@@ -138,11 +138,18 @@ export const initLightCode = async (opts: opts) => {
continue;
}
// console.log(`注册 light-code 路由: [${routerItem.path}] ${routerItem.id} 来自文件: ${file.filepath}`);
const metadata = routerItem.metadata || {};
if (metadata.tags && Array.isArray(metadata.tags)) {
metadata.tags.push('light-code');
} else {
metadata.tags = ['light-code'];
}
app.route({
id: routerItem.id,
path: routerItem.id!,
path: `${routerItem.id}__${routerItem.path}`,
key: routerItem.key,
description: routerItem.description || '',
metadata: routerItem.metadata || {},
metadata,
middleware: ['auth'],
}).define(async (ctx) => {
const tokenUser = ctx.state?.tokenUser || {};