update packages

This commit is contained in:
2025-12-19 13:23:17 +08:00
parent 1f11013ae0
commit 76924b008c
2 changed files with 26 additions and 15 deletions

View File

@@ -44,11 +44,11 @@
"license": "UNLICENSED",
"dependencies": {
"@kevisual/ai": "^0.0.19",
"@kevisual/query": "^0.0.32",
"@kevisual/query": "^0.0.33",
"@types/busboy": "^1.5.4",
"@types/send": "^1.2.1",
"@types/ws": "^8.18.1",
"bullmq": "^5.66.0",
"bullmq": "^5.66.1",
"busboy": "^1.6.0",
"commander": "^14.0.2",
"cookie": "^1.1.1",
@@ -68,7 +68,7 @@
"@kevisual/logger": "^0.0.4",
"@kevisual/oss": "0.0.13",
"@kevisual/permission": "^0.0.3",
"@kevisual/router": "0.0.37",
"@kevisual/router": "0.0.40",
"@kevisual/types": "^0.0.10",
"@kevisual/use-config": "^1.0.21",
"@types/archiver": "^7.0.0",
@@ -113,5 +113,5 @@
"msgpackr-extract"
]
},
"packageManager": "pnpm@10.26.0"
"packageManager": "pnpm@10.26.1"
}

View File

@@ -17,6 +17,7 @@ export const addAuth = (app: App) => {
.route({
path: 'auth',
id: 'auth',
description: '验证token必须成功, 错误返回401正确赋值到ctx.state.tokenUser',
})
.define(async (ctx) => {
const token = ctx.query.token;
@@ -40,6 +41,7 @@ export const addAuth = (app: App) => {
path: 'auth',
key: 'can',
id: 'auth-can',
description: '验证token可以不成功错误不返回401正确赋值到ctx.state.tokenUser失败赋值null',
})
.define(async (ctx) => {
if (ctx.query?.token) {
@@ -67,6 +69,7 @@ app
id: 'auth-admin',
isDebug: true,
middleware: ['auth'],
description: '验证token必须是admin用户, 错误返回403正确赋值到ctx.state.tokenAdmin',
})
.define(async (ctx) => {
const tokenUser = ctx.state.tokenUser;
@@ -140,18 +143,26 @@ app
app
.route({
path: 'test',
key: 'test',
path: 'router',
key: 'list',
description: '列出所有的当前的可请求的路由信息',
middleware: ['auth-can']
})
.define(async (ctx) => {
ctx.body = app.router.routes.map((item) => {
return {
path: item.path,
key: item.key,
description: item.description,
validator: item.validator,
// schema: item.schema,
};
});
const tokenUser = ctx.state.tokenUser;
let isUser = !!tokenUser;
ctx.body = {
list: app.router.routes.map((item) => {
return {
id: item.id,
path: item.path,
key: item.key,
description: item.description,
middeleware: item.middleware,
metadata: item.metadata,
};
}),
isUser
}
})
.addTo(app);