Repository navigation
Conversation
cyfung1031
marked this pull request as draft
October 8, 2026 12:09
Collaborator
|
1784 的观点站不住脚 暴露前应先搞清楚用途 |
Member
Author
我想错了,确实场景有限 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist / 检查清单
Description / 描述
Close #1784
背景
#1784 请求通过
GM_info.uuid/GM.info.uuid获取当前脚本的 UUID,维护者在 issue 中确认与 Violentmonkey 保持一致(VM 在GM_info顶层暴露uuid: string)。本次改动
evaluateGMInfo(src/app/service/content/gm_api/gm_info.ts)在顶层返回uuid: script.uuid。@grant none与沙箱两条路径都由这个函数生成GM_info,且GM.info与GM_info是同一对象,因此两个入口同时生效;后台/定时脚本复用同一ExecScript构建逻辑。src/types/scriptcat.d.ts、src/types/scriptcat.zh-CN.d.ts、src/template/scriptcat.d.tpl(编辑器内置类型提示)补充uuid: string。暴露的是 ScriptCat 已有的脚本 UUID,不新增权限,也不是浏览器/设备级标识。脚本更新时复用原 UUID(
src/pkg/utils/script.ts中prepareScriptByCode沿用old.uuid),所以注释写明"更新后保持不变"。已知限制
issue 中希望说明复制、重装、导入、恢复、同步等场景下 UUID 的行为,这部分属于 scriptcat.org 文档站,未在本 PR 中处理。
验证
基于 base
54999260/ head033042f7:GM_info.uuid 与 GM.info.uuid 返回当前脚本 UUID(none / sandbox),改动前两种模式均失败(收到undefined),改动后通过。pnpm vitest run src/app/service/content/:12 个文件、240 个用例全部通过。tsc --noEmit、eslint(改动文件)、prettier 检查通过;push 钩子的 typecheck / prettier / issue 模板检查通过。