Skip to content

Releases: Visol-456/dsh-web-compat

Release list

v0.1.1

Choose a tag to compare

@Visol-456 Visol-456 released this 15 Aug 07:55

修复

  • 修复真实浏览器非 secure context 下 polyfill 调用 crypto.getRandomValues 时抛出 TypeError: Illegal invocation 的问题。
  • 根因:原实现对原生 Web Crypto 方法做了解构调用,丢失了 this 绑定。
  • 修复:polyfill 内部将 getRandomValues 绑定到 Crypto 实例后再调用。

测试

  • 新增防回归测试:模拟要求 this 的 native-like getRandomValues,验证 polyfill 后的 randomUUID() 正常返回合法 UUID v4。
  • 全量测试:4/4 通过。
  • 构建:tsc + tsdown 全绿。

安装

dsh plugin add @visol-456/dsh-web-compat@0.1.1

v0.1.0

Choose a tag to compare

@Visol-456 Visol-456 released this 15 Aug 05:37

功能

  • 修复通过局域网纯 HTTP(非 secure context)访问 dsh web 时,官方会话界面添加图片附件因 crypto.randomUUID 不存在而崩溃的问题。
  • 在 client bundle 模块顶层自动注入基于 crypto.getRandomValues 的 UUID v4 polyfill。
  • 设置页新增「Web 兼容」状态面板,显示当前是否为安全上下文以及 randomUUID 来源(原生 / polyfill / 不可用)。
  • 中英文双语 UI。

安装

dsh plugin add @visol-456/dsh-web-compat

验证

  • npm test:3 个 polyfill 测试全部通过。
  • npm run build:tsc + tsdown 构建通过。
  • npm 包:@visol-456/dsh-web-compat@0.1.0