Skip to content

侧边栏:对话视频加载失败只记在 sidepanel-state 一处 - #433

Merged
PathGao merged 1 commit into
mainfrom
refactor/context-failure-state
Oct 27, 2026
Merged

PathGao merged 1 commit into
mainfrom
refactor/context-failure-state

Conversation

@PathGao

@PathGao PathGao commented Oct 27, 2026

Copy link
Copy Markdown
Owner

改了什么

侧边栏打开历史对话、原视频读不到时,失败信息在 sidepanel.js 里另存一份 lastContextFailure,靠手动查 run.alive 判断还算不算,和 sidepanel-state.js 的 conv.failed 是同一件事的两份。

  • conv.failed 改成 { code, text }(静默读取时 text 为空),由 CONTEXT_RESOLVED 写,切对话时随对话清掉,view() 带出。
  • readOnlyReason 和重画都从 view().failed 读;补救按钮(重试 / 打开视频)画的时候按 code 算。
  • 一处行为变化:失败后又读成功时清掉失败,原来会留着。

验证

  • node scripts/selftest.mjs:39 个通过。sidepanel-state.selftest.js 加了:失败存进去、静默失败只留 code、切对话清掉、旧对话的失败忽略、读成功清掉。让切对话不清 failed,测试失败。
  • 无头 Chrome,B站 接口全用 CDP Fetch 假数据,新旧两版各跑一遍,结果一样、无报错:已失效(-404)只写「视频已失效」、不给重试、输入框只读;断网写「读取原视频失败」并给重试,恢复后点重试读到;几个对话来回切,各显示各的。

失败的错误码和文字存进 conv.failed,切对话时随对话清掉;sidepanel.js 去掉另存的 lastContextFailure,补救按钮画的时候按错误码算。
@PathGao
PathGao merged commit 216c7eb into main Oct 27, 2026
2 checks passed
@PathGao
PathGao deleted the refactor/context-failure-state branch October 27, 2026 03:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant