From d4c8ef107ad0d0835863b21f240d44402e949584 Mon Sep 17 00:00:00 2001
From: tuqin <tuqin@tuqin.cn>
Date: 星期四, 05 十一月 2026 17:09:17 +0800
Subject: [PATCH] fix(map): 代理转发 Referer / Origin;诊断页增加错误来源抓取

---
 public/bmap-test.html |   52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 52 insertions(+), 0 deletions(-)

diff --git a/public/bmap-test.html b/public/bmap-test.html
index a46a39e..b3a278f 100644
--- a/public/bmap-test.html
+++ b/public/bmap-test.html
@@ -192,5 +192,57 @@
         document.body.appendChild(s);
       })();
     </script>
+
+    <hr style="margin:24px 0" />
+    <h3>閿欒鏉ユ簮鎶撳彇锛圧eferer 220 瀹氫綅锛�</h3>
+    <div style="padding:8px;background:#fff2f0;border-radius:6px;font-size:13px;margin-bottom:8px">
+      杩欎竴鍧椾細鎷︽埅鐧惧害 SDK 鐨勫脊绐楀憡璀︼紝骞惰褰曟墍鏈夊け璐ヨ姹傦紝鐢ㄦ潵瀹氫綅 220 鍒板簳鏉ヨ嚜鍝釜鍩熷悕銆�
+    </div>
+    <div id="log4" style="padding:12px;background:#fff7e6;border-radius:6px;font-family:Consolas,monospace;font-size:13px;line-height:1.9;white-space:pre-wrap;word-break:break-all"></div>
+    <script>
+      (function () {
+        var el = document.getElementById('log4');
+        function lg(msg, cls) {
+          var t = new Date().toLocaleTimeString('zh-CN', { hour12: false });
+          var d = document.createElement('div');
+          d.className = cls || '';
+          d.textContent = '[' + t + '] ' + msg;
+          el.appendChild(d);
+        }
+        // 1) 鎷︽埅 alert锛堢櫨搴� SDK 鎶� 220 鏃舵槸寮� alert锛�
+        var origAlert = window.alert;
+        window.alert = function (msg) {
+          lg('馃毃 鐧惧害寮圭獥: ' + msg, 'bad');
+          return origAlert.apply(window, arguments);
+        };
+        // 2) 璁板綍鎵�鏈夋寚鍚� /bmap- 鐨勫け璐ヨ姹�
+        var origFetch = window.fetch;
+        if (origFetch) {
+          window.fetch = function (input, init) {
+            var url = typeof input === 'string' ? input : (input && input.url);
+            return origFetch.apply(this, arguments).then(function (res) {
+              if (!res.ok && String(url).indexOf('/bmap-') >= 0) {
+                lg('fetch 澶辫触 ' + res.status + ' ' + url, 'bad');
+              }
+              return res;
+            }).catch(function (e) {
+              if (String(url).indexOf('/bmap-') >= 0) { lg('fetch 寮傚父 ' + url + ' : ' + e.message, 'bad'); }
+              throw e;
+            });
+          };
+        }
+        // 3) 璁板綍鍥剧墖/鑴氭湰鍔犺浇澶辫触锛堢摝鐗囨槸 img锛�
+        document.addEventListener('error', function (e) {
+          var t = e.target;
+          if (!t) { return; }
+          var u = t.src || t.href || '';
+          if (String(u).indexOf('/bmap-') >= 0) {
+            lg('璧勬簮鍔犺浇澶辫触 <' + t.tagName + '> ' + u.slice(0, 120), 'bad');
+          }
+        }, true);
+        lg('宸插紑濮嬬洃鍚�傜幇鍦ㄦ妸涓婇潰鐨勫湴鍥惧潡鍔犺浇涓�閬嶏紝杩欓噷浼氳褰曞け璐ユ潵婧愩��');
+        lg('锛堝鏋滆繖閲屾病鏈変换浣曡褰曪紝璇存槑 220 鏉ヨ嚜鐧惧害 SDK 鍐呴儴 alert锛岃鐪嬫湁娌℃湁銆岀櫨搴﹀脊绐椼�嶈锛�');
+      })();
+    </script>
   </body>
 </html>

--
Gitblit v1.9.3