From 6cec904936368d96b7ec45d381daf89bd83c8b7e Mon Sep 17 00:00:00 2001 From: liudongqi Date: Fri, 6 Sep 2024 11:10:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=B9=E9=85=8Dkey?= =?UTF-8?q?=E7=9A=84=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routes/index.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/routes/index.js b/routes/index.js index 92ab9be..926d214 100644 --- a/routes/index.js +++ b/routes/index.js @@ -84,13 +84,20 @@ async function handle(url, uuid, areaName, htmlStr, cookie, userAgent) { // 方案1 通过监听cookie 判断cookie是否生成 const superSetCookie = cookieJar.setCookie; + let generateCookieKey = null; // 设置 setCookie 代理 cookieJar.setCookie = function (cookie, currentUrl, options, callback) { console.debug(`${uuid};正在设置 Cookie:`, cookie, currentUrl); let call = superSetCookie.call(this, cookie, currentUrl, options, callback); - // 设置标志可取标志 - if (cookie.includes('P=')) { + // 根据瑞树6 cookie 特性 截取 `enable_XXXXXXXXXXXX=true` XXXXXXXX 为即将生成的 cookie key + if (generateCookieKey != null && cookie.includes(generateCookieKey)) { window[uuid] = true + console.debug('匹配---->', cookie) + } + let match = cookie.match(/enable_(.*?)=true/); + if (match) { + generateCookieKey = match[1]; + console.debug('设置 匹配---->', generateCookieKey) } return call; };