@leeguoo/pwtk-network-debugger 1.2.49-beta.3 → 1.2.49-beta.4

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
@@ -7693,6 +7693,108 @@ const styles = `
7693
7693
  z-index: 3;
7694
7694
  }
7695
7695
 
7696
+ /* 搜索栏样式 */
7697
+ .debugger-search-bar {
7698
+ padding: 8px 15px;
7699
+ backdrop-filter: blur(10px) brightness(1.08);
7700
+ -webkit-backdrop-filter: blur(10px) brightness(1.08);
7701
+ background: linear-gradient(
7702
+ 135deg,
7703
+ rgba(255, 255, 255, 0.5),
7704
+ rgba(255, 255, 255, 0.3)
7705
+ );
7706
+ border-bottom: 1px solid rgba(255, 255, 255, 0.2);
7707
+ display: flex;
7708
+ align-items: center;
7709
+ gap: 10px;
7710
+ position: relative;
7711
+ z-index: 5;
7712
+ }
7713
+
7714
+ .search-input-wrapper {
7715
+ flex: 1;
7716
+ position: relative;
7717
+ display: flex;
7718
+ align-items: center;
7719
+ background: rgba(255, 255, 255, 0.7);
7720
+ border: 1px solid rgba(0, 0, 0, 0.08);
7721
+ border-radius: 12px;
7722
+ padding: 6px 12px;
7723
+ transition: all 0.2s ease;
7724
+ box-shadow:
7725
+ inset 0 1px 3px rgba(0, 0, 0, 0.08),
7726
+ 0 1px 1px rgba(255, 255, 255, 0.5);
7727
+ }
7728
+
7729
+ .search-input-wrapper:focus-within {
7730
+ background: rgba(255, 255, 255, 0.9);
7731
+ border-color: rgba(0, 122, 255, 0.3);
7732
+ box-shadow:
7733
+ inset 0 1px 3px rgba(0, 0, 0, 0.1),
7734
+ 0 0 0 3px rgba(0, 122, 255, 0.1);
7735
+ }
7736
+
7737
+ .search-icon {
7738
+ margin-right: 6px;
7739
+ opacity: 0.5;
7740
+ flex-shrink: 0;
7741
+ }
7742
+
7743
+ .search-input {
7744
+ flex: 1;
7745
+ border: none;
7746
+ background: transparent;
7747
+ color: rgba(60, 60, 67, 0.9);
7748
+ font-size: 13px;
7749
+ outline: none;
7750
+ font-family: inherit;
7751
+ }
7752
+
7753
+ .search-input::placeholder {
7754
+ color: rgba(60, 60, 67, 0.5);
7755
+ }
7756
+
7757
+ .search-clear-btn {
7758
+ background: rgba(0, 0, 0, 0.05);
7759
+ border: none;
7760
+ border-radius: 50%;
7761
+ width: 20px;
7762
+ height: 20px;
7763
+ display: flex;
7764
+ align-items: center;
7765
+ justify-content: center;
7766
+ cursor: pointer;
7767
+ color: rgba(60, 60, 67, 0.7);
7768
+ font-size: 16px;
7769
+ line-height: 1;
7770
+ padding: 0;
7771
+ margin-left: 4px;
7772
+ flex-shrink: 0;
7773
+ transition: all 0.2s ease;
7774
+ }
7775
+
7776
+ .search-clear-btn:hover {
7777
+ background: rgba(0, 0, 0, 0.1);
7778
+ color: rgba(60, 60, 67, 0.9);
7779
+ }
7780
+
7781
+ .search-stats {
7782
+ color: rgba(60, 60, 67, 0.7);
7783
+ font-size: 12px;
7784
+ white-space: nowrap;
7785
+ display: none;
7786
+ }
7787
+
7788
+ /* 空搜索结果样式 */
7789
+ .empty-search-result {
7790
+ padding: 20px;
7791
+ }
7792
+
7793
+ .empty-search-result svg {
7794
+ display: block;
7795
+ margin: 0 auto;
7796
+ }
7797
+
7696
7798
  .debugger-btn {
7697
7799
  /* 按钮毛玻璃效果但保证可见性 */
7698
7800
  backdrop-filter: blur(8px);
@@ -7810,7 +7912,7 @@ const styles = `
7810
7912
  border: 1px solid rgba(255, 255, 255, 0.2);
7811
7913
  border-radius: 16px;
7812
7914
  padding: 16px;
7813
- cursor: pointer;
7915
+ cursor: default;
7814
7916
 
7815
7917
  /* 深度阴影和玻璃效果 */
7816
7918
  box-shadow:
