Skip to content

Commit a8c92c1

Browse files
CodFrmcyfung1031
andauthored
💄 更新页/安装页/编辑器体验修复,并修正被过期检查快照覆盖的更新记录 (#1677)
* 💄 更新页与安装页:即时反馈的状态机,去掉遮挡按钮的成功提示 批量更新页点「更新」后没有任何反应:页面串行等服务端整批跑完,中途不落任何 可见状态。改成行级状态机,点下去 40ms 内就进「更新中」,成功后停留约 450ms 再收拢离场,失败的行留在原地并带上失败原因。 安装页原来用 toast 报「安装成功」,恰好盖住刚点的按钮,而且页面随后就关掉, 提示等于没人看见。改成把确认状态放回按钮自身(安装 → 安装中… → 已安装), 成功提示不再飘窗;失败改为就地的错误条,让用户能看清原因再决定。 顺带把 toast 的取舍写进 docs/references/design-components.md:用户刚做过的 动作不再 toast,避免自证式提示。 * 🐛 更新记录不再被过期的检查快照覆盖,失败原因如实回报 一次检查更新要跑完逐条节流加网络往返,脚本多时可达数分钟,而结果是拿检查 开始时的脚本快照无条件写回内存记录的。这段窗口里用户若在更新页把某条更新装 上了,检查结束时那条「旧版 → 新版」会连同过期的代码比对一起复活——刚更新完 的行几秒后又冒出来,还带着「更新」按钮,看起来像没更新成功。真机验证过:磁盘 上确实已是新版本,只是记录被覆盖。 写回前按当前库内状态复核每条:脚本已删则整条丢弃,版本已变则退化成 checkUpdate: false,交给下一次检查重算。 同时把更新动作的返回值补成明确契约:缓存随 Service Worker 回收而消失时回报 record_expired,让页面提示重新检查而不是静默无反应;单条安装失败时把原因带 回去,供行内展示。 * 💄 编辑器:脚本列表开关收进「视图」菜单,删掉工具栏按钮 折叠按钮长在编辑器工具栏右侧,控制的却是左边的列表,而它左边还有主导航的 收起按钮——两个外观相近的控件挨在一起管着不同的面板。菜单里已经有稳定的 去处,就把入口收进「视图 → 显示/隐藏脚本列表」,工具栏按钮直接删掉。 快捷键仍是 ⌘B / Ctrl+B,走捕获阶段监听,Monaco 或输入框持有焦点时也能切换, 且不会把字符 b 输进代码。同时认 e.code 与 e.key:非拉丁布局下物理 B 键的 e.key 是本地字符(俄文为「и」),只认 e.key 会让这些用户完全按不出来。 移动端没有脚本列表面板,「视图」子菜单不出现。 Closes #1650 * ✨ 反馈链接落到 issue 模板选择页,并带上可读的环境信息 原来点「反馈问题」直接把用户摁进 bug 模板,连挑一下类型、顺手看眼有没有重复 issue 的机会都没有。改成落到 issues/new/choose,模板由用户自己选,版本号与 浏览器信息作为预填参数带过去。 浏览器信息不再糊一整条 Mozilla/5.0,而是「macOS 14.8.7 + Chrome 148 (arm64)」 这样的人话;能拿到 client hints 时用高熵值补全系统版本与架构(UA 被冻结后这 些信息只剩这一个来源),拿不到则退回解析 UA 串。原先按语言猜产地的 isChineseUser() 一并删掉。 给功能请求、技术方案、翻译三对模板补上可选的 scriptcat-version 字段,否则预填 参数会被 GitHub 静默丢弃。check-issue-templates 相应扩展:选择页 URL 的每个 参数名都要能在某个模板的字段 id 里找到;URL 的查询串必须写成字面量,运行时 拼装(如 URLSearchParams)会让 AST 读不到参数名、把校验变成空转,这种情况直接 报错而不是放行。 Closes #1648 * 💄 Agent:未配置模型时给出可执行引导,而不是一行灰字 「未配置模型」原来只是输入框下方一行不显眼的小字,用户看不见也不知道该去哪。 改成两层:空状态里说明原因并给出「去添加模型服务」「查看接入文档」两个动作, 输入区把发送禁用的原因写清楚并挂上「立即配置」。 Closes #1651 * fix: validate batch update cache before installing * fix: prevent invalid install retries * fix: align issue schema and shortcut handling * ✅ e2e 安装页按扩展新建标签的方式打开,不再靠 about:blank 撑出的历史 #1675 起安装页改用 history.length 区分「独立新标签(关闭自己)」与「被 DNR 接管的 用户标签(返回上一页)」,install / subscribe-lifecycle 两条用例随即在 CI 红到现在。 原因在用例这边:context.newPage() 先停在 about:blank 再 goto,标签留下两条历史, 模拟出的是现实里不存在的第三种入口。实测三条路径的 history.length: context.newPage() + goto = 2 ← 只有用例这么开 chrome.tabs.create({ url }) = 1 ← 生产:扩展新建的独立安装标签 同标签内从网页跳转 = 3 ← 生产:DNR 接管用户原标签 所以安装后走了 history.back() 退回 about:blank,标签不关,等 close 的用例超时。 改由扩展 service worker 调 chrome.tabs.create 开页,与 openInstallPageByUrl 一致。 * ✅ VSCode URL 断言改用会重试的 toHaveValue,不再撞上配置回填前的空窗 DevToolsSection 的输入框先以 useState("") 渲染,vscode_url 要等一次 service worker 往返才回填。inputValue() 是一次性读取,CI 慢机上会读到那段空窗——实测报的正是 Received string: "",不是值不对而是还没到。同文件另一处早已用 toHaveValue,这里对齐。 --------- Co-authored-by: cyfung1031 <44498510+cyfung1031@users.noreply.github.com>
1 parent a51bec9 commit a8c92c1

86 files changed

Lines changed: 3606 additions & 374 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/ISSUE_TEMPLATE/01_bug_report.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ body:
5050
id: scriptcat-version
5151
attributes:
5252
label: ScriptCat 版本
53-
placeholder: "例如:v1.4.0 / v1.4.0-beta / Firefox MV2 v0.16.15"
53+
placeholder: "例如:v1.4.0 / v1.4.0-beta"
5454
validations:
5555
required: true
5656

.github/ISSUE_TEMPLATE/02_userscript_compatibility.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ body:
6666
id: scriptcat-version
6767
attributes:
6868
label: ScriptCat 版本
69-
placeholder: "例如:v1.4.0 / v1.4.0-beta / Firefox MV2 v0.16.15"
69+
placeholder: "例如:v1.4.0 / v1.4.0-beta"
7070
validations:
7171
required: true
7272

.github/ISSUE_TEMPLATE/03_feature_request.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ body:
3939
validations:
4040
required: true
4141

42+
- type: input
43+
id: scriptcat-version
44+
attributes:
45+
label: ScriptCat 版本
46+
description: 从扩展内的反馈入口进入时会自动填充,与版本无关可留空。
47+
placeholder: "例如:v1.4.0 / v1.4.0-beta"
48+
validations:
49+
required: false
50+
4251
- type: textarea
4352
id: additional-info
4453
attributes:

.github/ISSUE_TEMPLATE/04_technical_proposal.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,17 @@ body:
3434
label: 兼容性 / 迁移 / 测试
3535
placeholder: |
3636
对旧版本数据的影响:
37-
MV2/MV3、Firefox/Chrome/Edge/移动端的影响:
37+
对 Firefox/Chrome/Edge/移动端的影响:
3838
是否需要 migration:
3939
测试与回归风险:
4040
validations:
4141
required: false
42+
43+
- type: input
44+
id: scriptcat-version
45+
attributes:
46+
label: ScriptCat 版本
47+
description: 从扩展内的反馈入口进入时会自动填充,与版本无关可留空。
48+
placeholder: "例如:v1.4.0 / v1.4.0-beta"
49+
validations:
50+
required: false

.github/ISSUE_TEMPLATE/06_translation.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ body:
6262
validations:
6363
required: true
6464

65+
- type: input
66+
id: scriptcat-version
67+
attributes:
68+
label: ScriptCat 版本
69+
description: 从扩展内的反馈入口进入时会自动填充,文档翻译等与版本无关的问题可留空。
70+
placeholder: "例如:v1.4.0 / v1.4.0-beta"
71+
validations:
72+
required: false
73+
6574
- type: textarea
6675
id: additional-info
6776
attributes:

.github/ISSUE_TEMPLATE/11_bug_report_en.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ body:
5050
id: scriptcat-version
5151
attributes:
5252
label: ScriptCat Version
53-
placeholder: "Example: v1.4.0 / v1.4.0-beta / Firefox MV2 v0.16.15"
53+
placeholder: "Example: v1.4.0 / v1.4.0-beta"
5454
validations:
5555
required: true
5656

.github/ISSUE_TEMPLATE/12_userscript_compatibility_en.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ body:
6666
id: scriptcat-version
6767
attributes:
6868
label: ScriptCat Version
69-
placeholder: "Example: v1.4.0 / v1.4.0-beta / Firefox MV2 v0.16.15"
69+
placeholder: "Example: v1.4.0 / v1.4.0-beta"
7070
validations:
7171
required: true
7272

.github/ISSUE_TEMPLATE/13_feature_request_en.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ body:
3939
validations:
4040
required: true
4141

42+
- type: input
43+
id: scriptcat-version
44+
attributes:
45+
label: ScriptCat Version
46+
description: Auto-filled when you open this form from inside the extension. Leave it empty if the request is not version-specific.
47+
placeholder: "Example: v1.4.0 / v1.4.0-beta"
48+
validations:
49+
required: false
50+
4251
- type: textarea
4352
id: additional-info
4453
attributes:

.github/ISSUE_TEMPLATE/14_technical_proposal_en.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,17 @@ body:
3434
label: Compatibility / Migration / Testing
3535
placeholder: |
3636
Impact on existing data:
37-
Impact on MV2/MV3 and Firefox / Chrome / Edge / mobile:
37+
Impact on Firefox / Chrome / Edge / mobile:
3838
Migration required:
3939
Test plan and regression risks:
4040
validations:
4141
required: false
42+
43+
- type: input
44+
id: scriptcat-version
45+
attributes:
46+
label: ScriptCat Version
47+
description: Auto-filled when you open this form from inside the extension. Leave it empty if the proposal is not version-specific.
48+
placeholder: "Example: v1.4.0 / v1.4.0-beta"
49+
validations:
50+
required: false

.github/ISSUE_TEMPLATE/16_translation_en.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ body:
6262
validations:
6363
required: true
6464

65+
- type: input
66+
id: scriptcat-version
67+
attributes:
68+
label: ScriptCat Version
69+
description: Auto-filled when you open this form from inside the extension. Leave it empty for documentation translations or other version-independent issues.
70+
placeholder: "Example: v1.4.0 / v1.4.0-beta"
71+
validations:
72+
required: false
73+
6574
- type: textarea
6675
id: additional-info
6776
attributes:

0 commit comments

Comments
 (0)