@leeguoo/pwtk-network-debugger 1.2.45 → 1.2.47
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 -37
- package/dist/index.js +3 -3
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -7953,21 +7953,21 @@ const styles = `
|
|
|
7953
7953
|
}
|
|
7954
7954
|
}
|
|
7955
7955
|
|
|
7956
|
-
::-webkit-scrollbar {
|
|
7956
|
+
#network-debugger-panel ::-webkit-scrollbar {
|
|
7957
7957
|
width: 6px;
|
|
7958
7958
|
height: 6px;
|
|
7959
7959
|
}
|
|
7960
7960
|
|
|
7961
|
-
::-webkit-scrollbar-track {
|
|
7961
|
+
#network-debugger-panel ::-webkit-scrollbar-track {
|
|
7962
7962
|
background: #333;
|
|
7963
7963
|
}
|
|
7964
7964
|
|
|
7965
|
-
::-webkit-scrollbar-thumb {
|
|
7965
|
+
#network-debugger-panel ::-webkit-scrollbar-thumb {
|
|
7966
7966
|
background: #666;
|
|
7967
7967
|
border-radius: 3px;
|
|
7968
7968
|
}
|
|
7969
7969
|
|
|
7970
|
-
::-webkit-scrollbar-thumb:hover {
|
|
7970
|
+
#network-debugger-panel ::-webkit-scrollbar-thumb:hover {
|
|
7971
7971
|
background: #888;
|
|
7972
7972
|
}
|
|
7973
7973
|
|
|
@@ -8251,6 +8251,7 @@ const _DebugPanel = class _DebugPanel {
|
|
|
8251
8251
|
theme: "dark",
|
|
8252
8252
|
minimized: false,
|
|
8253
8253
|
showConsole: true,
|
|
8254
|
+
isClosed: false,
|
|
8254
8255
|
...savedConfig,
|
|
8255
8256
|
// 先应用保存的配置
|
|
8256
8257
|
...config
|
|
@@ -8261,17 +8262,22 @@ const _DebugPanel = class _DebugPanel {
|
|
|
8261
8262
|
this.startListening();
|
|
8262
8263
|
logger.setPanel(this);
|
|
8263
8264
|
this.loadPosition();
|
|
8265
|
+
if (this.config.isClosed) {
|
|
8266
|
+
this.hide();
|
|
8267
|
+
}
|
|
8264
8268
|
}
|
|
8265
8269
|
createPanel() {
|
|
8266
|
-
|
|
8267
|
-
|
|
8268
|
-
|
|
8269
|
-
|
|
8270
|
-
|
|
8271
|
-
|
|
8270
|
+
this.hostElement = document.createElement("div");
|
|
8271
|
+
this.hostElement.id = "network-debugger-host";
|
|
8272
|
+
this.hostElement.style.cssText = "all: initial; position: absolute; top: 0; left: 0; pointer-events: none;";
|
|
8273
|
+
this.shadowRoot = this.hostElement.attachShadow({ mode: "closed" });
|
|
8274
|
+
const styleEl = document.createElement("style");
|
|
8275
|
+
styleEl.textContent = styles;
|
|
8276
|
+
this.shadowRoot.appendChild(styleEl);
|
|
8272
8277
|
this.container = document.createElement("div");
|
|
8273
8278
|
this.container.id = "network-debugger-panel";
|
|
8274
8279
|
this.container.className = `${this.config.position} ${this.config.minimized ? "minimized" : ""}`;
|
|
8280
|
+
this.container.style.pointerEvents = "auto";
|
|
8275
8281
|
this.container.innerHTML = `
|
|
8276
8282
|
<div class="debugger-header">
|
|
8277
8283
|
<div class="debugger-title">🔓 PWTK 解密小工具 <span style="font-size: 10px; opacity: 0.7;">by Leo</span></div>
|
|
@@ -8318,7 +8324,7 @@ const _DebugPanel = class _DebugPanel {
|
|
|
8318
8324
|
<div class="about-panel" data-panel="about" style="display: none;">
|
|
8319
8325
|
<div style="padding: 20px; color: #fff; text-align: center;">
|
|
8320
8326
|
<h2 style="margin: 0 0 20px 0;">🔓 PWTK 解密小工具</h2>
|
|
8321
|
-
<p style="margin: 10px 0;">Version: ${"1.2.
|
|
8327
|
+
<p style="margin: 10px 0;">Version: ${"1.2.47"}</p>
|
|
8322
8328
|
<p style="margin: 10px 0;">👨💻 Created by <strong>Leo (@leeguoo)</strong></p>
|
|
8323
8329
|
<p style="margin: 10px 0;">📧 技术支持:请联系 Leo</p>
|
|
8324
8330
|
<p style="margin: 10px 0;">🌐 分享服务:curl.bwg.leeguoo.com</p>
|
|
@@ -8332,10 +8338,11 @@ const _DebugPanel = class _DebugPanel {
|
|
|
8332
8338
|
</div>
|
|
8333
8339
|
`;
|
|
8334
8340
|
this.addResizeHandles();
|
|
8335
|
-
|
|
8336
|
-
|
|
8337
|
-
this.
|
|
8338
|
-
this.
|
|
8341
|
+
this.shadowRoot.appendChild(this.container);
|
|
8342
|
+
document.body.appendChild(this.hostElement);
|
|
8343
|
+
this.networkTab = this.shadowRoot.querySelector('[data-panel="network"]');
|
|
8344
|
+
this.consoleTab = this.shadowRoot.querySelector('[data-panel="console"]');
|
|
8345
|
+
this.consoleContent = this.shadowRoot.querySelector(".console-content");
|
|
8339
8346
|
}
|
|
8340
8347
|
addResizeHandles() {
|
|
8341
8348
|
const handles = ["n", "s", "e", "w", "ne", "nw", "se", "sw"];
|
|
@@ -8347,11 +8354,11 @@ const _DebugPanel = class _DebugPanel {
|
|
|
8347
8354
|
});
|
|
8348
8355
|
}
|
|
8349
8356
|
bindEvents() {
|
|
8350
|
-
const header = this.
|
|
8351
|
-
const controls = this.
|
|
8352
|
-
const tabs = this.
|
|
8353
|
-
const toolButtons = this.
|
|
8354
|
-
const consoleInput = this.
|
|
8357
|
+
const header = this.shadowRoot.querySelector(".debugger-header");
|
|
8358
|
+
const controls = this.shadowRoot.querySelector(".debugger-controls");
|
|
8359
|
+
const tabs = this.shadowRoot.querySelectorAll(".debugger-tab");
|
|
8360
|
+
const toolButtons = this.shadowRoot.querySelectorAll("[data-tool]");
|
|
8361
|
+
const consoleInput = this.shadowRoot.querySelector(".console-cmd");
|
|
8355
8362
|
header.addEventListener("mousedown", (e) => {
|
|
8356
8363
|
if (e.target === controls || controls.contains(e.target)) return;
|
|
8357
8364
|
this.startDrag(e);
|
|
@@ -8402,7 +8409,7 @@ const _DebugPanel = class _DebugPanel {
|
|
|
8402
8409
|
}
|
|
8403
8410
|
});
|
|
8404
8411
|
}
|
|
8405
|
-
const resizeHandles = this.
|
|
8412
|
+
const resizeHandles = this.shadowRoot.querySelectorAll(".resize-handle");
|
|
8406
8413
|
resizeHandles.forEach((handle) => {
|
|
8407
8414
|
handle.addEventListener("mousedown", (e) => {
|
|
8408
8415
|
e.stopPropagation();
|
|
@@ -8442,7 +8449,7 @@ const _DebugPanel = class _DebugPanel {
|
|
|
8442
8449
|
this.renderRequests();
|
|
8443
8450
|
}
|
|
8444
8451
|
renderRequests() {
|
|
8445
|
-
const listContainer = this.
|
|
8452
|
+
const listContainer = this.shadowRoot.querySelector(".request-list");
|
|
8446
8453
|
if (!listContainer) return;
|
|
8447
8454
|
listContainer.innerHTML = "";
|
|
8448
8455
|
this.requestsCache.forEach((request) => {
|
|
@@ -8623,10 +8630,10 @@ const _DebugPanel = class _DebugPanel {
|
|
|
8623
8630
|
return url;
|
|
8624
8631
|
}
|
|
8625
8632
|
switchTab(tabName) {
|
|
8626
|
-
this.
|
|
8633
|
+
this.shadowRoot.querySelectorAll(".debugger-tab").forEach((tab) => {
|
|
8627
8634
|
tab.classList.toggle("active", tab.dataset.tab === tabName);
|
|
8628
8635
|
});
|
|
8629
|
-
this.
|
|
8636
|
+
this.shadowRoot.querySelectorAll("[data-panel]").forEach((panel) => {
|
|
8630
8637
|
const panelEl = panel;
|
|
8631
8638
|
panelEl.style.display = panel.getAttribute("data-panel") === tabName ? "block" : "none";
|
|
8632
8639
|
});
|
|
@@ -8720,7 +8727,7 @@ Created by Leo (@leeguoo)`);
|
|
|
8720
8727
|
}
|
|
8721
8728
|
}
|
|
8722
8729
|
handleToolAction(tool) {
|
|
8723
|
-
const textarea = this.
|
|
8730
|
+
const textarea = this.shadowRoot.querySelector(".tools-content textarea");
|
|
8724
8731
|
const input = textarea.value.trim();
|
|
8725
8732
|
switch (tool) {
|
|
8726
8733
|
case "parse-curl":
|
|
@@ -8970,20 +8977,37 @@ Created by Leo (@leeguoo)`);
|
|
|
8970
8977
|
}
|
|
8971
8978
|
}
|
|
8972
8979
|
show() {
|
|
8973
|
-
this.
|
|
8980
|
+
this.hostElement.style.display = "block";
|
|
8981
|
+
this.config.isClosed = false;
|
|
8982
|
+
this.saveConfig();
|
|
8974
8983
|
this.removeReopenButton();
|
|
8975
8984
|
}
|
|
8976
8985
|
hide() {
|
|
8977
|
-
this.
|
|
8986
|
+
this.hostElement.style.display = "none";
|
|
8987
|
+
this.config.isClosed = true;
|
|
8988
|
+
this.saveConfig();
|
|
8978
8989
|
this.createReopenButton();
|
|
8979
8990
|
}
|
|
8980
8991
|
createReopenButton() {
|
|
8981
8992
|
if (document.getElementById("network-debugger-reopen-btn")) return;
|
|
8982
8993
|
const btn = document.createElement("button");
|
|
8983
8994
|
btn.id = "network-debugger-reopen-btn";
|
|
8984
|
-
btn.className = "debugger-reopen-btn";
|
|
8985
8995
|
btn.title = "打开调试面板 (可拖动)";
|
|
8986
8996
|
btn.textContent = "PWTK";
|
|
8997
|
+
btn.style.cssText = `
|
|
8998
|
+
position: fixed;
|
|
8999
|
+
z-index: 999999;
|
|
9000
|
+
background: #4CAF50;
|
|
9001
|
+
color: #000;
|
|
9002
|
+
border: none;
|
|
9003
|
+
padding: 8px 10px;
|
|
9004
|
+
border-radius: 16px;
|
|
9005
|
+
font-weight: bold;
|
|
9006
|
+
font-size: 12px;
|
|
9007
|
+
box-shadow: 0 4px 12px rgba(0,0,0,0.25);
|
|
9008
|
+
cursor: pointer;
|
|
9009
|
+
transition: filter 0.2s;
|
|
9010
|
+
`;
|
|
8987
9011
|
const pos = this.config.position || "bottom-right";
|
|
8988
9012
|
if (pos.includes("bottom")) {
|
|
8989
9013
|
btn.style.bottom = "20px";
|
|
@@ -9036,14 +9060,19 @@ Created by Leo (@leeguoo)`);
|
|
|
9036
9060
|
if (isDragging) {
|
|
9037
9061
|
isDragging = false;
|
|
9038
9062
|
btn.style.cursor = "pointer";
|
|
9039
|
-
btn.style.transition = "
|
|
9063
|
+
btn.style.transition = "filter 0.2s";
|
|
9040
9064
|
} else {
|
|
9041
9065
|
this.show();
|
|
9042
9066
|
}
|
|
9043
9067
|
};
|
|
9044
9068
|
document.addEventListener("mousemove", handleMouseMove);
|
|
9045
9069
|
document.addEventListener("mouseup", handleMouseUp);
|
|
9046
|
-
btn.
|
|
9070
|
+
btn.addEventListener("mouseenter", () => {
|
|
9071
|
+
btn.style.filter = "brightness(0.95)";
|
|
9072
|
+
});
|
|
9073
|
+
btn.addEventListener("mouseleave", () => {
|
|
9074
|
+
btn.style.filter = "brightness(1)";
|
|
9075
|
+
});
|
|
9047
9076
|
document.body.appendChild(btn);
|
|
9048
9077
|
}
|
|
9049
9078
|
removeReopenButton() {
|
|
@@ -9051,9 +9080,7 @@ Created by Leo (@leeguoo)`);
|
|
|
9051
9080
|
if (btn) btn.remove();
|
|
9052
9081
|
}
|
|
9053
9082
|
destroy() {
|
|
9054
|
-
this.
|
|
9055
|
-
const styles2 = document.getElementById("network-debugger-styles");
|
|
9056
|
-
if (styles2) styles2.remove();
|
|
9083
|
+
this.hostElement.remove();
|
|
9057
9084
|
this.removeReopenButton();
|
|
9058
9085
|
}
|
|
9059
9086
|
// ========== localStorage 方法 ==========
|
|
@@ -9082,7 +9109,8 @@ Created by Leo (@leeguoo)`);
|
|
|
9082
9109
|
position: this.config.position,
|
|
9083
9110
|
theme: this.config.theme,
|
|
9084
9111
|
minimized: this.config.minimized,
|
|
9085
|
-
showConsole: this.config.showConsole
|
|
9112
|
+
showConsole: this.config.showConsole,
|
|
9113
|
+
isClosed: this.config.isClosed
|
|
9086
9114
|
};
|
|
9087
9115
|
localStorage.setItem(_DebugPanel.STORAGE_KEY, JSON.stringify(configToSave));
|
|
9088
9116
|
logger.debug("配置已保存:", configToSave);
|
|
@@ -9207,7 +9235,7 @@ class NetworkDebugger {
|
|
|
9207
9235
|
this.initialized = true;
|
|
9208
9236
|
logger.consoleDirect(`
|
|
9209
9237
|
╔════════════════════════════════════════╗
|
|
9210
|
-
║ 🔓 PWTK 解密小工具 v${"1.2.
|
|
9238
|
+
║ 🔓 PWTK 解密小工具 v${"1.2.47"} ║
|
|
9211
9239
|
║ Created by Leo (@leeguoo) ║
|
|
9212
9240
|
║ 技术支持: 请联系 Leo ║
|
|
9213
9241
|
║ 分享服务: curl.bwg.leeguoo.com ║
|
|
@@ -9268,7 +9296,7 @@ class NetworkDebugger {
|
|
|
9268
9296
|
}
|
|
9269
9297
|
async checkForUpdates() {
|
|
9270
9298
|
try {
|
|
9271
|
-
const currentVersion = "1.2.
|
|
9299
|
+
const currentVersion = "1.2.47";
|
|
9272
9300
|
logger.info(`[PWTK Update] Checking for updates... Current version: ${currentVersion}`);
|
|
9273
9301
|
const response = await fetch("https://registry.npmjs.org/@leeguoo/pwtk-network-debugger/latest");
|
|
9274
9302
|
const data = await response.json();
|
|
@@ -9288,7 +9316,7 @@ class NetworkDebugger {
|
|
|
9288
9316
|
logger.error("[PWTK Update] Failed to check for updates:", error);
|
|
9289
9317
|
return {
|
|
9290
9318
|
hasUpdate: false,
|
|
9291
|
-
currentVersion: "1.2.
|
|
9319
|
+
currentVersion: "1.2.47"
|
|
9292
9320
|
};
|
|
9293
9321
|
}
|
|
9294
9322
|
}
|