chore: 更新身份验证中间件为 'auth-admin',并简化身份验证路由定义
This commit is contained in:
@@ -1,14 +1,20 @@
|
||||
import { app } from '../app.ts'
|
||||
import './route-create.ts'
|
||||
|
||||
if (!app.hasRoute('auth', '')) {
|
||||
app.route({
|
||||
path: 'auth',
|
||||
key: '',
|
||||
id: 'auth',
|
||||
description: '身份验证路由',
|
||||
}).define(async (ctx) => {
|
||||
//
|
||||
}).addTo(app);
|
||||
}
|
||||
app.route({
|
||||
path: 'auth',
|
||||
key: '',
|
||||
id: 'auth',
|
||||
description: '身份验证路由',
|
||||
}).define(async (ctx) => {
|
||||
//
|
||||
}).addTo(app, { overwrite: false });
|
||||
|
||||
app.route({
|
||||
path: 'auth-admin',
|
||||
key: '',
|
||||
id: 'auth-admin',
|
||||
description: '管理员身份验证路由',
|
||||
}).define(async (ctx) => {
|
||||
//
|
||||
}).addTo(app, { overwrite: false });
|
||||
@@ -6,7 +6,7 @@ app.route({
|
||||
path: 'router-skill',
|
||||
key: 'create-route',
|
||||
description: '创建路由技能',
|
||||
middleware: ['auth'],
|
||||
middleware: ['auth-admin'],
|
||||
metadata: {
|
||||
tags: ['opencode'],
|
||||
...createSkill({
|
||||
@@ -38,7 +38,7 @@ app.route({
|
||||
path: 'router-skill',
|
||||
key: 'version',
|
||||
description: '获取最新router版本号',
|
||||
middleware: ['auth'],
|
||||
middleware: ['auth-admin'],
|
||||
metadata: {
|
||||
tags: ['opencode'],
|
||||
...createSkill({
|
||||
@@ -59,7 +59,7 @@ app.route({
|
||||
path: 'route-skill',
|
||||
key: 'test',
|
||||
description: '测试路由技能',
|
||||
middleware: ['auth'],
|
||||
middleware: ['auth-admin'],
|
||||
metadata: {
|
||||
tags: ['opencode'],
|
||||
...createSkill({
|
||||
|
||||
Reference in New Issue
Block a user