@leeguoo/pwtk-network-debugger 1.2.49-beta.8 → 1.3.0
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 +2 -2
- package/dist/index.esm.js +88 -26
- package/dist/index.js +4 -4
- package/package.json +1 -1
- package/types/ui/panel.d.ts +21 -0
- package/types/ui/panel.d.ts.map +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -6797,13 +6797,13 @@ function decrypt(encryptedData, keyStr) {
|
|
|
6797
6797
|
return encryptedData;
|
|
6798
6798
|
}
|
|
6799
6799
|
class NetworkInterceptor {
|
|
6800
|
-
//
|
|
6800
|
+
// 1分钟缓存
|
|
6801
6801
|
constructor() {
|
|
6802
6802
|
this.requests = /* @__PURE__ */ new Map();
|
|
6803
6803
|
this.listeners = [];
|
|
6804
6804
|
this.decryptConfig = { enabled: false };
|
|
6805
6805
|
this.keyCache = /* @__PURE__ */ new Map();
|
|
6806
|
-
this.KEY_CACHE_TTL =
|
|
6806
|
+
this.KEY_CACHE_TTL = 1 * 60 * 1e3;
|
|
6807
6807
|
window.__originalFetch = window.fetch;
|
|
6808
6808
|
this.interceptXHR();
|
|
6809
6809
|
this.interceptFetch();
|
|
@@ -17894,6 +17894,11 @@ const _DebugPanel = class _DebugPanel {
|
|
|
17894
17894
|
this.webglManager = null;
|
|
17895
17895
|
this.reopenButton = null;
|
|
17896
17896
|
this.webglBackgroundUpdateTimer = null;
|
|
17897
|
+
this.boundHandlers = /* @__PURE__ */ new Map();
|
|
17898
|
+
this.eventListeners = [];
|
|
17899
|
+
this.renderDebounceTimer = null;
|
|
17900
|
+
this.searchDebounceTimer = null;
|
|
17901
|
+
this.pendingRenderRequests = /* @__PURE__ */ new Set();
|
|
17897
17902
|
this.interceptor = interceptor;
|
|
17898
17903
|
const savedConfig = this.loadConfig();
|
|
17899
17904
|
this.config = {
|
|
@@ -17954,7 +17959,7 @@ const _DebugPanel = class _DebugPanel {
|
|
|
17954
17959
|
this.container.style.pointerEvents = "auto";
|
|
17955
17960
|
this.container.innerHTML = `
|
|
17956
17961
|
<div class="debugger-header">
|
|
17957
|
-
<div class="debugger-title">🔓 PWTK 解密小工具 <span style="font-size: 10px; opacity: 0.7;">by Leo v${"1.
|
|
17962
|
+
<div class="debugger-title">🔓 PWTK 解密小工具 <span style="font-size: 10px; opacity: 0.7;">by Leo v${"1.3.0"}</span></div>
|
|
17958
17963
|
<div class="debugger-controls">
|
|
17959
17964
|
<button class="debugger-btn" data-action="clear" title="清空"><svg class="debugger-icon" viewBox="0 0 24 24"><path fill="currentColor" d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/></svg></button>
|
|
17960
17965
|
<button class="debugger-btn" data-action="export" title="导出"><svg class="debugger-icon" viewBox="0 0 24 24"><path fill="currentColor" d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/></svg></button>
|
|
@@ -18000,12 +18005,18 @@ const _DebugPanel = class _DebugPanel {
|
|
|
18000
18005
|
searchInput.addEventListener("input", (e2) => {
|
|
18001
18006
|
const query = e2.target.value;
|
|
18002
18007
|
this.searchQuery = query;
|
|
18003
|
-
this.filterRequests();
|
|
18004
18008
|
if (query) {
|
|
18005
18009
|
searchClearBtn.style.display = "block";
|
|
18006
18010
|
} else {
|
|
18007
18011
|
searchClearBtn.style.display = "none";
|
|
18008
18012
|
}
|
|
18013
|
+
if (this.searchDebounceTimer) {
|
|
18014
|
+
clearTimeout(this.searchDebounceTimer);
|
|
18015
|
+
}
|
|
18016
|
+
this.searchDebounceTimer = window.setTimeout(() => {
|
|
18017
|
+
this.filterRequests();
|
|
18018
|
+
this.searchDebounceTimer = null;
|
|
18019
|
+
}, 200);
|
|
18009
18020
|
});
|
|
18010
18021
|
searchClearBtn.addEventListener("click", () => {
|
|
18011
18022
|
searchInput.value = "";
|
|
@@ -18051,9 +18062,12 @@ const _DebugPanel = class _DebugPanel {
|
|
|
18051
18062
|
this.startResize(e2, direction2);
|
|
18052
18063
|
});
|
|
18053
18064
|
});
|
|
18054
|
-
|
|
18055
|
-
|
|
18056
|
-
|
|
18065
|
+
const boundMouseMove = this.handleMouseMove.bind(this);
|
|
18066
|
+
const boundMouseUp = this.handleMouseUp.bind(this);
|
|
18067
|
+
const boundWindowResize = this.handleWindowResize.bind(this);
|
|
18068
|
+
this.addEventListener(document, "mousemove", boundMouseMove);
|
|
18069
|
+
this.addEventListener(document, "mouseup", boundMouseUp);
|
|
18070
|
+
this.addEventListener(window, "resize", boundWindowResize);
|
|
18057
18071
|
}
|
|
18058
18072
|
startListening() {
|
|
18059
18073
|
this.interceptor.addListener((request) => {
|
|
@@ -18080,7 +18094,19 @@ const _DebugPanel = class _DebugPanel {
|
|
|
18080
18094
|
if (this.requestsCache.length > 100) {
|
|
18081
18095
|
this.requestsCache = this.requestsCache.slice(0, 100);
|
|
18082
18096
|
}
|
|
18083
|
-
this.
|
|
18097
|
+
this.scheduleRender();
|
|
18098
|
+
}
|
|
18099
|
+
/**
|
|
18100
|
+
* 防抖渲染 - 避免频繁的重新渲染
|
|
18101
|
+
*/
|
|
18102
|
+
scheduleRender() {
|
|
18103
|
+
if (this.renderDebounceTimer) {
|
|
18104
|
+
clearTimeout(this.renderDebounceTimer);
|
|
18105
|
+
}
|
|
18106
|
+
this.renderDebounceTimer = window.setTimeout(() => {
|
|
18107
|
+
this.renderRequests();
|
|
18108
|
+
this.renderDebounceTimer = null;
|
|
18109
|
+
}, 50);
|
|
18084
18110
|
}
|
|
18085
18111
|
filterRequests() {
|
|
18086
18112
|
if (!this.searchQuery) {
|
|
@@ -18145,25 +18171,15 @@ const _DebugPanel = class _DebugPanel {
|
|
|
18145
18171
|
return;
|
|
18146
18172
|
}
|
|
18147
18173
|
const applyItems = this.config.webgl?.applyToItems ?? false;
|
|
18174
|
+
const fragment = document.createDocumentFragment();
|
|
18148
18175
|
requestsToRender.forEach((request, index) => {
|
|
18149
18176
|
const item = this.createRequestItem(request);
|
|
18150
|
-
|
|
18151
|
-
if (this.webglManager) {
|
|
18152
|
-
|
|
18153
|
-
this.webglManager.disableForElement(layerId);
|
|
18154
|
-
if (applyItems) {
|
|
18155
|
-
requestAnimationFrame(() => {
|
|
18156
|
-
try {
|
|
18157
|
-
this.webglManager.enableForElement(item, layerId);
|
|
18158
|
-
} catch (error) {
|
|
18159
|
-
logger.debug(`Failed to enable WebGL for request item ${index}:`, error);
|
|
18160
|
-
}
|
|
18161
|
-
});
|
|
18162
|
-
} else {
|
|
18163
|
-
item.classList.add("webgl-fallback", "enhanced-css-glass");
|
|
18164
|
-
}
|
|
18177
|
+
fragment.appendChild(item);
|
|
18178
|
+
if (this.webglManager && applyItems) {
|
|
18179
|
+
item.classList.add("webgl-fallback", "enhanced-css-glass");
|
|
18165
18180
|
}
|
|
18166
18181
|
});
|
|
18182
|
+
listContainer.appendChild(fragment);
|
|
18167
18183
|
}
|
|
18168
18184
|
createRequestItem(request) {
|
|
18169
18185
|
const item = document.createElement("div");
|
|
@@ -18755,13 +18771,59 @@ Created by Leo (@leeguoo)`);
|
|
|
18755
18771
|
logger.error("[PWTK] Error removing reopen button:", error);
|
|
18756
18772
|
}
|
|
18757
18773
|
}
|
|
18774
|
+
/**
|
|
18775
|
+
* 添加可清理的事件监听器
|
|
18776
|
+
*/
|
|
18777
|
+
addEventListener(element, event, handler) {
|
|
18778
|
+
element.addEventListener(event, handler);
|
|
18779
|
+
this.eventListeners.push({ element, event, handler });
|
|
18780
|
+
}
|
|
18781
|
+
/**
|
|
18782
|
+
* 清理所有事件监听器
|
|
18783
|
+
*/
|
|
18784
|
+
removeAllEventListeners() {
|
|
18785
|
+
this.eventListeners.forEach(({ element, event, handler }) => {
|
|
18786
|
+
try {
|
|
18787
|
+
element.removeEventListener(event, handler);
|
|
18788
|
+
} catch (error) {
|
|
18789
|
+
logger.error("Failed to remove event listener:", error);
|
|
18790
|
+
}
|
|
18791
|
+
});
|
|
18792
|
+
this.eventListeners = [];
|
|
18793
|
+
}
|
|
18794
|
+
/**
|
|
18795
|
+
* 清理所有定时器
|
|
18796
|
+
*/
|
|
18797
|
+
clearAllTimers() {
|
|
18798
|
+
if (this.resizeTimeout) {
|
|
18799
|
+
clearTimeout(this.resizeTimeout);
|
|
18800
|
+
this.resizeTimeout = null;
|
|
18801
|
+
}
|
|
18802
|
+
if (this.webglBackgroundUpdateTimer) {
|
|
18803
|
+
clearInterval(this.webglBackgroundUpdateTimer);
|
|
18804
|
+
this.webglBackgroundUpdateTimer = null;
|
|
18805
|
+
}
|
|
18806
|
+
if (this.renderDebounceTimer) {
|
|
18807
|
+
clearTimeout(this.renderDebounceTimer);
|
|
18808
|
+
this.renderDebounceTimer = null;
|
|
18809
|
+
}
|
|
18810
|
+
if (this.searchDebounceTimer) {
|
|
18811
|
+
clearTimeout(this.searchDebounceTimer);
|
|
18812
|
+
this.searchDebounceTimer = null;
|
|
18813
|
+
}
|
|
18814
|
+
}
|
|
18758
18815
|
destroy() {
|
|
18816
|
+
this.removeAllEventListeners();
|
|
18817
|
+
this.clearAllTimers();
|
|
18759
18818
|
this.hostElement.remove();
|
|
18760
18819
|
this.removeReopenButton();
|
|
18761
18820
|
if (this.webglManager) {
|
|
18762
18821
|
this.webglManager.destroy();
|
|
18763
18822
|
this.webglManager = null;
|
|
18764
18823
|
}
|
|
18824
|
+
this.requestsCache = [];
|
|
18825
|
+
this.filteredRequestsCache = [];
|
|
18826
|
+
logger.debug("[PWTK] Panel destroyed and all resources cleaned up");
|
|
18765
18827
|
}
|
|
18766
18828
|
/**
|
|
18767
18829
|
* 日志输出方法 - 供 logger 调用
|
|
@@ -19069,7 +19131,7 @@ class NetworkDebugger {
|
|
|
19069
19131
|
this.initialized = true;
|
|
19070
19132
|
logger.consoleDirect(`
|
|
19071
19133
|
╔════════════════════════════════════════╗
|
|
19072
|
-
║ 🔓 PWTK 解密小工具 v${"1.
|
|
19134
|
+
║ 🔓 PWTK 解密小工具 v${"1.3.0"} ║
|
|
19073
19135
|
║ Created by Leo (@leeguoo) ║
|
|
19074
19136
|
║ 技术支持: 请联系 Leo ║
|
|
19075
19137
|
║ 分享服务: curl.bwg.leeguoo.com ║
|
|
@@ -19130,7 +19192,7 @@ class NetworkDebugger {
|
|
|
19130
19192
|
}
|
|
19131
19193
|
async checkForUpdates() {
|
|
19132
19194
|
try {
|
|
19133
|
-
const currentVersion = "1.
|
|
19195
|
+
const currentVersion = "1.3.0";
|
|
19134
19196
|
logger.info(`[PWTK Update] Checking for updates... Current version: ${currentVersion}`);
|
|
19135
19197
|
const response = await fetch("https://registry.npmjs.org/@leeguoo/pwtk-network-debugger/latest");
|
|
19136
19198
|
const data = await response.json();
|
|
@@ -19150,7 +19212,7 @@ class NetworkDebugger {
|
|
|
19150
19212
|
logger.error("[PWTK Update] Failed to check for updates:", error);
|
|
19151
19213
|
return {
|
|
19152
19214
|
hasUpdate: false,
|
|
19153
|
-
currentVersion: "1.
|
|
19215
|
+
currentVersion: "1.3.0"
|
|
19154
19216
|
};
|
|
19155
19217
|
}
|
|
19156
19218
|
}
|