开放多项目大屏免登录访问
需求描述:/admin/display 需要无需管理员登录即可直接查看多项目公开运行状态。 实现思路:新增公开字段白名单接口与独立大屏页面,移除该路由的管理员会话依赖,同时保留 /api/admin/overview 的鉴权并补充隐私、路由和页面回归测试。 验证:Go 全量测试通过;前端 18 个测试文件共 59 项通过,TypeScript 检查通过。
This commit is contained in:
@@ -108,6 +108,20 @@ describe("public visitor lookup", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("public display overview", () => {
|
||||
it("loads the display wall without using an admin endpoint", async () => {
|
||||
const fetchMock = vi.fn().mockResolvedValue(jsonResponse({
|
||||
projects: [{ id: "project-1", name: "东门观光车", status: "RUNNING" }],
|
||||
server_time: "2026-07-31T08:00:00Z",
|
||||
}));
|
||||
vi.stubGlobal("fetch", fetchMock);
|
||||
|
||||
await api.displayOverview();
|
||||
|
||||
expect(fetchMock.mock.calls[0][0]).toBe("/api/display/overview");
|
||||
});
|
||||
});
|
||||
|
||||
describe("isolated portal authentication", () => {
|
||||
it("uses different endpoints for staff and admin sessions", async () => {
|
||||
const fetchMock = vi.fn().mockResolvedValue(jsonResponse({ user: { id: "u1", role: "STAFF" }, projects: [] }));
|
||||
|
||||
Reference in New Issue
Block a user