@@ -7906,6 +8008,7 @@ const styles = `
7906
8008
  justify-content: space-between;
7907
8009
  align-items: center;
7908
8010
  margin-bottom: 4px;
8011
+ cursor: pointer;
7909
8012
  }
7910
8013
 
7911
8014
  .request-method {
@@ -8104,6 +8207,7 @@ const styles = `
8104
8207
  max-height: 400px;
8105
8208
  min-height: 300px;
8106
8209
  overflow: auto;
8210
+ user-select: text;
8107
8211
 
8108
8212
  /* 内部阴影 */
8109
8213
  box-shadow:
@@ -17713,6 +17817,13 @@ const _WebGLManager = class _WebGLManager {
17713
17817
  return false;
17714
17818
  }
17715
17819
  try {
17820
+ if (!this.scene) {
17821
+ console.warn("WebGL scene not ready");
17822
+ return false;
17823
+ }
17824
+ if (this.scene.getLayer(layerId)) {
17825
+ this.scene.removeLayer(layerId);
17826
+ }
17716
17827
  const layer = this.scene.createLayer(layerId, element, {
17717
17828
  zIndex: 1,
17718
17829
  quality: this.config.quality,
@@ -17820,6 +17931,8 @@ const _DebugPanel = class _DebugPanel {
17820
17931
  this.resizeTimeout = null;
17821
17932
  this.resizeDirection = "";
17822
17933
  this.requestsCache = [];
17934
+ this.filteredRequestsCache = [];
17935
+ this.searchQuery = "";
17823
17936
  this.webglManager = null;
17824
17937
  this.reopenButton = null;
17825
17938
  this.webglBackgroundUpdateTimer = null;
@@ -17879,7 +17992,7 @@ const _DebugPanel = class _DebugPanel {
17879
17992
  this.container.style.pointerEvents = "auto";
17880
17993
  this.container.innerHTML = `
17881
17994
  <div class="debugger-header">
17882
- <div class="debugger-title">🔓 PWTK 解密小工具 <span style="font-size: 10px; opacity: 0.7;">by Leo v${"1.2.49-beta.3"}</span></div>
17995
+ <div class="debugger-title">🔓 PWTK 解密小工具 <span style="font-size: 10px; opacity: 0.7;">by Leo v${"1.2.49-beta.4"}</span></div>
17883
17996
  <div class="debugger-controls">
17884
17997
  <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>
17885
17998
  <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>
@@ -17887,6 +18000,14 @@ const _DebugPanel = class _DebugPanel {
17887
18000
  <button class="debugger-btn" data-action="close" title="关闭"><svg class="debugger-icon" viewBox="0 0 24 24"><path fill="currentColor" d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg></button>
17888
18001
  </div>
17889
18002
  </div>
18003
+ <div class="debugger-search-bar">
18004
+ <div class="search-input-wrapper">
18005
+ <svg class="search-icon" viewBox="0 0 24 24" width="16" height="16"><path fill="currentColor" d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/></svg>
18006
+ <input type="text" class="search-input" placeholder="搜索 URL、方法、状态码..." />
18007
+ <button class="search-clear-btn" title="清除搜索" style="display: none;">×</button>
18008
+ </div>
18009
+ <div class="search-stats"></div>
18010
+ </div>
17890
18011
  <div class="debugger-content">
17891
18012
  <div class="debugger-panel-content">
17892
18013
  <div class="network-panel">
@@ -17912,8 +18033,28 @@ const _DebugPanel = class _DebugPanel {
17912
18033
  bindEvents() {
17913
18034
  const header = this.shadowRoot.querySelector(".debugger-header");
17914
18035
  const controls = this.shadowRoot.querySelector(".debugger-controls");
18036
+ const searchInput = this.shadowRoot.querySelector(".search-input");
18037
+ const searchClearBtn = this.shadowRoot.querySelector(".search-clear-btn");
18038
+ searchInput.addEventListener("input", (e2) => {
18039
+ const query = e2.target.value;
18040
+ this.searchQuery = query;
18041
+ this.filterRequests();
18042
+ if (query) {
18043
+ searchClearBtn.style.display = "block";
18044
+ } else {
18045
+ searchClearBtn.style.display = "none";
18046
+ }
18047
+ });
18048
+ searchClearBtn.addEventListener("click", () => {
18049
+ searchInput.value = "";
18050
+ this.searchQuery = "";
18051
+ searchClearBtn.style.display = "none";
18052
+ this.filterRequests();
18053
+ searchInput.focus();
18054
+ });
17915
18055
  header.addEventListener("mousedown", (e2) => {
17916
18056
  if (e2.target === controls || controls.contains(e2.target)) return;
18057
+ if (e2.target.closest(".debugger-search-bar")) return;
17917
18058
  this.startDrag(e2);
17918
18059
  });
17919
18060
  controls.addEventListener("click", (e2) => {
@@ -17979,21 +18120,81 @@ const _DebugPanel = class _DebugPanel {
17979
18120
  }
17980
18121
  this.renderRequests();
17981
18122
  }
18123
+ filterRequests() {
18124
+ if (!this.searchQuery) {
18125
+ this.filteredRequestsCache = this.requestsCache;
18126
+ } else {
18127
+ const query = this.searchQuery.toLowerCase();
18128
+ this.filteredRequestsCache = this.requestsCache.filter((request) => {
18129
+ if (request.url.toLowerCase().includes(query)) return true;
18130
+ if (request.method.toLowerCase().includes(query)) return true;
18131
+ if (request.status && request.status.toString().includes(query)) return true;
18132
+ if (request.requestBody) {
18133
+ const bodyStr = typeof request.requestBody === "string" ? request.requestBody : JSON.stringify(request.requestBody);
18134
+ if (bodyStr.toLowerCase().includes(query)) return true;
18135
+ }
18136
+ if (request.responseBody) {
18137
+ const bodyStr = typeof request.responseBody === "string" ? request.responseBody : JSON.stringify(request.responseBody);
18138
+ if (bodyStr.toLowerCase().includes(query)) return true;
18139
+ }
18140
+ if (request.decryptedRequest) {
18141
+ const decryptedStr = typeof request.decryptedRequest === "string" ? request.decryptedRequest : JSON.stringify(request.decryptedRequest);
18142
+ if (decryptedStr.toLowerCase().includes(query)) return true;
18143
+ }
18144
+ if (request.decryptedResponse) {
18145
+ const decryptedStr = typeof request.decryptedResponse === "string" ? request.decryptedResponse : JSON.stringify(request.decryptedResponse);
18146
+ if (decryptedStr.toLowerCase().includes(query)) return true;
18147
+ }
18148
+ return false;
18149
+ });
18150
+ }
18151
+ this.renderRequests();
18152
+ this.updateSearchStats();
18153
+ }
18154
+ updateSearchStats() {
18155
+ const statsContainer = this.shadowRoot.querySelector(".search-stats");
18156
+ if (!statsContainer) return;
18157
+ if (this.searchQuery) {
18158
+ const total = this.requestsCache.length;
18159
+ const filtered = this.filteredRequestsCache.length;
18160
+ statsContainer.textContent = `显示 ${filtered} / ${total} 条`;
18161
+ statsContainer.style.display = "block";
18162
+ } else {
18163
+ statsContainer.textContent = "";
18164
+ statsContainer.style.display = "none";
18165
+ }
18166
+ }
17982
18167
  renderRequests() {
17983
18168
  const listContainer = this.shadowRoot.querySelector(".request-list");
17984
18169
  if (!listContainer) return;
17985
18170
  listContainer.innerHTML = "";
17986
- this.requestsCache.forEach((request, index) => {
18171
+ const requestsToRender = this.searchQuery ? this.filteredRequestsCache : this.requestsCache;
18172
+ if (requestsToRender.length === 0 && this.searchQuery) {
18173
+ const emptyMessage = document.createElement("div");
18174
+ emptyMessage.className = "empty-search-result";
18175
+ emptyMessage.innerHTML = `
18176
+ <div style="text-align: center; padding: 40px 20px; color: #999;">
18177
+ <svg viewBox="0 0 24 24" width="48" height="48" style="opacity: 0.5; margin-bottom: 10px;"><path fill="currentColor" d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/></svg>
18178
+ <p>未找到匹配的请求</p>
18179
+ <p style="font-size: 12px; opacity: 0.7;">搜索:"${this.searchQuery}"</p>
18180
+ </div>
18181
+ `;
18182
+ listContainer.appendChild(emptyMessage);
18183
+ return;
18184
+ }
18185
+ requestsToRender.forEach((request, index) => {
17987
18186
  const item = this.createRequestItem(request);
17988
18187
  listContainer.appendChild(item);
17989
18188
  if (this.webglManager) {
17990
- setTimeout(() => {
18189
+ const layerId = `request-item-${index}`;
18190
+ this.webglManager.disableForElement(layerId);
18191
+ requestAnimationFrame(() => {
17991
18192
  try {
17992
- this.webglManager.enableForElement(item, `request-item-${index}`);
18193
+ this.webglManager.enableForElement(item, layerId);
17993
18194
  } catch (error) {
17994
18195
  logger.debug(`Failed to enable WebGL for request item ${index}:`, error);
17995
18196
  }
17996
- }, 100);
18197
+ });
17997
18198
  }
17998
18199
  });
17999
18200
  }
@@ -18022,38 +18223,33 @@ const _DebugPanel = class _DebugPanel {
18022
18223
  ${this.renderRequestDetails(request)}
18023
18224
  </div>
18024
18225
  `;
18025
- item.addEventListener("click", (e2) => {
18226
+ const headerEl = item.querySelector(".request-header");
18227
+ headerEl?.addEventListener("click", (e2) => {
18026
18228
  const target = e2.target;
18027
- if (target.closest(".share-btn") || target.closest(".api-curl-btn") || target.closest('.detail-title[data-toggle="collapse"]')) {
18229
+ if (target.closest(".share-btn") || target.closest(".api-curl-btn")) {
18028
18230
  return;
18029
18231
  }
18030
18232
  item.classList.toggle("expanded");
18031
18233
  });
18032
18234
  const shareBtn = item.querySelector(".share-btn");
18033
- if (shareBtn) {
18034
- shareBtn.addEventListener("click", async (e2) => {
18035
- e2.stopPropagation();
18036
- await this.shareRequest(request);
18037
- });
18038
- }
18235
+ shareBtn?.addEventListener("click", async (e2) => {
18236
+ e2.stopPropagation();
18237
+ await this.shareRequest(request);
18238
+ });
18039
18239
  const apiCurlBtn = item.querySelector(".api-curl-btn");
18040
- if (apiCurlBtn) {
18041
- apiCurlBtn.addEventListener("click", async (e2) => {
18240
+ apiCurlBtn?.addEventListener("click", async (e2) => {
18241
+ e2.stopPropagation();
18242
+ await this.generateApiCurl(request);
18243
+ });
18244
+ const collapsibleTitles = item.querySelectorAll(".detail-section.collapsible .detail-title");
18245
+ collapsibleTitles.forEach((title) => {
18246
+ title.addEventListener("click", (e2) => {
18042
18247
  e2.stopPropagation();
18043
- await this.generateApiCurl(request);
18248
+ const detailSection = title.parentElement;
18249
+ if (!detailSection) return;
18250
+ detailSection.classList.toggle("collapsed");
18044
18251
  });
18045
- }
18046
- item.addEventListener("click", (e2) => {
18047
- const target = e2.target;
18048
- if (target.closest('.detail-title[data-toggle="collapse"]')) {
18049
- e2.stopPropagation();
18050
- const detailTitle = target.closest(".detail-title");
18051
- const detailSection = detailTitle.parentElement;
18052
- if (detailSection && detailSection.classList.contains("collapsible")) {
18053
- detailSection.classList.toggle("collapsed");
18054
- }
18055
- }
18056
- }, { capture: true });
18252
+ });
18057
18253
  return item;
18058
18254
  }
18059
18255
  renderRequestDetails(request) {
@@ -18172,8 +18368,10 @@ const _DebugPanel = class _DebugPanel {
18172
18368
  // 移除 switchTab 方法 - 不再需要标签页切换
18173
18369
  clearRequests() {
18174
18370
  this.requestsCache = [];
18371
+ this.filteredRequestsCache = [];
18175
18372
  this.interceptor.clearRequests();
18176
18373
  this.renderRequests();
18374
+ this.updateSearchStats();
18177
18375
  }
18178
18376
  exportData() {
18179
18377
  const data = {
@@ -18854,7 +19052,7 @@ class NetworkDebugger {
18854
19052
  this.initialized = true;
18855
19053
  logger.consoleDirect(`
18856
19054
  ╔════════════════════════════════════════╗
18857
- ║ 🔓 PWTK 解密小工具 v${"1.2.49-beta.3"} ║
19055
+ ║ 🔓 PWTK 解密小工具 v${"1.2.49-beta.4"} ║
18858
19056
  ║ Created by Leo (@leeguoo) ║
18859
19057
  ║ 技术支持: 请联系 Leo ║
18860
19058
  ║ 分享服务: curl.bwg.leeguoo.com ║
@@ -18915,7 +19113,7 @@ class NetworkDebugger {
18915
19113
  }
18916
19114
  async checkForUpdates() {
18917
19115
  try {
18918
- const currentVersion = "1.2.49-beta.3";
19116
+ const currentVersion = "1.2.49-beta.4";
18919
19117
  logger.info(`[PWTK Update] Checking for updates... Current version: ${currentVersion}`);
18920
19118
  const response = await fetch("https://registry.npmjs.org/@leeguoo/pwtk-network-debugger/latest");
18921
19119
  const data = await response.json();
@@ -18935,7 +19133,7 @@ class NetworkDebugger {
18935
19133
  logger.error("[PWTK Update] Failed to check for updates:", error);
18936
19134
  return {
18937
19135
  hasUpdate: false,
18938
- currentVersion: "1.2.49-beta.3"
19136
+ currentVersion: "1.2.49-beta.4"
18939
19137
  };
18940
19138
  }
18941
19139
  }