@skrillex1224/playwright-toolkit 2.1.149 → 2.1.150

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -122,6 +122,31 @@ var createActorInfo = (info) => {
122
122
  };
123
123
  };
124
124
  var ActorInfo = {
125
+ qbot: createActorInfo({
126
+ key: "qbot",
127
+ name: "\u641C\u72D7QBot",
128
+ domain: "m.sogou.com",
129
+ path: "/web/searchList.jsp",
130
+ share: {
131
+ mode: "dom",
132
+ prefix: "",
133
+ xurl: []
134
+ }
135
+ }),
136
+ douyin: createActorInfo({
137
+ key: "douyin",
138
+ name: "\u6296\u97F3\u641C\u7D22",
139
+ domain: "www.douyin.com",
140
+ path: "/search",
141
+ share: {
142
+ mode: "response",
143
+ prefix: "",
144
+ xurl: [
145
+ "/aweme/v1/web/web_shorten",
146
+ "data"
147
+ ]
148
+ }
149
+ }),
125
150
  doubao: createActorInfo({
126
151
  key: "doubao",
127
152
  name: "\u8C46\u5305",
@@ -1250,6 +1275,14 @@ var normalizeByPassDomains = (domains) => {
1250
1275
  if (!Array.isArray(domains)) return [];
1251
1276
  return domains.map((item) => String(item || "").trim()).filter(Boolean);
1252
1277
  };
1278
+ var compileByPassMatcher = (patternRaw) => {
1279
+ const pattern = String(patternRaw || "").trim().toLowerCase();
1280
+ if (!pattern) return null;
1281
+ if (!pattern.includes("*")) return { pattern, test: (hostname) => hostname === pattern };
1282
+ const escaped = pattern.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
1283
+ const regex = new RegExp(`^${escaped}$`);
1284
+ return { pattern, test: (hostname) => regex.test(hostname) };
1285
+ };
1253
1286
  var resolveProxyLaunchOptions = (proxyConfiguration = {}) => {
1254
1287
  const config = proxyConfiguration && typeof proxyConfiguration === "object" && !Array.isArray(proxyConfiguration) ? proxyConfiguration : {};
1255
1288
  const proxyUrl = String(config.proxy_url || "").trim();
@@ -1312,7 +1345,7 @@ var Launch = {
1312
1345
  return () => {
1313
1346
  };
1314
1347
  }
1315
- const domainSet = new Set(byPassDomains.map((domain) => domain.toLowerCase()));
1348
+ const matchers = byPassDomains.map((pattern) => compileByPassMatcher(pattern)).filter(Boolean);
1316
1349
  const requestHandler = (req) => {
1317
1350
  const requestUrl = req.url();
1318
1351
  let hostname = "";
@@ -1321,8 +1354,9 @@ var Launch = {
1321
1354
  } catch {
1322
1355
  return;
1323
1356
  }
1324
- if (!domainSet.has(hostname)) return;
1325
- logger6.info(`[\u76F4\u8FDE\u547D\u4E2D] \u57DF\u540D=${hostname} \u8D44\u6E90\u7C7B\u578B=${req.resourceType()} \u65B9\u6CD5=${req.method()} \u5730\u5740=${requestUrl}`);
1357
+ const matched = matchers.find((item) => item.test(hostname));
1358
+ if (!matched) return;
1359
+ logger6.info(`[\u76F4\u8FDE\u547D\u4E2D] \u89C4\u5219=${matched.pattern} \u57DF\u540D=${hostname} \u8D44\u6E90\u7C7B\u578B=${req.resourceType()} \u65B9\u6CD5=${req.method()} \u5730\u5740=${requestUrl}`);
1326
1360
  };
1327
1361
  page.on("request", requestHandler);
1328
1362
  return () => page.off("request", requestHandler);