浏览代码

不默认用fetch兜底,做jsonformat,免得类似phpmyadmin之类的页面出现登录异常

zxlie 1 年之前
父节点
当前提交
fac36e667e
共有 4 个文件被更改,包括 17 次插入16 次删除
  1. 16 15
      apps/json-format/content-script.js
  2. 1 1
      apps/manifest.json
  3. 二进制
      output-edge/fehelper.zip
  4. 二进制
      output/fehelper.zip

+ 16 - 15
apps/json-format/content-script.js

@@ -639,21 +639,22 @@ window.JsonAutoFormat = (() => {
         if (source) {
             _formatTheSource(source);
         }else{
-            fetch(location.href)
-            .then(response => response.text())
-            .then(html => {
-                // 使用 DOMParser 解析 HTML
-                const parser = new DOMParser();
-                const doc = parser.parseFromString(html, "text/html");
-
-                // 移除不需要的标签
-                doc.querySelectorAll('style, script').forEach(el => el.remove());
-                const text = _getJsonContentFromDOM(doc.body);
-                if(text){
-                    _formatTheSource(text);
-                }
-            })
-            .catch();
+            // 原计划,是兜底走fetch的方式,再尝试做一次格式化,但是这里会有很多corner Case我没法回归,所以注释掉
+            // fetch(location.href)
+            // .then(response => response.text())
+            // .then(html => {
+            //     // 使用 DOMParser 解析 HTML
+            //     const parser = new DOMParser();
+            //     const doc = parser.parseFromString(html, "text/html");
+
+            //     // 移除不需要的标签
+            //     doc.querySelectorAll('style, script').forEach(el => el.remove());
+            //     const text = _getJsonContentFromDOM(doc.body);
+            //     if(text){
+            //         _formatTheSource(text);
+            //     }
+            // })
+            // .catch();
         }
     };
 

+ 1 - 1
apps/manifest.json

@@ -1,7 +1,7 @@
 {
   "name": "FeHelper(前端助手)-Dev",
   "short_name": "FeHelper",
-  "version": "2025.03.2818",
+  "version": "2025.03.3120",
   "manifest_version": 3,
   "description": "JSON自动格式化、手动格式化,支持排序、解码、下载等,更多功能可在配置页按需安装!",
   "icons": {

二进制
output-edge/fehelper.zip


二进制
output/fehelper.zip