mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-08-08 19:26:54 +08:00
hotfix for cf deploy error #5168
This commit is contained in:
@@ -43,7 +43,7 @@ async function handle(
|
||||
export const GET = handle;
|
||||
export const POST = handle;
|
||||
|
||||
export const runtime = "nodejs";
|
||||
export const runtime = "edge";
|
||||
export const preferredRegion = [
|
||||
"arn1",
|
||||
"bom1",
|
||||
|
@@ -1,14 +1,17 @@
|
||||
import { createHash, createHmac } from "node:crypto";
|
||||
import hash from "hash.js";
|
||||
|
||||
// 使用 SHA-256 和 secret 进行 HMAC 加密
|
||||
function sha256(message: any, secret = "", encoding?: string) {
|
||||
return createHmac("sha256", secret)
|
||||
return hash
|
||||
.hmac(hash.sha256 as any, secret)
|
||||
.update(message)
|
||||
.digest(encoding as any);
|
||||
}
|
||||
|
||||
// 使用 SHA-256 进行哈希
|
||||
function getHash(message: any, encoding = "hex") {
|
||||
return createHash("sha256")
|
||||
return hash
|
||||
.sha256()
|
||||
.update(message)
|
||||
.digest(encoding as any);
|
||||
}
|
||||
|
Reference in New Issue
Block a user