From f498cef79fc16a311033872f2f15501e56b9691b Mon Sep 17 00:00:00 2001 From: ykxiao Date: Wed, 9 Jul 2025 14:09:06 +0800 Subject: [PATCH] oo --- routes/stream.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/routes/stream.js b/routes/stream.js index e0bbf0a..697f025 100644 --- a/routes/stream.js +++ b/routes/stream.js @@ -25,16 +25,13 @@ router.get('/', (req, res) => { } // 解析Token 提取客户端ID let clientId - try { // 解析Token并验证签名: - const decoded = jwt.verify(token, config.jwt.jwtSecret, { - algorithms: ['HS256'], - clockTolerance: 15, // 防止 Hyperf 生成后立即验证因 nbf 失败 - ignoreExpiration: false, - maxAge: '5m', // 设置最大有效期 - clockTimestamp: Math.floor(Date.now() / 1000) - 30 // 添加30秒宽限时间处理并发请求 - }); + // const decoded = jwt.verify(token, config.jwt.jwtSecret, { + // algorithms: ['HS256'], + // clockTolerance: 15, // 防止 Hyperf 生成后立即验证因 nbf 失败 + // }); + const decoded = jwt.decode(token); clientId = decoded.claims?.user_client_id || decoded.sub || uuidV4(); } catch (err) { res.status(401).json({ @@ -49,7 +46,6 @@ router.get('/', (req, res) => { const initialData = { status: 'connected', clientId, - clientCount: clients.size(), time: timestamp.formatTime() }; // 立即发送确认