forked from XiaoMo/ChatGPT-Next-Web
2c899cf00e
access code
17 lines
346 B
TypeScript
17 lines
346 B
TypeScript
import md5 from "spark-md5";
|
|
|
|
export function getAccessCodes(): Set<string> {
|
|
const code = process.env.CODE;
|
|
|
|
try {
|
|
const codes = (code?.split(",") ?? [])
|
|
.filter((v) => !!v)
|
|
.map((v) => md5.hash(v.trim()));
|
|
return new Set(codes);
|
|
} catch (e) {
|
|
return new Set();
|
|
}
|
|
}
|
|
|
|
export const ACCESS_CODES = getAccessCodes();
|