[错误] 在非 HTTPS 部署下导出「可编辑 PPTX」时无响应: crypto.randomUUID 仅在安全上下文中可用
作者: zgybkjcn-a11y创建于 2026年9月12日更新于 2026年9月12日
- 部署方法/*
ZZTERM0 编译 (ZZTERM1 编译-yml).
- 问题说明/*
" 前端/src/pages/SlidePreview.tsx " CHAL " 手提出口 " (主L1662,v0.9.0-rc.7 -- --):
c. 加密.randomUID () : 未定义;
尝试{ . . . . . . . .
`crypto.randomUUID ()' 只在安全上下文 (HTTPS / localhost) 存在。通过 (http://QQIP):<端口>` TLS `未定义',`TypeError: crypto.randomUUID 不是函数 {}
`Try ' 、`catch ' 、`13个土司 ' 、`PPTX ' 、`TypeError。
* 步骤重现/*
1. Docker 组成 部署, 用 " http://<IP " :<port>`###(4) localhost)
2. 国家
3. ++++++ PPTX
4. QQ; QQ `TypeError: crypto.randomUID 不是一个函数'
• 预期行为/*
非安全上下文下也能正常发起导出。
###
RFC 4122 v4 UUID (+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
const 生成 Uuid = (): 字符串 {{
如果( crypto.randomUID QQ"功能"类型)返回 crypto.randomUID ();
const字节=crypto.getRandomValues(新的Uint8Array(16));
字节[6] = (字节[6] & 0x0f] | 0x40;
字节[8] = (字节[8] & 0x3f] | 0x80;
cont hex = array. from(字节, b.toString (16).padStart (2,'0')). join ('; ).
返回 ${hex.slic(0,8)} - ${hex.slic(8,12)} - ${hex.slic(12,16)} - ${hex.slic(16,20)} - ${hex.slic(20)} ;
* ;
c. 生成Uuid(): 未定义;++ 版本 / ++ 版本
v. 9.0-rc.7(9277bfc) 与主 (199cf9e) 均存在
内容来源: Anionex/banana-slides