Add managed content and keyboard usage insights
CI / verify (push) Has been cancelled
CI / publish (push) Has been cancelled

Introduce versioned official content workflows and privacy-safe keyboard analytics, while preventing repeat DeviceCheck sign-ins from incorrectly restricting eligible accounts.
This commit is contained in:
Rocky
2026-08-21 13:34:03 +08:00
parent b5212dcdc2
commit d0abe27623
55 changed files with 4690 additions and 111 deletions
+17
View File
@@ -57,6 +57,23 @@ describe("adminApi", () => {
expect(request.credentials).toBe("include");
});
it("内容发布请求携带 CSRF 并编码 Skill ID", async () => {
const fetchMock = vi.fn().mockResolvedValue(
new Response(null, { status: 204 }),
);
vi.stubGlobal("fetch", fetchMock);
setCsrfToken("csrf-content");
await adminApi.setContentSkillEnabled("official.skill/with space", true);
expect(fetchMock.mock.calls[0]?.[0]).toBe(
"/v1/admin/content/skills/official.skill%2Fwith%20space/enable",
);
const request = fetchMock.mock.calls[0]?.[1] as RequestInit;
expect((request.headers as Headers).get("X-CSRF-Token")).toBe("csrf-content");
expect(request.method).toBe("POST");
});
it("登录请求不依赖已有会话 CSRF", async () => {
const fetchMock = vi.fn().mockResolvedValue(
new Response(