@leeguoo/pwtk-network-debugger 1.2.49-beta.8 → 1.2.49-beta.9

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.esm.js CHANGED
@@ -6797,13 +6797,13 @@ function decrypt(encryptedData, keyStr) {
6797
6797
  return encryptedData;
6798
6798
  }
6799
6799
  class NetworkInterceptor {
6800
- // 5分钟缓存
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 = 5 * 60 * 1e3;
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,8 @@ 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 = [];
17897
17899
  this.interceptor = interceptor;
17898
17900
  const savedConfig = this.loadConfig();
17899
17901
  this.config = {
@@ -17954,7 +17956,7 @@ const _DebugPanel = class _DebugPanel {
17954
17956
  this.container.style.pointerEvents = "auto";
17955
17957
  this.container.innerHTML = `
17956
17958
  <div class="debugger-header">
17957
- <div class="debugger-title">🔓 PWTK 解密小工具 <span style="font-size: 10px; opacity: 0.7;">by Leo v${"1.2.49-beta.8"}</span></div>
17959
+ <div class="debugger-title">🔓 PWTK 解密小工具 <span style="font-size: 10px; opacity: 0.7;">by Leo v${"1.2.49-beta.9"}</span></div>
17958
17960
  <div class="debugger-controls">
17959
17961
  <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
17962
  <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>
@@ -18051,9 +18053,12 @@ const _DebugPanel = class _DebugPanel {
18051
18053
  this.startResize(e2, direction2);
18052
18054
  });
18053
18055
  });
18054
- document.addEventListener("mousemove", this.handleMouseMove.bind(this));
18055
- document.addEventListener("mouseup", this.handleMouseUp.bind(this));
18056
- window.addEventListener("resize", this.handleWindowResize.bind(this));
18056
+ const boundMouseMove = this.handleMouseMove.bind(this);
18057
+ const boundMouseUp = this.handleMouseUp.bind(this);
18058
+ const boundWindowResize = this.handleWindowResize.bind(this);
18059
+ this.addEventListener(document, "mousemove", boundMouseMove);
18060
+ this.addEventListener(document, "mouseup", boundMouseUp);
18061
+ this.addEventListener(window, "resize", boundWindowResize);
18057
18062
  }
18058
18063
  startListening() {
18059
18064
  this.interceptor.addListener((request) => {
@@ -18755,13 +18760,51 @@ Created by Leo (@leeguoo)`);
18755
18760
  logger.error("[PWTK] Error removing reopen button:", error);
18756
18761
  }
18757
18762
  }
18763
+ /**
18764
+ * 添加可清理的事件监听器
18765
+ */
18766
+ addEventListener(element, event, handler) {
18767
+ element.addEventListener(event, handler);
18768
+ this.eventListeners.push({ element, event, handler });
18769
+ }
18770
+ /**
18771
+ * 清理所有事件监听器
18772
+ */
18773
+ removeAllEventListeners() {
18774
+ this.eventListeners.forEach(({ element, event, handler }) => {
18775
+ try {
18776
+ element.removeEventListener(event, handler);
18777
+ } catch (error) {
18778
+ logger.error("Failed to remove event listener:", error);
18779
+ }
18780
+ });
18781
+ this.eventListeners = [];
18782
+ }
18783
+ /**
18784
+ * 清理所有定时器
18785
+ */
18786
+ clearAllTimers() {
18787
+ if (this.resizeTimeout) {
18788
+ clearTimeout(this.resizeTimeout);
18789
+ this.resizeTimeout = null;
18790
+ }
18791
+ if (this.webglBackgroundUpdateTimer) {
18792
+ clearInterval(this.webglBackgroundUpdateTimer);
18793
+ this.webglBackgroundUpdateTimer = null;
18794
+ }
18795
+ }
18758
18796
  destroy() {
18797
+ this.removeAllEventListeners();
18798
+ this.clearAllTimers();
18759
18799
  this.hostElement.remove();
18760
18800
  this.removeReopenButton();
18761
18801
  if (this.webglManager) {
18762
18802
  this.webglManager.destroy();
18763
18803
  this.webglManager = null;
18764
18804
  }
18805
+ this.requestsCache = [];
18806
+ this.filteredRequestsCache = [];
18807
+ logger.debug("[PWTK] Panel destroyed and all resources cleaned up");
18765
18808
  }
18766
18809
  /**
18767
18810
  * 日志输出方法 - 供 logger 调用
@@ -19069,7 +19112,7 @@ class NetworkDebugger {
19069
19112
  this.initialized = true;
19070
19113
  logger.consoleDirect(`
19071
19114
  ╔════════════════════════════════════════╗
19072
- ║ 🔓 PWTK 解密小工具 v${"1.2.49-beta.8"} ║
19115
+ ║ 🔓 PWTK 解密小工具 v${"1.2.49-beta.9"} ║
19073
19116
  ║ Created by Leo (@leeguoo) ║
19074
19117
  ║ 技术支持: 请联系 Leo ║
19075
19118
  ║ 分享服务: curl.bwg.leeguoo.com ║
@@ -19130,7 +19173,7 @@ class NetworkDebugger {
19130
19173
  }
19131
19174
  async checkForUpdates() {
19132
19175
  try {
19133
- const currentVersion = "1.2.49-beta.8";
19176
+ const currentVersion = "1.2.49-beta.9";
19134
19177
  logger.info(`[PWTK Update] Checking for updates... Current version: ${currentVersion}`);
19135
19178
  const response = await fetch("https://registry.npmjs.org/@leeguoo/pwtk-network-debugger/latest");
19136
19179
  const data = await response.json();
@@ -19150,7 +19193,7 @@ class NetworkDebugger {
19150
19193
  logger.error("[PWTK Update] Failed to check for updates:", error);
19151
19194
  return {
19152
19195
  hasUpdate: false,
19153
- currentVersion: "1.2.49-beta.8"
19196
+ currentVersion: "1.2.49-beta.9"
19154
19197
  };
19155
19198
  }
19156
19199
  }