fix
This commit is contained in:
@@ -146,7 +146,12 @@ function ownedScriptPath(item: ScriptItem) {
|
||||
function pushToast(tone: "success" | "error" | "info", message: string) {
|
||||
useUiStore.getState().pushToast({ tone, message });
|
||||
}
|
||||
async function sha256Hex(buffer: ArrayBuffer): Promise<string> {
|
||||
async function sha256Hex(buffer: ArrayBuffer): Promise<string | null> {
|
||||
// `crypto.subtle` 仅在 secure context(HTTPS / localhost)下可用;不可用时
|
||||
// 跳过 hash 计算,让后端走非校验路径。
|
||||
if (typeof crypto === "undefined" || !crypto.subtle?.digest) {
|
||||
return null;
|
||||
}
|
||||
const digest = await crypto.subtle.digest("SHA-256", buffer);
|
||||
return Array.from(new Uint8Array(digest))
|
||||
.map((byte) => byte.toString(16).padStart(2, "0"))
|
||||
|
||||
Reference in New Issue
Block a user