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

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);
@@ -7788,29 +7890,12 @@ const styles = `
7788
7890
  backdrop-filter: blur(10px) brightness(1.1);
7789
7891
  -webkit-backdrop-filter: blur(10px) brightness(1.1);
7790
7892
 
7791
- /* 多层背景 - 模拟 Liquid Glass */
7792
- background:
7793
- /* 动态光效层 */
7794
- linear-gradient(
7795
- 105deg,
7796
- transparent 35%,
7797
- rgba(255, 255, 255, 0.25) 45%,
7798
- rgba(255, 255, 255, 0.35) 50%,
7799
- rgba(255, 255, 255, 0.25) 55%,
7800
- transparent 65%
7801
- ),
7802
- /* 基础玻璃层 */
7803
- linear-gradient(
7804
- 135deg,
7805
- rgba(255, 255, 255, 0.8),
7806
- rgba(255, 255, 255, 0.6)
7807
- );
7808
-
7809
- background-size: 300% 100%, 100% 100%;
7810
- border: 1px solid rgba(255, 255, 255, 0.2);
7893
+ /* 背景极简化,避免遮挡文本 */
7894
+ background: rgba(255, 255, 255, 0.35);
7895
+ border: 1px solid rgba(255, 255, 255, 0.28);
7811
7896
  border-radius: 16px;
7812
7897
  padding: 16px;
7813
- cursor: pointer;
7898
+ cursor: default;
7814
7899
 
7815
7900
  /* 深度阴影和玻璃效果 */
7816
7901
  box-shadow:
@@ -7906,6 +7991,7 @@ const styles = `
7906
7991
  justify-content: space-between;
7907
7992
  align-items: center;
7908
7993
  margin-bottom: 4px;
7994
+ cursor: pointer;
7909
7995
  }
7910
7996
 
