修改匹配key的方式

master
刘东琪 9 months ago
parent c3c2411ce3
commit 6cec904936
  1. 11
      routes/index.js

@ -84,13 +84,20 @@ async function handle(url, uuid, areaName, htmlStr, cookie, userAgent) {
// 方案1 通过监听cookie 判断cookie是否生成 // 方案1 通过监听cookie 判断cookie是否生成
const superSetCookie = cookieJar.setCookie; const superSetCookie = cookieJar.setCookie;
let generateCookieKey = null;
// 设置 setCookie 代理 // 设置 setCookie 代理
cookieJar.setCookie = function (cookie, currentUrl, options, callback) { cookieJar.setCookie = function (cookie, currentUrl, options, callback) {
console.debug(`${uuid};正在设置 Cookie:`, cookie, currentUrl); console.debug(`${uuid};正在设置 Cookie:`, cookie, currentUrl);
let call = superSetCookie.call(this, cookie, currentUrl, options, callback); let call = superSetCookie.call(this, cookie, currentUrl, options, callback);
// 设置标志可取标志 // 根据瑞树6 cookie 特性 截取 `enable_XXXXXXXXXXXX=true` XXXXXXXX 为即将生成的 cookie key
if (cookie.includes('P=')) { if (generateCookieKey != null && cookie.includes(generateCookieKey)) {
window[uuid] = true window[uuid] = true
console.debug('匹配---->', cookie)
}
let match = cookie.match(/enable_(.*?)=true/);
if (match) {
generateCookieKey = match[1];
console.debug('设置 匹配---->', generateCookieKey)
} }
return call; return call;
}; };

Loading…
Cancel
Save