@leeguoo/pwtk-network-debugger 1.2.29 β 1.2.31
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.cjs.js +3 -3
- package/dist/index.esm.js +71 -10
- package/dist/index.js +3 -3
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -6850,6 +6850,25 @@ class NetworkInterceptor {
|
|
|
6850
6850
|
}
|
|
6851
6851
|
});
|
|
6852
6852
|
}
|
|
6853
|
+
extractUrlParams(url) {
|
|
6854
|
+
try {
|
|
6855
|
+
const urlObj = new URL(url);
|
|
6856
|
+
const params = {};
|
|
6857
|
+
urlObj.searchParams.forEach((value, key) => {
|
|
6858
|
+
params[key] = value;
|
|
6859
|
+
});
|
|
6860
|
+
if (Object.keys(params).length > 0) {
|
|
6861
|
+
if (Object.keys(params).length === 1 && params.data) {
|
|
6862
|
+
return params.data;
|
|
6863
|
+
} else {
|
|
6864
|
+
return params;
|
|
6865
|
+
}
|
|
6866
|
+
}
|
|
6867
|
+
return null;
|
|
6868
|
+
} catch (e) {
|
|
6869
|
+
return null;
|
|
6870
|
+
}
|
|
6871
|
+
}
|
|
6853
6872
|
async tryDecrypt(data, headers) {
|
|
6854
6873
|
logger.debug("[PWTK Debug] tryDecrypt called:", {
|
|
6855
6874
|
dataType: typeof data,
|
|
@@ -6998,8 +7017,15 @@ class NetworkInterceptor {
|
|
|
6998
7017
|
requestBody: body,
|
|
6999
7018
|
timestamp: startTime
|
|
7000
7019
|
};
|
|
7001
|
-
|
|
7002
|
-
|
|
7020
|
+
let dataToDecrypt = body;
|
|
7021
|
+
if (method === "GET" && !body) {
|
|
7022
|
+
dataToDecrypt = self2.extractUrlParams(url);
|
|
7023
|
+
if (dataToDecrypt) {
|
|
7024
|
+
requestData.requestBody = dataToDecrypt;
|
|
7025
|
+
}
|
|
7026
|
+
}
|
|
7027
|
+
if (dataToDecrypt) {
|
|
7028
|
+
self2.tryDecrypt(dataToDecrypt, requestHeaders).then((decrypted) => {
|
|
7003
7029
|
if (decrypted !== null) {
|
|
7004
7030
|
requestData.decryptedRequest = decrypted;
|
|
7005
7031
|
self2.requests.set(requestId, requestData);
|
|
@@ -7136,8 +7162,15 @@ class NetworkInterceptor {
|
|
|
7136
7162
|
requestBody,
|
|
7137
7163
|
timestamp: startTime
|
|
7138
7164
|
};
|
|
7139
|
-
|
|
7140
|
-
|
|
7165
|
+
let dataToDecrypt = requestBody;
|
|
7166
|
+
if (method === "GET" && !requestBody) {
|
|
7167
|
+
dataToDecrypt = self2.extractUrlParams(url);
|
|
7168
|
+
if (dataToDecrypt) {
|
|
7169
|
+
requestData.requestBody = dataToDecrypt;
|
|
7170
|
+
}
|
|
7171
|
+
}
|
|
7172
|
+
if (dataToDecrypt) {
|
|
7173
|
+
self2.tryDecrypt(dataToDecrypt, requestHeaders).then((decrypted) => {
|
|
7141
7174
|
if (decrypted !== null) {
|
|
7142
7175
|
requestData.decryptedRequest = decrypted;
|
|
7143
7176
|
self2.requests.set(requestId, requestData);
|
|
@@ -7368,7 +7401,7 @@ function parseCurl(curlCommand) {
|
|
|
7368
7401
|
const lines = curlCommand.split("\\\n").map((line) => line.trim());
|
|
7369
7402
|
const fullCommand = lines.join(" ");
|
|
7370
7403
|
const urlMatch = fullCommand.match(/c?curl\s+['"]?([^'"\s]+)['"]?/);
|
|
7371
|
-
|
|
7404
|
+
let url = urlMatch ? urlMatch[1] : "";
|
|
7372
7405
|
const headers = {};
|
|
7373
7406
|
const headerMatches = fullCommand.matchAll(/-H\s+['"]([^:]+):\s*([^'"]*)['"]/g);
|
|
7374
7407
|
for (const match of headerMatches) {
|
|
@@ -7384,8 +7417,25 @@ function parseCurl(curlCommand) {
|
|
|
7384
7417
|
data = rawData;
|
|
7385
7418
|
}
|
|
7386
7419
|
}
|
|
7420
|
+
if (!dataMatch && url.includes("?")) {
|
|
7421
|
+
try {
|
|
7422
|
+
const urlObj = new URL(url, "http://example.com");
|
|
7423
|
+
const params = {};
|
|
7424
|
+
urlObj.searchParams.forEach((value, key) => {
|
|
7425
|
+
params[key] = value;
|
|
7426
|
+
});
|
|
7427
|
+
if (Object.keys(params).length > 0) {
|
|
7428
|
+
if (Object.keys(params).length === 1 && params.data) {
|
|
7429
|
+
data = params.data;
|
|
7430
|
+
} else {
|
|
7431
|
+
data = params;
|
|
7432
|
+
}
|
|
7433
|
+
}
|
|
7434
|
+
} catch (e) {
|
|
7435
|
+
}
|
|
7436
|
+
}
|
|
7387
7437
|
const methodMatch = fullCommand.match(/-X\s+(['"]?)([A-Z]+)\1/);
|
|
7388
|
-
let method = methodMatch ? methodMatch[2] :
|
|
7438
|
+
let method = methodMatch ? methodMatch[2] : dataMatch ? "POST" : "GET";
|
|
7389
7439
|
return {
|
|
7390
7440
|
url,
|
|
7391
7441
|
method,
|
|
@@ -8171,7 +8221,7 @@ const _DebugPanel = class _DebugPanel {
|
|
|
8171
8221
|
<div class="about-panel" data-panel="about" style="display: none;">
|
|
8172
8222
|
<div style="padding: 20px; color: #fff; text-align: center;">
|
|
8173
8223
|
<h2 style="margin: 0 0 20px 0;">π PWTK θ§£ε―ε°ε·₯ε
·</h2>
|
|
8174
|
-
<p style="margin: 10px 0;">Version: 1.2.
|
|
8224
|
+
<p style="margin: 10px 0;">Version: 1.2.31</p>
|
|
8175
8225
|
<p style="margin: 10px 0;">π¨βπ» Created by <strong>Leo (@leeguoo)</strong></p>
|
|
8176
8226
|
<p style="margin: 10px 0;">π§ ζζ―ζ―ζοΌθ―·θη³» Leo</p>
|
|
8177
8227
|
<p style="margin: 10px 0;">π εδΊ«ζε‘οΌcurl.bwg.leeguoo.com</p>
|
|
@@ -8336,6 +8386,17 @@ const _DebugPanel = class _DebugPanel {
|
|
|
8336
8386
|
await this.shareRequest(request);
|
|
8337
8387
|
});
|
|
8338
8388
|
}
|
|
8389
|
+
item.addEventListener("click", (e) => {
|
|
8390
|
+
const target = e.target;
|
|
8391
|
+
if (target.closest('.detail-title[data-toggle="collapse"]')) {
|
|
8392
|
+
e.stopPropagation();
|
|
8393
|
+
const detailTitle = target.closest(".detail-title");
|
|
8394
|
+
const detailSection = detailTitle.parentElement;
|
|
8395
|
+
if (detailSection && detailSection.classList.contains("collapsible")) {
|
|
8396
|
+
detailSection.classList.toggle("collapsed");
|
|
8397
|
+
}
|
|
8398
|
+
}
|
|
8399
|
+
});
|
|
8339
8400
|
return item;
|
|
8340
8401
|
}
|
|
8341
8402
|
renderRequestDetails(request) {
|
|
@@ -8364,7 +8425,7 @@ const _DebugPanel = class _DebugPanel {
|
|
|
8364
8425
|
if (Object.keys(request.headers).length > 0) {
|
|
8365
8426
|
html += `
|
|
8366
8427
|
<div class="detail-section collapsible collapsed">
|
|
8367
|
-
<div class="detail-title clickable"
|
|
8428
|
+
<div class="detail-title clickable" data-toggle="collapse">
|
|
8368
8429
|
<span class="collapse-icon">βΌ</span> θ―·ζ±ε€΄ (${Object.keys(request.headers).length})
|
|
8369
8430
|
</div>
|
|
8370
8431
|
<div class="detail-content">
|
|
@@ -8380,7 +8441,7 @@ const _DebugPanel = class _DebugPanel {
|
|
|
8380
8441
|
if (request.responseHeaders && Object.keys(request.responseHeaders).length > 0) {
|
|
8381
8442
|
html += `
|
|
8382
8443
|
<div class="detail-section collapsible collapsed">
|
|
8383
|
-
<div class="detail-title clickable"
|
|
8444
|
+
<div class="detail-title clickable" data-toggle="collapse">
|
|
8384
8445
|
<span class="collapse-icon">βΌ</span> εεΊε€΄ (${Object.keys(request.responseHeaders).length})
|
|
8385
8446
|
</div>
|
|
8386
8447
|
<div class="detail-content">
|
|
@@ -8997,7 +9058,7 @@ class NetworkDebugger {
|
|
|
8997
9058
|
this.initialized = true;
|
|
8998
9059
|
logger.consoleDirect(`
|
|
8999
9060
|
ββββββββββββββββββββββββββββββββββββββββββ
|
|
9000
|
-
β π PWTK θ§£ε―ε°ε·₯ε
· v1.2.
|
|
9061
|
+
β π PWTK θ§£ε―ε°ε·₯ε
· v1.2.31 β
|
|
9001
9062
|
β Created by Leo (@leeguoo) β
|
|
9002
9063
|
β ζζ―ζ―ζ: θ―·θη³» Leo β
|
|
9003
9064
|
β εδΊ«ζε‘: curl.bwg.leeguoo.com β
|