Skip to content

Conversation

@cyfung1031
Copy link
Collaborator

@cyfung1031 cyfung1031 commented Nov 6, 2025

毕竟还是有人在用 Firefox,需要更新一下 MV2
先更新一部份

之后再把 UI 的部份 和 GM API 的 GM.setValue/GM.getValue/GM.listValue ... 更新一下

有 npm run test 和 npm run build 过。可以在 Firefox 运行


85b48e2

2518722

fb3d132

5089b2a

@cyfung1031 cyfung1031 added the MV2 label Nov 6, 2025
@CodFrm
Copy link
Member

CodFrm commented Nov 7, 2025

感谢🙏,我这两天更新到firefox去

@CodFrm CodFrm requested a review from Copilot November 7, 2025 02:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

这个PR主要进行了以下改进:

  • 修复了API类型定义中的拼写错误(minetype → mimetype)
  • 添加了文件名清理功能以处理非法字符
  • 增强了脚本验证逻辑,包括@grant冲突检测和元数据重复检测
  • 将错误消息国际化(i18n)
  • 更新了UI文本和翻译
  • 升级了多个依赖包版本

Reviewed Changes

Copilot reviewed 17 out of 19 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/types/scriptcat.d.ts 修复GM_setClipboard API中的拼写错误
src/runtime/content/gm_api.ts 同步修复API实现中的拼写错误
src/runtime/background/gm_api.ts 添加文件名清理功能到下载API
src/pkg/utils/utils.ts 新增cleanFileName函数
src/pkg/utils/script.ts 添加脚本验证、i18n错误消息、编辑器选项
src/template/normal.tpl 添加默认元数据标签
src/pages/options/routes/script/ScriptEditor.tsx 传递编辑器标志
src/pages/options/routes/ScriptList.tsx UI改进和拖拽限制
src/locales/* 统一翻译键名并添加新错误消息
package.json 升级依赖包版本

Comment on lines +201 to +202
const hasGrantConflict = (metadata: SCMetadata | undefined | null) =>
metadata?.grant?.includes("none") && metadata?.grant?.some((s: string) => s.startsWith("GM"));
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@grant检测逻辑不准确。应检查"none"字符串,但some条件会匹配任何GM开头的grant(包括合法的GMC_等)。建议改为检查标准的GM_ API或明确的API列表,避免误报。

Copilot uses AI. Check for mistakes.
Copy link
Member

@CodFrm CodFrm Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没问题 检测同时存在 none和GM*

for (const list of Object.values(metadata)) {
if (list && new Set(list).size !== list.length) return true;
}
}
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

函数缺少显式返回false。虽然JavaScript会隐式返回undefined(等同于false),但最佳实践应在末尾显式返回false以提高代码可读性和意图明确性。

Suggested change
}
}
return false;

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mv3合并了没写 return false; 的。不是好习惯但暂时先这样

@CodFrm CodFrm merged commit 2f377ef into scriptscat:release/mv2 Nov 8, 2025
2 checks passed
@CodFrm
Copy link
Member

CodFrm commented Nov 8, 2025

build没通过,我觉得还是不要更新package了,免得又出些其它岔子

@CodFrm
Copy link
Member

CodFrm commented Nov 8, 2025

只是lint问题,我处理了,不过确实感觉不更新package的好,不过你处理了,就这样吧

@cyfung1031
Copy link
Collaborator Author

cyfung1031 commented Nov 8, 2025

build没通过,我觉得还是不要更新package了,免得又出些其它岔子

有build 跟test过的
不是用最新


MV2 版本号是 跟随MV3的 package 版本号
这样有助一些代码更新相容一点
但有一些更新不了

@cyfung1031
Copy link
Collaborator Author

只是lint问题,我处理了,不过确实感觉不更新package的好,不过你处理了,就这样吧

定期手动更新一下吧

@CodFrm
Copy link
Member

CodFrm commented Nov 8, 2025

只是lint问题,我处理了,不过确实感觉不更新package的好,不过你处理了,就这样吧

定期手动更新一下吧

主要是担心出现其它问题啦

@cyfung1031 cyfung1031 added FirefoxMV2 and removed MV2 labels Nov 21, 2025
@cyfung1031 cyfung1031 deleted the pr-mv2-update-2511c branch December 21, 2025 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants