fix(*): 客户端标识 - 兼容 HTTP 内网访问并修复创造页卡死

Fixes #86
This commit is contained in:
ddCat
2026-08-03 15:06:09 +08:00
parent 72420895b2
commit d3b044e009
9 changed files with 35 additions and 9 deletions

View File

@@ -0,0 +1,12 @@
import { describe, expect, test } from "bun:test";
import { createClientId } from "../src/lib/client-id";
describe("createClientId", () => {
test("生成不依赖 randomUUID 的唯一客户端标识", () => {
const ids = Array.from({ length: 100 }, () => createClientId());
expect(new Set(ids).size).toBe(ids.length);
ids.forEach((id) => expect(id).toMatch(/^[A-Za-z0-9_-]{21}$/));
});
});