From d50f5ed2af9284620c95359ee73ff560613721b9 Mon Sep 17 00:00:00 2001 From: abearxiong Date: Sat, 21 Feb 2026 07:28:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0token=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E6=97=A5=E5=BF=97=EF=BC=8C=E4=BC=98=E5=8C=96WebSocket?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/auth/models/user-secret.ts | 1 + src/modules/v1-ws-proxy/index.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/auth/models/user-secret.ts b/src/auth/models/user-secret.ts index f5809ea..16035cd 100644 --- a/src/auth/models/user-secret.ts +++ b/src/auth/models/user-secret.ts @@ -55,6 +55,7 @@ export class UserSecret { static async verifyToken(token: string) { if (token?.includes?.('.')) { // 先尝试作为jwt token验证,如果验证成功则直接返回用户信息 + console.log('[jwksManager] 验证token'); return await jwksManager.verify(token); } if (!oauth.isSecretKey(token)) { diff --git a/src/modules/v1-ws-proxy/index.ts b/src/modules/v1-ws-proxy/index.ts index f545aee..055330d 100644 --- a/src/modules/v1-ws-proxy/index.ts +++ b/src/modules/v1-ws-proxy/index.ts @@ -6,7 +6,6 @@ import { WebSocketListenerFun } from '@kevisual/router/src/server/server-type.ts export const wssFun: WebSocketListenerFun = async (req, res) => { // do nothing, just to enable ws upgrade event const { id, ws, token, data, emitter } = req; - logger.debug('ws proxy connected, id=', id, ' token=', token, ' data=', data); // console.log('req', req) const { type } = data || {}; if (type === 'registryClient') { @@ -27,6 +26,7 @@ export const wssFun: WebSocketListenerFun = async (req, res) => { logger.debug('ws 连接已存在,关闭旧连接', userApp); wsMessage.ws.close(); wsProxyManager.unregister(userApp); + await new Promise((resolve) => setTimeout(resolve, 200)); } // @ts-ignore wsProxyManager.register(userApp, { user, ws });