feat(nsfw): 持久化账号偏好并接入生成控制
- digital.profile.ts: 未保存偏好时默认开启,原子合并 JSON 保留其他资料 - digital.controller.ts、digital.users.ts: 接入本人和管理员偏好读写、事务及审计 - digital.chat.ts、digital.prompt.ts、digital.suggestions.ts: 各生成入口读取服务端账号偏好,保留游客鉴权 - tests/digital-*.test.ts: 覆盖默认值、关闭保留、旧客户端兼容与越权拦截 - README.md: 同步模块职责和发布要求
This commit is contained in:
@@ -53,7 +53,10 @@ test("C 端登录只查询独立用户,不从同名管理员或员工回退",
|
||||
assert.equal(result.user.canManage, false);
|
||||
exists = false;
|
||||
await assert.rejects(
|
||||
loginDigitalUser({ username: "admin", password: "unrelated-admin-password" }),
|
||||
loginDigitalUser({
|
||||
username: "admin",
|
||||
password: "unrelated-admin-password",
|
||||
}),
|
||||
/账号或密码不正确/,
|
||||
);
|
||||
});
|
||||
@@ -227,9 +230,17 @@ test("开户和重置只写 C 端密码哈希,审计不记录密码", async (t
|
||||
password: "new-user-password",
|
||||
});
|
||||
await resetDigitalPassword("super_admin:1", 7, "reset-user-password");
|
||||
const initialProfile = writes.find((w) =>
|
||||
w.sql.startsWith("INSERT INTO dh_profiles"),
|
||||
);
|
||||
assert.equal(initialProfile!.args[0], "user:7");
|
||||
assert.equal(JSON.parse(String(initialProfile!.args[1])).nsfwEnabled, true);
|
||||
assert.ok(
|
||||
writes.every(
|
||||
(w) => w.sql.includes("dh_users") || w.sql.includes("dh_audits"),
|
||||
(w) =>
|
||||
w.sql.includes("dh_users") ||
|
||||
w.sql.includes("dh_audits") ||
|
||||
w.sql.includes("dh_profiles"),
|
||||
),
|
||||
);
|
||||
for (const w of writes.filter((w) => w.sql.includes("dh_audits"))) {
|
||||
|
||||
Reference in New Issue
Block a user