chore: 更新依赖版本,移除不必要的路由定义
This commit is contained in:
29
src/route.ts
29
src/route.ts
@@ -161,32 +161,9 @@ app
|
||||
})
|
||||
.addTo(app);
|
||||
|
||||
app
|
||||
.route({
|
||||
path: 'router',
|
||||
key: 'list',
|
||||
description: '列出所有的当前的可请求的路由信息',
|
||||
middleware: ['auth-can']
|
||||
})
|
||||
.define(async (ctx) => {
|
||||
const tokenUser = ctx.state.tokenUser;
|
||||
let isUser = !!tokenUser;
|
||||
const routesList = app.router.routes.filter(item => {
|
||||
if (item.id === 'auth' || item.id === 'auth-can' || item.id === 'check-auth-admin' || item.id === 'auth-admin') {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}).map((item) => {
|
||||
const route = pick(item, ['id', 'path', 'key', 'description', 'middleware'] as const);
|
||||
return toJSONSchema(route);
|
||||
})
|
||||
ctx.body = {
|
||||
list: routesList,
|
||||
isUser
|
||||
}
|
||||
})
|
||||
.addTo(app);
|
||||
|
||||
app.createRouteList({
|
||||
middleware: ['auth-can']
|
||||
})
|
||||
|
||||
app.route({
|
||||
path: 'system',
|
||||
|
||||
Reference in New Issue
Block a user