-
Notifications
You must be signed in to change notification settings - Fork 307
合并 main 至 v1.3 #1094
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
合并 main 至 v1.3 #1094
Conversation
* 处理GM xhr的问题
* 补上单元测试
* 恢复之前的单元测试
* 增加 readyState 判断 修复 responseText 问题
* 删除调试日志
* `${Date.now}` -> `${Date.now()}`
* 修复fetch模式下,触发 readyState==1的问题
* fetch行为与TM保持一致
* 调整测试
* 修改错误的单元测试
* GMXhr 代码修正
* 中文
* 中文
* parseType 代码改善
* 调整代码
* 加入 allowResponse 特殊处理:readyState 达至 4 之前,排除 response, responseText, responseXML
* `res.readyState === 4` -> `res.readyState === 4 || reqDone`
* Update gm_xhr.ts
* 调整代码
* typescript 调整
* 增加逻辑控制保护
* typescript 调整
* 处理共用
* 整理代码
* 修复错误
---------
Co-authored-by: cyfung1031 <44498510+cyfung1031@users.noreply.github.com>
* 处理 只显示提示,不显示感叹号 的问题 * 优化弹出窗口的userscripts提示 * 该错误为预期内情况,无需记录 debug 日志 * 通过测试 * 删除日志 * 通过测试 * default isUserScriptsAvailableState to null * 要求用户重启扩展/浏览器,会重置badge状态的 --------- Co-authored-by: cyfung1031 <44498510+cyfung1031@users.noreply.github.com>
* responseHeaders: `TM兼容: 使用 \r\n 及不包含空白` Co-Authored-By: wangyizhi <yz@ggnb.top> * 中文 * 代码调整 * added streamReader error * 代码调整 * 代码调整 * 加注释 * nativeResponseHeadersTreatment -> normalizeResponseHeaders * Update bg_gm_xhr.ts * update * 代码调整 * 代码调整 * 单元测试 * 修改 normalizeResponseHeaders 实现 --------- Co-Authored-By: wangyizhi <yz@ggnb.top>
* fix 1087 * 修改为30秒 --------- Co-authored-by: 王一之 <yz@ggnb.top>
* 更新 example/tests/gm_xhr_test.js * Update gm_xhr_test.js --------- Co-authored-by: 王一之 <yz@ggnb.top>
|
这是怎么手动合并的?怎么还有eslint错误 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
这是一次从 main 分支手动合并至 v1.3 分支的 PR,主要目的是避免自动合并可能导致的错误。此次合并包含多个重要的 bug 修复和功能改进。
主要变更:
- 修复了 GM_xmlhttpRequest 的 responseHeaders 格式问题,使其符合 TamperMonkey 的实现规范
- 修复了多处
Date.now缺少括号的 bug - 改进了类型定义,增加了更精确的类型注解
- 增强了 Popup 组件的国际化支持和状态管理
- 添加了对 chrome.action.getBadgeText 的 mock 支持
Reviewed changes
Copilot reviewed 18 out of 20 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/runtime/gm_api.test.ts | 为 GM_xmlhttpRequest 测试添加了 responseHeaders 格式验证,确保使用 \r\n 分隔且无尾随空白 |
| tests/pages/popup/App.test.tsx | 添加了 chrome.action.getBadgeText 的 mock 实现以支持测试 |
| tests/mocks/blob.ts | 更新了 Blob.stream() 的返回类型以匹配 TypeScript 的最新类型定义 |
| src/types/scriptcat.d.ts | 优化了 GM_xmlhttpRequest 响应类型定义,增加了 undefined 类型支持和更精确的泛型参数 |
| src/types/main.d.ts | 添加了 ValueOf 工具类型用于提取对象值的联合类型 |
| src/template/scriptcat.d.tpl | 同步更新类型定义模板文件 |
| src/pkg/utils/xhr/fetch_xhr.ts | 添加了 TamperMonkey 兼容性注释,更新了 ReadableStream 类型参数,增加了错误处理 |
| src/pkg/utils/xhr/bg_gm_xhr.ts | 修复了 Date.now 缺少括号的 bug,集成了 normalizeResponseHeaders 函数,移除了无用代码 |
| src/pkg/utils/utils.ts | 新增 normalizeResponseHeaders 函数用于标准化 HTTP 响应头格式 |
| src/pkg/utils/utils.test.ts | 为 normalizeResponseHeaders 添加了全面的测试用例 |
| src/pkg/utils/cron.ts | 修复了 cron 表达式解析逻辑,改进了 "once" 关键字的处理和时间格式输出 |
| src/app/service/service_worker/runtime.ts | 添加了可选链操作符以安全处理 chrome.userScripts API 可能不存在的情况 |
| src/app/service/service_worker/index.ts | 为批量更新页面添加了 autoclose 参数以改善用户体验 |
| src/app/service/service_worker/gm_api/gm_xhr.ts | 优化了 responseHeaders 的构建逻辑以符合 TamperMonkey 规范 |
| src/app/service/content/gm_api/gm_xhr.ts | 重构了响应处理逻辑,使用命名常量替代魔法数字,修复了 Date.now bug,改进了 TamperMonkey 兼容性 |
| src/pages/components/layout/PopupLayout.tsx | 添加了 ConfigProvider 以支持 Arco Design 组件的国际化 |
| src/pages/components/PopupWarnings/index.tsx | 改进了 UserScripts API 可用性检测,通过 badge 状态判断是否需要重启扩展 |
| packages/chrome-extension-mock/index.ts | 导入并注册了 Action mock 类 |
| packages/chrome-extension-mock/action.ts | 新增 Action mock 类实现 getBadgeText 方法 |
| example/tests/gm_xhr_test.js | 更新了测试脚本版本,添加了针对 bug #1078、#1080 的测试用例和 responseHeaders 格式测试 |
src/pkg/utils/utils.test.ts
Outdated
| expect(formatBytes(1536, 1)).toBe("1.5 KB"); | ||
|
|
Copilot
AI
Dec 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
此行末尾有多余的空白字符。建议删除以保持代码整洁。
| expect(formatBytes(1536, 1)).toBe("1.5 KB"); | |
| expect(formatBytes(1536, 1")).toBe("1.5 KB"); |




手动合并避免合并错误