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

+30 -60
View File
@@ -1,69 +1,39 @@
import type { VisualTemplateKey } from "./template-keys.js";
import type { VisualTemplateDefinition } from "./brand-contracts.js";
import { templatePackageRegistry } from "./template-packages.js";
export const visualTemplates: Record<VisualTemplateKey, VisualTemplateDefinition> = {
"linjing-editorial": {
key: "linjing-editorial",
version: "1.0.0",
name: "林境建筑画册",
description: "适合高端定制、建筑作品和项目型个人品牌。",
supportedIndustryTemplates: ["personal", "doors"],
variants: { hero: "architectural", offeringList: "editorial", detail: "project-case" },
theme: {
colors: { background: "#F7F5F1", foreground: "#252525", accent: "#8A6846", dark: "#202221" },
radius: { card: "16rpx" },
},
layout: {
home: ["founder-card", "brand-hero", "trust-proof", "trust-manifesto", "offering-list"],
offerings: ["offering-list"],
detail: ["offering-detail"],
profile: ["profile"],
},
},
"acheng-campus-food": {
key: "acheng-campus-food",
version: "1.0.0",
name: "阿成校园餐",
description: "适合校园餐饮、套餐预订和团体定制的暖橙菜单视觉。",
supportedIndustryTemplates: ["food"],
variants: { hero: "stall-board", offeringList: "menu-card", detail: "dish-detail" },
theme: {
colors: { background: "#FFF8F0", foreground: "#29231F", accent: "#E87532", dark: "#3B2118" },
radius: { card: "24rpx" },
},
layout: {
home: ["founder-card", "brand-hero", "trust-proof", "offering-list"],
offerings: ["offering-list"],
detail: ["offering-detail"],
profile: ["profile"],
},
},
"atelier-solopreneur": {
key: "atelier-solopreneur",
version: "1.2.0",
name: "独立工坊 · 品牌小程序",
description: "展示品牌小程序服务、试点案例与合作流程,承接需求咨询。",
supportedIndustryTemplates: ["personal"],
variants: { hero: "editorial", offeringList: "service-system", detail: "project-case" },
theme: {
colors: { background: "#f6f6f4", foreground: "#17181a", accent: "#1f3a5f", dark: "#1f3a5f" },
radius: { card: "28rpx" },
},
layout: {
home: ["brand-hero", "offering-list"],
offerings: ["offering-list"],
detail: ["offering-detail"],
profile: ["profile"],
},
},
};
export const visualTemplateKeys: VisualTemplateKey[] = templatePackageRegistry.map(
(manifest) => manifest.visualTemplateKey,
);
export function listVisualTemplateKeys(): VisualTemplateKey[] {
return Object.keys(visualTemplates);
return visualTemplateKeys;
}
export const visualTemplateKeys = listVisualTemplateKeys();
export function getVisualTemplate(key: string): VisualTemplateDefinition | undefined {
return visualTemplates[key];
const manifest = templatePackageRegistry.find((item) => item.visualTemplateKey === key);
if (!manifest) return undefined;
const presentation = manifest.visualPresentation;
return {
key: manifest.visualTemplateKey,
version: manifest.version,
name: manifest.displayName,
description: presentation.description,
supportedIndustryTemplates: [...manifest.supportedIndustryTemplates],
variants: { ...presentation.variants },
theme: {
colors: { ...presentation.theme.colors },
radius: { ...presentation.theme.radius },
},
...(presentation.layout
? {
layout: {
home: [...presentation.layout.home],
offerings: [...presentation.layout.offerings],
detail: [...presentation.layout.detail],
profile: [...presentation.layout.profile],
},
}
: {}),
};
}