@leeguoo/pwtk-network-debugger 1.2.13 → 1.2.15

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
@@ -6921,10 +6921,27 @@ class NetworkInterceptor {
6921
6921
  return originalSend.call(this, body);
6922
6922
  };
6923
6923
  xhr.addEventListener("readystatechange", function() {
6924
- if (xhr.readyState === XMLHttpRequest.DONE && !isInternalRequest) {
6924
+ console.log("[PWTK Debug] XHR state changed:", {
6925
+ readyState: xhr.readyState,
6926
+ readyStateName: ["UNSENT", "OPENED", "HEADERS_RECEIVED", "LOADING", "DONE"][xhr.readyState],
6927
+ status: xhr.status,
6928
+ isInternal: isInternalRequest,
6929
+ requestId,
6930
+ url
6931
+ });
6932
+ console.log("[PWTK Debug] Checking response condition:", {
6933
+ readyState: xhr.readyState,
6934
+ isDone: xhr.readyState === 4,
6935
+ XMLHttpRequestDONE: typeof XMLHttpRequest !== "undefined" ? XMLHttpRequest.DONE : "undefined",
6936
+ isInternal: isInternalRequest,
6937
+ shouldProcess: xhr.readyState === 4 && !isInternalRequest
6938
+ });
6939
+ if (xhr.readyState === 4 && !isInternalRequest) {
6940
+ console.log("[PWTK Debug] XHR completed, processing response");
6925
6941
  const endTime = Date.now();
6926
6942
  const requestData = self2.requests.get(requestId);
6927
6943
  if (requestData) {
6944
+ console.log("[PWTK Debug] Found request data, updating with response");
6928
6945
  requestData.status = xhr.status;
6929
6946
  requestData.statusText = xhr.statusText;
6930
6947
  requestData.duration = endTime - startTime;
@@ -6939,16 +6956,26 @@ class NetworkInterceptor {
6939
6956
  });
6940
6957
  }
6941
6958
  requestData.responseHeaders = responseHeaders;
6959
+ const hasResponseText = xhr.responseText !== null && xhr.responseText !== void 0 && xhr.responseText !== "";
6942
6960
  console.log("[PWTK Debug] XHR Response received:", {
6943
6961
  status: requestData.status,
6962
+ hasResponseText,
6944
6963
  responseTextLength: xhr.responseText?.length,
6945
6964
  responseTextPreview: xhr.responseText?.substring(0, 100)
6946
6965
  });
6947
- try {
6948
- requestData.responseBody = xhr.responseText ? JSON.parse(xhr.responseText) : null;
6949
- } catch {
6950
- requestData.responseBody = xhr.responseText;
6966
+ if (hasResponseText) {
6967
+ try {
6968
+ requestData.responseBody = JSON.parse(xhr.responseText);
6969
+ console.log("[PWTK Debug] Response parsed as JSON:", requestData.responseBody);
6970
+ } catch {
6971
+ requestData.responseBody = xhr.responseText;
6972
+ console.log("[PWTK Debug] Response kept as text");
6973
+ }
6974
+ } else {
6975
+ requestData.responseBody = null;
6976
+ console.log("[PWTK Debug] No response body");
6951
6977
  }
6978
+ console.log("[PWTK Debug] Updating request with response data");
6952
6979
  self2.requests.set(requestId, requestData);
6953
6980
  self2.notifyListeners(requestData);
6954
6981
  if (requestData.responseBody) {
@@ -6961,6 +6988,8 @@ class NetworkInterceptor {
6961
6988
  }
6962
6989
  }).catch((e) => console.warn("解密响应失败:", e));
6963
6990
  }
6991
+ } else {
6992
+ console.log("[PWTK Debug] WARNING: Request data not found for ID:", requestId);
6964
6993
  }
6965
6994
  }
6966
6995
  });
@@ -7997,7 +8026,7 @@ class DebugPanel {
7997
8026
  <div class="about-panel" data-panel="about" style="display: none;">
7998
8027
  <div style="padding: 20px; color: #fff; text-align: center;">
7999
8028
  <h2 style="margin: 0 0 20px 0;">🔓 PWTK 解密小工具</h2>
8000
- <p style="margin: 10px 0;">Version: 1.2.13</p>
8029
+ <p style="margin: 10px 0;">Version: 1.2.14</p>
8001
8030
  <p style="margin: 10px 0;">👨‍💻 Created by <strong>Leo (@leeguoo)</strong></p>
8002
8031
  <p style="margin: 10px 0;">📧 技术支持:请联系 Leo</p>
8003
8032
  <p style="margin: 10px 0;">🌐 分享服务:curl.bwg.leeguoo.com</p>
@@ -8614,7 +8643,7 @@ class NetworkDebugger {
8614
8643
  this.initialized = true;
8615
8644
  console.log(`
8616
8645
  ╔════════════════════════════════════════╗
8617
- ║ 🔓 PWTK 解密小工具 v1.2.13
8646
+ ║ 🔓 PWTK 解密小工具 v1.2.15
8618
8647
  ║ Created by Leo (@leeguoo) ║
8619
8648
  ║ 技术支持: 请联系 Leo ║
8620
8649
  ║ 分享服务: curl.bwg.leeguoo.com ║