fix: 收口模板契约与安全门禁

统一模板包 visual 契约并补齐完成证据;修复 release 版本一致性、管理员 token 撤销、CORS 与默认品牌配置;收敛依赖安全风险并完成全量回归验证。
This commit is contained in:
que01 committed 2026-10-18 22:05:31 +08:00
1 parent 456171aa85
commit 4f0b50c7f1
84 files changed
+7367 -5180

No files matched your search

@@ -9,7 +9,6 @@ import {
} from "@personal-brand/config";
import { validateFieldSnapshot } from "@personal-brand/validation";
import { PrismaService } from "../../prisma.service.js";
import { TemplateWorkspaceService } from "../../template-workspace.service.js";
type BootstrapSource = {
kind: "package_version";
@@ -74,10 +73,7 @@ function asJson(value: unknown): Prisma.InputJsonValue {
@Injectable()
export class AdminSampleContentService {
constructor(
private readonly prisma: PrismaService,
_templateWorkspace: TemplateWorkspaceService,
) {}
constructor(private readonly prisma: PrismaService) {}
async preview(brandId: string, query?: { templatePackageVersionId?: string }) {
const { brand, source, visualTemplateKey } = await this.resolveSource(
@@ -222,10 +218,10 @@ export class AdminSampleContentService {
await tx.templateBootstrapImport.create({
data: {
brandId,
templatePackageVersionId: source.version!.id,
packageKey: source.version!.packageKey,
packageVersion: source.version!.version,
contentChecksum: source.version!.contentChecksum,
templatePackageVersionId: source.version.id,
packageKey: source.version.packageKey,
packageVersion: source.version.version,
contentChecksum: source.version.contentChecksum,
actorId,
strategy: "missing_only",
status: "imported",
@@ -294,7 +290,9 @@ export class AdminSampleContentService {
throw new BadRequestException("sampleContent 行业与品牌不匹配");
const fieldIssues = validateFieldSnapshot(source.sample.fields);
if (fieldIssues.length)
throw new BadRequestException(`bootstrap 表单字段无效:${fieldIssues.join(";")}`);
throw new BadRequestException(
`bootstrap 表单字段无效:${fieldIssues.map((issue) => `${issue.path}: ${issue.message}`).join(";")}`,
);
return { brand, source, visualTemplateKey };
}