7911
7997
  .request-method {
@@ -7957,7 +8043,7 @@ const styles = `
7957
8043
  margin: 0 8px;
7958
8044
  word-break: break-all;
7959
8045
  white-space: normal;
7960
- color: rgba(60, 60, 67, 0.9);
8046
+ color: rgba(20, 20, 33, 0.98);
7961
8047
  font-size: 11px;
7962
8048
  line-height: 1.3;
7963
8049
  }
@@ -8104,6 +8190,7 @@ const styles = `
8104
8190
  max-height: 400px;
8105
8191
  min-height: 300px;
8106
8192
  overflow: auto;
8193
+ user-select: text;
8107
8194
 
8108
8195
  /* 内部阴影 */
8109
8196
  box-shadow:
@@ -8142,7 +8229,7 @@ const styles = `
8142
8229
  }
8143
8230
 
8144
8231
  .headers-table td {
8145
- color: rgba(60, 60, 67, 0.8);
8232
+ color: rgba(20, 20, 33, 0.85);
8146
8233
  }
8147
8234
 
8148
8235
  .decrypted-badge {
@@ -17713,6 +17800,13 @@ const _WebGLManager = class _WebGLManager {
17713
17800
  return false;
17714
17801
  }
17715
17802
  try {
17803
+ if (!this.scene) {
17804
+ console.warn("WebGL scene not ready");
17805
+ return false;
17806
+ }
17807
+ if (this.scene.getLayer(layerId)) {
17808
+ this.scene.removeLayer(layerId);
17809
+ }
17716
17810
  const layer = this.scene.createLayer(layerId, element, {
17717
17811
  zIndex: 1,
17718
17812
  quality: this.config.quality,
@@ -17820,6 +17914,8 @@ const _DebugPanel = class _DebugPanel {
17820
17914
  this.resizeTimeout = null;
17821
17915
  this.resizeDirection = "";
17822
17916
  this.requestsCache = [];
17917
+ this.filteredRequestsCache = [];
17918
+ this.searchQuery = "";
17823
17919
  this.webglManager = null;
17824
17920
  this.reopenButton = null;
17825
17921
  this.webglBackgroundUpdateTimer = null;
@@ -17879,7 +17975,7 @@ const _DebugPanel = class _DebugPanel {
17879
17975
  this.container.style.pointerEvents = "auto";
17880
17976
  this.container.innerHTML = `
17881
17977
  <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>
17978
+ <div class="debugger-title">🔓 PWTK 解密小工具 <span style="font-size: 10px; opacity: 0.7;">by Leo v${"1.2.49-beta.5"}</span></div>
17883
17979
  <div class="debugger-controls">
17884
17980
  <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
17981
  <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 +17983,14 @@ const _DebugPanel = class _DebugPanel {
17887
17983
  <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
17984
  </div>
17889
17985
  </div>
17986
+ <div class="debugger-search-bar">
17987
+ <div class="search-input-wrapper">
17988
+ <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>
17989
+ <input type="text" class="search-input" placeholder="搜索 URL、方法、状态码..." />
17990
+ <button class="search-clear-btn" title="清除搜索" style="display: none;">×</button>
17991
+ </div>
17992
+ <div class="search-stats"></div>
17993
+ </div>
17890
17994
  <div class="debugger-content">
17891
17995
  <div class="debugger-panel-content">
17892
17996
  <div class="network-panel">
@@ -17912,8 +18016,28 @@ const _DebugPanel = class _DebugPanel {
17912
18016
  bindEvents() {
17913
18017
  const header = this.shadowRoot.querySelector(".debugger-header");
17914
18018
  const controls = this.shadowRoot.querySelector(".debugger-controls");
18019
+ const searchInput = this.shadowRoot.querySelector(".search-input");
18020
+ const searchClearBtn = this.shadowRoot.querySelector(".search-clear-btn");
18021
+ searchInput.addEventListener("input", (e2) => {
18022
+ const query = e2.target.value;
18023
+ this.searchQuery = query;
18024
+ this.filterRequests();
18025
+ if (query) {
18026
+ searchClearBtn.style.display = "block";
18027
+ } else {
18028
+ searchClearBtn.style.display = "none";
18029
+ }
18030
+ });
18031
+ searchClearBtn.addEventListener("click", () => {
18032
+ searchInput.value = "";
18033
+ this.searchQuery = "";
18034
+ searchClearBtn.style.display = "none";
18035
+ this.filterRequests();
18036
+ searchInput.focus();
18037
+ });
17915
18038
  header.addEventListener("mousedown", (e2) => {
17916
18039
  if (e2.target === controls || controls.contains(e2.target)) return;
18040
+ if (e2.target.closest(".debugger-search-bar")) return;
17917
18041
  this.startDrag(e2);
17918
18042
  });
17919
18043
  controls.addEventListener("click", (e2) => {
@@ -17979,21 +18103,81 @@ const _DebugPanel = class _DebugPanel {
17979
18103
  }
17980
18104
  this.renderRequests();
17981
18105
  }
18106
+ filterRequests() {
18107
+ if (!this.searchQuery) {
18108
+ this.filteredRequestsCache = this.requestsCache;
18109
+ } else {
18110
+ const query = this.searchQuery.toLowerCase();
18111
+ this.filteredRequestsCache = this.requestsCache.filter((request) => {
18112
+ if (request.url.toLowerCase().includes(query)) return true;
18113
+ if (request.method.toLowerCase().includes(query)) return true;
18114
+ if (request.status && request.status.toString().includes(query)) return true;
18115
+ if (request.requestBody) {
18116
+ const bodyStr = typeof request.requestBody === "string" ? request.requestBody : JSON.stringify(request.requestBody);
18117
+ if (bodyStr.toLowerCase().includes(query)) return true;
18118
+ }
18119
+ if (request.responseBody) {
18120
+ const bodyStr = typeof request.responseBody === "string" ? request.responseBody : JSON.stringify(request.responseBody);
18121
+ if (bodyStr.toLowerCase().includes(query)) return true;
18122
+ }
18123
+ if (request.decryptedRequest) {
18124
+ const decryptedStr = typeof request.decryptedRequest === "string" ? request.decryptedRequest : JSON.stringify(request.decryptedRequest);
18125
+ if (decryptedStr.toLowerCase().includes(query)) return true;
18126
+ }
18127
+ if (request.decryptedResponse) {
18128
+ const decryptedStr = typeof request.decryptedResponse === "string" ? request.decryptedResponse : JSON.stringify(request.decryptedResponse);
18129
+ if (decryptedStr.toLowerCase().includes(query)) return true;
18130
+ }
18131
+ return false;
18132
+ });
18133
+ }
18134
+ this.renderRequests();
18135
+ this.updateSearchStats();
18136
+ }
18137
+ updateSearchStats() {
18138
+ const statsContainer = this.shadowRoot.querySelector(".search-stats");
18139
+ if (!statsContainer) return;
18140
+ if (this.searchQuery) {
18141
+ const total = this.requestsCache.length;
18142
+ const filtered = this.filteredRequestsCache.length;
18143
+ statsContainer.textContent = `显示 ${filtered} / ${total} 条`;
18144
+ statsContainer.style.display = "block";
18145
+ } else {
18146
+ statsContainer.textContent = "";
18147
+ statsContainer.style.display = "none";
18148
+ }
18149
+ }
17982
18150
  renderRequests() {
17983
18151
  const listContainer = this.shadowRoot.querySelector(".request-list");
17984
18152
  if (!listContainer) return;
17985
18153
  listContainer.innerHTML = "";
17986
- this.requestsCache.forEach((request, index) => {
18154
+ const requestsToRender = this.searchQuery ? this.filteredRequestsCache : this.requestsCache;
18155
+ if (requestsToRender.length === 0 && this.searchQuery) {
18156
+ const emptyMessage = document.createElement("div");
18157
+ emptyMessage.className = "empty-search-result";
18158
+ emptyMessage.innerHTML = `
18159
+ <div style="text-align: center; padding: 40px 20px; color: #999;">
18160
+ <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>
18161
+ <p>未找到匹配的请求</p>
18162
+ <p style="font-size: 12px; opacity: 0.7;">搜索:"${this.searchQuery}"</p>
18163
+ </div>
18164
+ `;
18165
+ listContainer.appendChild(emptyMessage);
18166
+ return;
18167
+ }
18168
+ requestsToRender.forEach((request, index) => {
17987
18169
  const item = this.createRequestItem(request);
17988
18170
  listContainer.appendChild(item);
17989
18171
  if (this.webglManager) {
17990
- setTimeout(() => {
18172
+ const layerId = `request-item-${index}`;
18173
+ this.webglManager.disableForElement(layerId);
18174
+ requestAnimationFrame(() => {
17991
18175
  try {
17992
- this.webglManager.enableForElement(item, `request-item-${index}`);
18176
+ this.webglManager.enableForElement(item, layerId);
17993
18177
  } catch (error) {
17994
18178
  logger.debug(`Failed to enable WebGL for request item ${index}:`, error);
17995
18179
  }
17996
- }, 100);
18180
+ });
17997
18181
  }
17998
18182
  });
17999
18183
  }
@@ -18022,38 +18206,33 @@ const _DebugPanel = class _DebugPanel {
18022
18206
  ${this.renderRequestDetails(request)}
18023
18207
  </div>
18024
18208
  `;
18025
- item.addEventListener("click", (e2) => {
18209
+ const headerEl = item.querySelector(".request-header");
18210
+ headerEl?.addEventListener("click", (e2) => {
18026
18211
  const target = e2.target;
18027
- if (target.closest(".share-btn") || target.closest(".api-curl-btn") || target.closest('.detail-title[data-toggle="collapse"]')) {
18212
+ if (target.closest(".share-btn") || target.closest(".api-curl-btn")) {
18028
18213
  return;
18029
18214
  }
18030
18215
  item.classList.toggle("expanded");
18031
18216
  });
18032
18217
  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
- }
18218
+ shareBtn?.addEventListener("click", async (e2) => {
18219
+ e2.stopPropagation();
18220
+ await this.shareRequest(request);
18221
+ });
18039
18222
  const apiCurlBtn = item.querySelector(".api-curl-btn");
18040
- if (apiCurlBtn) {
18041
- apiCurlBtn.addEventListener("click", async (e2) => {
18223
+ apiCurlBtn?.addEventListener("click", async (e2) => {
18224
+ e2.stopPropagation();
18225
+ await this.generateApiCurl(request);
18226
+ });
18227
+ const collapsibleTitles = item.querySelectorAll(".detail-section.collapsible .detail-title");
18228
+ collapsibleTitles.forEach((title) => {
18229
+ title.addEventListener("click", (e2) => {
18042
18230
  e2.stopPropagation();
18043
- await this.generateApiCurl(request);
18231
+ const detailSection = title.parentElement;
18232
+ if (!detailSection) return;
18233
+ detailSection.classList.toggle("collapsed");
18044
18234
  });
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 });
18235
+ });
18057
18236
  return item;
18058
18237
  }
18059
18238
  renderRequestDetails(request) {
@@ -18172,8 +18351,10 @@ const _DebugPanel = class _DebugPanel {
18172
18351
  // 移除 switchTab 方法 - 不再需要标签页切换
18173
18352
  clearRequests() {
18174
18353
  this.requestsCache = [];
18354
+ this.filteredRequestsCache = [];
18175
18355
  this.interceptor.clearRequests();
18176
18356
  this.renderRequests();
18357
+ this.updateSearchStats();
18177
18358
  }
18178
18359
  exportData() {
18179
18360
  const data = {
@@ -18463,7 +18644,7 @@ Created by Leo (@leeguoo)`);
18463
18644
  }
18464
18645
  this.addDragFunctionality(glassButton.element);
18465
18646
  this.reopenButton = glassButton;
18466
- console.log("[PWTK] Glass button created successfully");
18647
+ logger.debug("[PWTK] Glass button created successfully");
18467
18648
  } catch (error) {
18468
18649
  console.error("[PWTK] Failed to create glass button:", error);
18469
18650
  this.createFallbackButton();
@@ -18502,7 +18683,7 @@ Created by Leo (@leeguoo)`);
18502
18683
  btn.onclick = () => this.show();
18503
18684
  this.addDragFunctionality(btn);
18504
18685
  document.body.appendChild(btn);
18505
- console.log("[PWTK] Fallback button created");
18686
+ logger.warn("[PWTK] Fallback button created");
18506
18687
  }
18507
18688
  addDragFunctionality(element) {
18508
18689
  let isDragging = false;
@@ -18854,7 +19035,7 @@ class NetworkDebugger {
18854
19035
  this.initialized = true;
18855
19036
  logger.consoleDirect(`
18856
19037
  ╔════════════════════════════════════════╗
18857
- ║ 🔓 PWTK 解密小工具 v${"1.2.49-beta.3"} ║
19038
+ ║ 🔓 PWTK 解密小工具 v${"1.2.49-beta.5"} ║
18858
19039
  ║ Created by Leo (@leeguoo) ║
18859
19040
  ║ 技术支持: 请联系 Leo ║
18860
19041
  ║ 分享服务: curl.bwg.leeguoo.com ║
@@ -18915,7 +19096,7 @@ class NetworkDebugger {
18915
19096
  }
18916
19097
  async checkForUpdates() {
18917
19098
  try {
18918
- const currentVersion = "1.2.49-beta.3";
19099
+ const currentVersion = "1.2.49-beta.5";
18919
19100
  logger.info(`[PWTK Update] Checking for updates... Current version: ${currentVersion}`);
18920
19101
  const response = await fetch("https://registry.npmjs.org/@leeguoo/pwtk-network-debugger/latest");
18921
19102
  const data = await response.json();
@@ -18935,7 +19116,7 @@ class NetworkDebugger {
18935
19116
  logger.error("[PWTK Update] Failed to check for updates:", error);
18936
19117
  return {
18937
19118
  hasUpdate: false,
18938
- currentVersion: "1.2.49-beta.3"
19119
+ currentVersion: "1.2.49-beta.5"
18939
19120
  };
18940
19121
  }
18941
19122
  }