@leeguoo/pwtk-network-debugger 1.2.41 β 1.2.42
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 +40 -10
- package/dist/index.js +3 -3
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -8286,7 +8286,7 @@ const _DebugPanel = class _DebugPanel {
|
|
|
8286
8286
|
<div class="about-panel" data-panel="about" style="display: none;">
|
|
8287
8287
|
<div style="padding: 20px; color: #fff; text-align: center;">
|
|
8288
8288
|
<h2 style="margin: 0 0 20px 0;">π PWTK θ§£ε―ε°ε·₯ε
·</h2>
|
|
8289
|
-
<p style="margin: 10px 0;">Version: ${"1.2.
|
|
8289
|
+
<p style="margin: 10px 0;">Version: ${"1.2.42"}</p>
|
|
8290
8290
|
<p style="margin: 10px 0;">π¨βπ» Created by <strong>Leo (@leeguoo)</strong></p>
|
|
8291
8291
|
<p style="margin: 10px 0;">π§ ζζ―ζ―ζοΌθ―·θη³» Leo</p>
|
|
8292
8292
|
<p style="margin: 10px 0;">π εδΊ«ζε‘οΌcurl.bwg.leeguoo.com</p>
|
|
@@ -9175,7 +9175,7 @@ class NetworkDebugger {
|
|
|
9175
9175
|
this.initialized = true;
|
|
9176
9176
|
logger.consoleDirect(`
|
|
9177
9177
|
ββββββββββββββββββββββββββββββββββββββββββ
|
|
9178
|
-
β π PWTK θ§£ε―ε°ε·₯ε
· v${"1.2.
|
|
9178
|
+
β π PWTK θ§£ε―ε°ε·₯ε
· v${"1.2.42"} β
|
|
9179
9179
|
β Created by Leo (@leeguoo) β
|
|
9180
9180
|
β ζζ―ζ―ζ: θ―·θη³» Leo β
|
|
9181
9181
|
β εδΊ«ζε‘: curl.bwg.leeguoo.com β
|
|
@@ -9236,7 +9236,7 @@ class NetworkDebugger {
|
|
|
9236
9236
|
}
|
|
9237
9237
|
async checkForUpdates() {
|
|
9238
9238
|
try {
|
|
9239
|
-
const currentVersion = "1.2.
|
|
9239
|
+
const currentVersion = "1.2.42";
|
|
9240
9240
|
logger.info(`[PWTK Update] Checking for updates... Current version: ${currentVersion}`);
|
|
9241
9241
|
const response = await fetch("https://registry.npmjs.org/@leeguoo/pwtk-network-debugger/latest");
|
|
9242
9242
|
const data = await response.json();
|
|
@@ -9256,11 +9256,11 @@ class NetworkDebugger {
|
|
|
9256
9256
|
logger.error("[PWTK Update] Failed to check for updates:", error);
|
|
9257
9257
|
return {
|
|
9258
9258
|
hasUpdate: false,
|
|
9259
|
-
currentVersion: "1.2.
|
|
9259
|
+
currentVersion: "1.2.42"
|
|
9260
9260
|
};
|
|
9261
9261
|
}
|
|
9262
9262
|
}
|
|
9263
|
-
async autoUpdate() {
|
|
9263
|
+
async autoUpdate(reloadPage = false) {
|
|
9264
9264
|
try {
|
|
9265
9265
|
const updateInfo = await this.checkForUpdates();
|
|
9266
9266
|
if (!updateInfo.hasUpdate) {
|
|
@@ -9268,12 +9268,42 @@ class NetworkDebugger {
|
|
|
9268
9268
|
return false;
|
|
9269
9269
|
}
|
|
9270
9270
|
logger.info(`[PWTK Update] Auto-updating to version ${updateInfo.latestVersion}...`);
|
|
9271
|
+
const currentConfig = { ...this.config };
|
|
9272
|
+
this.destroy();
|
|
9273
|
+
if (globalInstance === this) {
|
|
9274
|
+
globalInstance = null;
|
|
9275
|
+
if (typeof window !== "undefined") {
|
|
9276
|
+
delete window.NetworkDebugger;
|
|
9277
|
+
}
|
|
9278
|
+
}
|
|
9279
|
+
if (reloadPage) {
|
|
9280
|
+
logger.info("[PWTK Update] Reloading page to apply update...");
|
|
9281
|
+
window.location.reload();
|
|
9282
|
+
return true;
|
|
9283
|
+
}
|
|
9271
9284
|
const script = document.createElement("script");
|
|
9272
9285
|
script.src = `https://unpkg.com/@leeguoo/pwtk-network-debugger@${updateInfo.latestVersion}/dist/index.js`;
|
|
9273
9286
|
return new Promise((resolve, reject) => {
|
|
9274
|
-
script.onload = () => {
|
|
9275
|
-
|
|
9276
|
-
|
|
9287
|
+
script.onload = async () => {
|
|
9288
|
+
try {
|
|
9289
|
+
logger.info(`[PWTK Update] β
Script loaded, reinitializing with previous config...`);
|
|
9290
|
+
setTimeout(async () => {
|
|
9291
|
+
try {
|
|
9292
|
+
if (window.NetworkDebugger && window.NetworkDebugger.init) {
|
|
9293
|
+
await window.NetworkDebugger.init(currentConfig);
|
|
9294
|
+
logger.info(`[PWTK Update] β
Successfully updated to version ${updateInfo.latestVersion}`);
|
|
9295
|
+
resolve(true);
|
|
9296
|
+
} else {
|
|
9297
|
+
throw new Error("New version not properly loaded");
|
|
9298
|
+
}
|
|
9299
|
+
} catch (initError) {
|
|
9300
|
+
logger.error("[PWTK Update] β Failed to initialize new version:", initError);
|
|
9301
|
+
reject(initError);
|
|
9302
|
+
}
|
|
9303
|
+
}, 100);
|
|
9304
|
+
} catch (error) {
|
|
9305
|
+
reject(error);
|
|
9306
|
+
}
|
|
9277
9307
|
};
|
|
9278
9308
|
script.onerror = () => {
|
|
9279
9309
|
logger.error("[PWTK Update] β Failed to load updated version");
|
|
@@ -9354,8 +9384,8 @@ const NetworkDebuggerGlobal = {
|
|
|
9354
9384
|
async checkForUpdates() {
|
|
9355
9385
|
return globalInstance?.checkForUpdates() || { hasUpdate: false, currentVersion: "unknown" };
|
|
9356
9386
|
},
|
|
9357
|
-
async autoUpdate() {
|
|
9358
|
-
return globalInstance?.autoUpdate() || false;
|
|
9387
|
+
async autoUpdate(reloadPage = false) {
|
|
9388
|
+
return globalInstance?.autoUpdate(reloadPage) || false;
|
|
9359
9389
|
}
|
|
9360
9390
|
};
|
|
9361
9391
|
if (typeof window !== "undefined") {
|