@leeguoo/pwtk-network-debugger 1.2.36 → 1.2.38
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 +72 -3
- package/dist/index.js +3 -3
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -7844,6 +7844,28 @@ const styles = `
|
|
|
7844
7844
|
transform: scale(0.95);
|
|
7845
7845
|
}
|
|
7846
7846
|
|
|
7847
|
+
.api-curl-btn {
|
|
7848
|
+
background: #4CAF50;
|
|
7849
|
+
color: #fff;
|
|
7850
|
+
border: none;
|
|
7851
|
+
padding: 4px 10px;
|
|
7852
|
+
border-radius: 3px;
|
|
7853
|
+
font-size: 11px;
|
|
7854
|
+
margin-left: 8px;
|
|
7855
|
+
cursor: pointer;
|
|
7856
|
+
transition: all 0.2s;
|
|
7857
|
+
white-space: nowrap;
|
|
7858
|
+
}
|
|
7859
|
+
|
|
7860
|
+
.api-curl-btn:hover {
|
|
7861
|
+
background: #45a049;
|
|
7862
|
+
transform: scale(1.1);
|
|
7863
|
+
}
|
|
7864
|
+
|
|
7865
|
+
.api-curl-btn:active {
|
|
7866
|
+
transform: scale(0.95);
|
|
7867
|
+
}
|
|
7868
|
+
|
|
7847
7869
|
.console-content {
|
|
7848
7870
|
background: #000;
|
|
7849
7871
|
color: #0f0;
|
|
@@ -8142,6 +8164,24 @@ function formatAsCurl(requestData) {
|
|
|
8142
8164
|
}
|
|
8143
8165
|
return curl;
|
|
8144
8166
|
}
|
|
8167
|
+
function formatAsApiCurl(requestData) {
|
|
8168
|
+
let curl = `curl 'https://api.httpmisonote.com'`;
|
|
8169
|
+
if (requestData.method !== "GET") {
|
|
8170
|
+
curl += ` -X ${requestData.method}`;
|
|
8171
|
+
}
|
|
8172
|
+
if (requestData.headers) {
|
|
8173
|
+
Object.entries(requestData.headers).forEach(([key, value]) => {
|
|
8174
|
+
curl += ` -H '${key}: ${value}'`;
|
|
8175
|
+
});
|
|
8176
|
+
}
|
|
8177
|
+
curl += ` -H 'X-API-Key: test-api-key-123'`;
|
|
8178
|
+
const requestBody = requestData.decryptedRequest || requestData.requestBody;
|
|
8179
|
+
if (requestBody) {
|
|
8180
|
+
const body = typeof requestBody === "string" ? requestBody : JSON.stringify(requestBody);
|
|
8181
|
+
curl += ` --data '${body}'`;
|
|
8182
|
+
}
|
|
8183
|
+
return curl;
|
|
8184
|
+
}
|
|
8145
8185
|
const _DebugPanel = class _DebugPanel {
|
|
8146
8186
|
constructor(interceptor, config = {}) {
|
|
8147
8187
|
this.isDragging = false;
|
|
@@ -8226,7 +8266,7 @@ const _DebugPanel = class _DebugPanel {
|
|
|
8226
8266
|
<div class="about-panel" data-panel="about" style="display: none;">
|
|
8227
8267
|
<div style="padding: 20px; color: #fff; text-align: center;">
|
|
8228
8268
|
<h2 style="margin: 0 0 20px 0;">🔓 PWTK 解密小工具</h2>
|
|
8229
|
-
<p style="margin: 10px 0;">Version: ${"1.2.
|
|
8269
|
+
<p style="margin: 10px 0;">Version: ${"1.2.38"}</p>
|
|
8230
8270
|
<p style="margin: 10px 0;">👨💻 Created by <strong>Leo (@leeguoo)</strong></p>
|
|
8231
8271
|
<p style="margin: 10px 0;">📧 技术支持:请联系 Leo</p>
|
|
8232
8272
|
<p style="margin: 10px 0;">🌐 分享服务:curl.bwg.leeguoo.com</p>
|
|
@@ -8373,6 +8413,7 @@ const _DebugPanel = class _DebugPanel {
|
|
|
8373
8413
|
<span class="request-status ${statusClass}">${request.status ? request.status : request.duration !== void 0 ? "ERR" : "Pending"}</span>
|
|
8374
8414
|
${hasError ? '<span class="error-badge">⚠️</span>' : ""}
|
|
8375
8415
|
<button class="share-btn" title="分享此请求 (by Leo)" onclick="event.stopPropagation()">分享链接</button>
|
|
8416
|
+
<button class="api-curl-btn" title="生成API请求 (by Leo)" onclick="event.stopPropagation()">API Curl</button>
|
|
8376
8417
|
</div>
|
|
8377
8418
|
<div class="request-info">
|
|
8378
8419
|
<span>${new Date(request.timestamp).toLocaleTimeString()}</span>
|
|
@@ -8384,7 +8425,7 @@ const _DebugPanel = class _DebugPanel {
|
|
|
8384
8425
|
`;
|
|
8385
8426
|
item.addEventListener("click", (e) => {
|
|
8386
8427
|
const target = e.target;
|
|
8387
|
-
if (target.closest(".share-btn") || target.closest('.detail-title[data-toggle="collapse"]')) {
|
|
8428
|
+
if (target.closest(".share-btn") || target.closest(".api-curl-btn") || target.closest('.detail-title[data-toggle="collapse"]')) {
|
|
8388
8429
|
return;
|
|
8389
8430
|
}
|
|
8390
8431
|
item.classList.toggle("expanded");
|
|
@@ -8396,6 +8437,13 @@ const _DebugPanel = class _DebugPanel {
|
|
|
8396
8437
|
await this.shareRequest(request);
|
|
8397
8438
|
});
|
|
8398
8439
|
}
|
|
8440
|
+
const apiCurlBtn = item.querySelector(".api-curl-btn");
|
|
8441
|
+
if (apiCurlBtn) {
|
|
8442
|
+
apiCurlBtn.addEventListener("click", async (e) => {
|
|
8443
|
+
e.stopPropagation();
|
|
8444
|
+
await this.generateApiCurl(request);
|
|
8445
|
+
});
|
|
8446
|
+
}
|
|
8399
8447
|
item.addEventListener("click", (e) => {
|
|
8400
8448
|
const target = e.target;
|
|
8401
8449
|
if (target.closest('.detail-title[data-toggle="collapse"]')) {
|
|
@@ -8580,6 +8628,27 @@ Created by Leo (@leeguoo)`);
|
|
|
8580
8628
|
alert("分享失败,请稍后重试");
|
|
8581
8629
|
}
|
|
8582
8630
|
}
|
|
8631
|
+
async generateApiCurl(request) {
|
|
8632
|
+
try {
|
|
8633
|
+
this.logToConsole("🔧 正在生成API cURL命令...");
|
|
8634
|
+
const curlCommand = formatAsApiCurl(request);
|
|
8635
|
+
const copied = await copyToClipboard(curlCommand);
|
|
8636
|
+
if (copied) {
|
|
8637
|
+
this.logToConsole(`✅ API cURL已复制到剪贴板`);
|
|
8638
|
+
alert(`API cURL命令已复制到剪贴板!
|
|
8639
|
+
适用于 httpmisonote.com API
|
|
8640
|
+
|
|
8641
|
+
Created by Leo (@leeguoo)`);
|
|
8642
|
+
} else {
|
|
8643
|
+
this.logToConsole(`✅ API cURL: ${curlCommand}`);
|
|
8644
|
+
prompt("API cURL命令已生成,请手动复制:\n\nCreated by Leo (@leeguoo)", curlCommand);
|
|
8645
|
+
}
|
|
8646
|
+
} catch (error) {
|
|
8647
|
+
logger.error("生成API cURL失败:", error);
|
|
8648
|
+
this.logToConsole(`❌ 生成API cURL失败: ${error}`);
|
|
8649
|
+
alert("生成API cURL失败,请稍后重试");
|
|
8650
|
+
}
|
|
8651
|
+
}
|
|
8583
8652
|
toggleFullscreen() {
|
|
8584
8653
|
if (this.container.classList.contains("fullscreen")) {
|
|
8585
8654
|
this.container.classList.remove("fullscreen");
|
|
@@ -9086,7 +9155,7 @@ class NetworkDebugger {
|
|
|
9086
9155
|
this.initialized = true;
|
|
9087
9156
|
logger.consoleDirect(`
|
|
9088
9157
|
╔════════════════════════════════════════╗
|
|
9089
|
-
║ 🔓 PWTK 解密小工具 v${"1.2.
|
|
9158
|
+
║ 🔓 PWTK 解密小工具 v${"1.2.38"} ║
|
|
9090
9159
|
║ Created by Leo (@leeguoo) ║
|
|
9091
9160
|
║ 技术支持: 请联系 Leo ║
|
|
9092
9161
|
║ 分享服务: curl.bwg.leeguoo.com ║
|