@leeguoo/pwtk-network-debugger 1.2.41 β 1.2.43
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 +65 -13
- package/dist/index.js +3 -3
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -8165,7 +8165,30 @@ function formatAsCurl(requestData) {
|
|
|
8165
8165
|
return curl;
|
|
8166
8166
|
}
|
|
8167
8167
|
function formatAsApiCurl(requestData) {
|
|
8168
|
-
let
|
|
8168
|
+
let baseUrl = "https://api.httpmisonote.com";
|
|
8169
|
+
const requestBody = requestData.decryptedRequest || requestData.requestBody;
|
|
8170
|
+
if (requestData.method === "GET" && requestBody) {
|
|
8171
|
+
try {
|
|
8172
|
+
let params = {};
|
|
8173
|
+
if (typeof requestBody === "string") {
|
|
8174
|
+
params = JSON.parse(requestBody);
|
|
8175
|
+
} else {
|
|
8176
|
+
params = requestBody;
|
|
8177
|
+
}
|
|
8178
|
+
const queryParams = new URLSearchParams();
|
|
8179
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
8180
|
+
queryParams.append(key, String(value));
|
|
8181
|
+
});
|
|
8182
|
+
if (queryParams.toString()) {
|
|
8183
|
+
baseUrl += "?" + queryParams.toString();
|
|
8184
|
+
}
|
|
8185
|
+
} catch (error) {
|
|
8186
|
+
if (typeof requestBody === "string" && requestBody.trim()) {
|
|
8187
|
+
baseUrl += "?" + requestBody;
|
|
8188
|
+
}
|
|
8189
|
+
}
|
|
8190
|
+
}
|
|
8191
|
+
let curl = `curl '${baseUrl}'`;
|
|
8169
8192
|
if (requestData.method !== "GET") {
|
|
8170
8193
|
curl += ` -X ${requestData.method}`;
|
|
8171
8194
|
}
|
|
@@ -8195,8 +8218,7 @@ function formatAsApiCurl(requestData) {
|
|
|
8195
8218
|
});
|
|
8196
8219
|
}
|
|
8197
8220
|
curl += ` -H 'X-API-Key: test-api-key-123'`;
|
|
8198
|
-
|
|
8199
|
-
if (requestBody) {
|
|
8221
|
+
if (requestData.method !== "GET" && requestBody) {
|
|
8200
8222
|
const body = typeof requestBody === "string" ? requestBody : JSON.stringify(requestBody);
|
|
8201
8223
|
curl += ` --data '${body}'`;
|
|
8202
8224
|
}
|
|
@@ -8286,7 +8308,7 @@ const _DebugPanel = class _DebugPanel {
|
|
|
8286
8308
|
<div class="about-panel" data-panel="about" style="display: none;">
|
|
8287
8309
|
<div style="padding: 20px; color: #fff; text-align: center;">
|
|
8288
8310
|
<h2 style="margin: 0 0 20px 0;">π PWTK θ§£ε―ε°ε·₯ε
·</h2>
|
|
8289
|
-
<p style="margin: 10px 0;">Version: ${"1.2.
|
|
8311
|
+
<p style="margin: 10px 0;">Version: ${"1.2.43"}</p>
|
|
8290
8312
|
<p style="margin: 10px 0;">π¨βπ» Created by <strong>Leo (@leeguoo)</strong></p>
|
|
8291
8313
|
<p style="margin: 10px 0;">π§ ζζ―ζ―ζοΌθ―·θη³» Leo</p>
|
|
8292
8314
|
<p style="margin: 10px 0;">π εδΊ«ζε‘οΌcurl.bwg.leeguoo.com</p>
|
|
@@ -9175,7 +9197,7 @@ class NetworkDebugger {
|
|
|
9175
9197
|
this.initialized = true;
|
|
9176
9198
|
logger.consoleDirect(`
|
|
9177
9199
|
ββββββββββββββββββββββββββββββββββββββββββ
|
|
9178
|
-
β π PWTK θ§£ε―ε°ε·₯ε
· v${"1.2.
|
|
9200
|
+
β π PWTK θ§£ε―ε°ε·₯ε
· v${"1.2.43"} β
|
|
9179
9201
|
β Created by Leo (@leeguoo) β
|
|
9180
9202
|
β ζζ―ζ―ζ: θ―·θη³» Leo β
|
|
9181
9203
|
β εδΊ«ζε‘: curl.bwg.leeguoo.com β
|
|
@@ -9236,7 +9258,7 @@ class NetworkDebugger {
|
|
|
9236
9258
|
}
|
|
9237
9259
|
async checkForUpdates() {
|
|
9238
9260
|
try {
|
|
9239
|
-
const currentVersion = "1.2.
|
|
9261
|
+
const currentVersion = "1.2.43";
|
|
9240
9262
|
logger.info(`[PWTK Update] Checking for updates... Current version: ${currentVersion}`);
|
|
9241
9263
|
const response = await fetch("https://registry.npmjs.org/@leeguoo/pwtk-network-debugger/latest");
|
|
9242
9264
|
const data = await response.json();
|
|
@@ -9256,11 +9278,11 @@ class NetworkDebugger {
|
|
|
9256
9278
|
logger.error("[PWTK Update] Failed to check for updates:", error);
|
|
9257
9279
|
return {
|
|
9258
9280
|
hasUpdate: false,
|
|
9259
|
-
currentVersion: "1.2.
|
|
9281
|
+
currentVersion: "1.2.43"
|
|
9260
9282
|
};
|
|
9261
9283
|
}
|
|
9262
9284
|
}
|
|
9263
|
-
async autoUpdate() {
|
|
9285
|
+
async autoUpdate(reloadPage = false) {
|
|
9264
9286
|
try {
|
|
9265
9287
|
const updateInfo = await this.checkForUpdates();
|
|
9266
9288
|
if (!updateInfo.hasUpdate) {
|
|
@@ -9268,12 +9290,42 @@ class NetworkDebugger {
|
|
|
9268
9290
|
return false;
|
|
9269
9291
|
}
|
|
9270
9292
|
logger.info(`[PWTK Update] Auto-updating to version ${updateInfo.latestVersion}...`);
|
|
9293
|
+
const currentConfig = { ...this.config };
|
|
9294
|
+
this.destroy();
|
|
9295
|
+
if (globalInstance === this) {
|
|
9296
|
+
globalInstance = null;
|
|
9297
|
+
if (typeof window !== "undefined") {
|
|
9298
|
+
delete window.NetworkDebugger;
|
|
9299
|
+
}
|
|
9300
|
+
}
|
|
9301
|
+
if (reloadPage) {
|
|
9302
|
+
logger.info("[PWTK Update] Reloading page to apply update...");
|
|
9303
|
+
window.location.reload();
|
|
9304
|
+
return true;
|
|
9305
|
+
}
|
|
9271
9306
|
const script = document.createElement("script");
|
|
9272
9307
|
script.src = `https://unpkg.com/@leeguoo/pwtk-network-debugger@${updateInfo.latestVersion}/dist/index.js`;
|
|
9273
9308
|
return new Promise((resolve, reject) => {
|
|
9274
|
-
script.onload = () => {
|
|
9275
|
-
|
|
9276
|
-
|
|
9309
|
+
script.onload = async () => {
|
|
9310
|
+
try {
|
|
9311
|
+
logger.info(`[PWTK Update] β
Script loaded, reinitializing with previous config...`);
|
|
9312
|
+
setTimeout(async () => {
|
|
9313
|
+
try {
|
|
9314
|
+
if (window.NetworkDebugger && window.NetworkDebugger.init) {
|
|
9315
|
+
await window.NetworkDebugger.init(currentConfig);
|
|
9316
|
+
logger.info(`[PWTK Update] β
Successfully updated to version ${updateInfo.latestVersion}`);
|
|
9317
|
+
resolve(true);
|
|
9318
|
+
} else {
|
|
9319
|
+
throw new Error("New version not properly loaded");
|
|
9320
|
+
}
|
|
9321
|
+
} catch (initError) {
|
|
9322
|
+
logger.error("[PWTK Update] β Failed to initialize new version:", initError);
|
|
9323
|
+
reject(initError);
|
|
9324
|
+
}
|
|
9325
|
+
}, 100);
|
|
9326
|
+
} catch (error) {
|
|
9327
|
+
reject(error);
|
|
9328
|
+
}
|
|
9277
9329
|
};
|
|
9278
9330
|
script.onerror = () => {
|
|
9279
9331
|
logger.error("[PWTK Update] β Failed to load updated version");
|
|
@@ -9354,8 +9406,8 @@ const NetworkDebuggerGlobal = {
|
|
|
9354
9406
|
async checkForUpdates() {
|
|
9355
9407
|
return globalInstance?.checkForUpdates() || { hasUpdate: false, currentVersion: "unknown" };
|
|
9356
9408
|
},
|
|
9357
|
-
async autoUpdate() {
|
|
9358
|
-
return globalInstance?.autoUpdate() || false;
|
|
9409
|
+
async autoUpdate(reloadPage = false) {
|
|
9410
|
+
return globalInstance?.autoUpdate(reloadPage) || false;
|
|
9359
9411
|
}
|
|
9360
9412
|
};
|
|
9361
9413
|
if (typeof window !== "undefined") {
|