From 38d31a9fb55fe3c7f170ba322b53ee0588e0d8b2 Mon Sep 17 00:00:00 2001 From: abearxiong Date: Tue, 10 Mar 2026 00:13:00 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B3=A8=E9=87=8A=E6=8E=89auth?= =?UTF-8?q?=E4=B8=AD=E9=97=B4=E4=BB=B6=E4=B8=AD=E5=AF=B9checkAppId?= =?UTF-8?q?=E7=9A=84=E8=B0=83=E7=94=A8=EF=BC=8C=E9=81=BF=E5=85=8D=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E9=AA=8C=E8=AF=81=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/route.ts | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/route.ts b/src/route.ts index a842386..d969f67 100644 --- a/src/route.ts +++ b/src/route.ts @@ -40,12 +40,12 @@ export const addAuth = (app: App) => { }) .define(async (ctx) => { const token = ctx.query.token; - if (checkAppId(ctx, app.appId)) { - ctx.state.tokenUser = { - username: 'default', - } - return; - } + // if (checkAppId(ctx, app.appId)) { + // ctx.state.tokenUser = { + // username: 'default', + // } + // return; + // } // 已经有用户信息则直接返回,不需要重复验证 if (ctx.state.tokenUser) { return; @@ -75,12 +75,12 @@ export const addAuth = (app: App) => { description: '验证token,可以不成功,错误不返回401,正确赋值到ctx.state.tokenUser,失败赋值null', }) .define(async (ctx) => { - if (checkAppId(ctx, app.appId)) { - ctx.state.tokenUser = { - username: 'default', - } - return; - } + // if (checkAppId(ctx, app.appId)) { + // ctx.state.tokenUser = { + // username: 'default', + // } + // return; + // } // 已经有用户信息则直接返回,不需要重复验证 if (ctx.state.tokenUser) { return; @@ -113,12 +113,12 @@ app description: '验证token,必须是admin用户, 错误返回403,正确赋值到ctx.state.tokenAdmin', }) .define(async (ctx) => { - if (checkAppId(ctx, app.appId)) { - ctx.state.tokenUser = { - username: 'default', - } - return; - } + // if (checkAppId(ctx, app.appId)) { + // ctx.state.tokenUser = { + // username: 'default', + // } + // return; + // } const tokenUser = ctx.state.tokenUser; if (!tokenUser) { ctx.throw(401, 'No User For authorized');