fix: 收口模板契约与安全门禁
统一模板包 visual 契约并补齐完成证据;修复 release 版本一致性、管理员 token 撤销、CORS 与默认品牌配置;收敛依赖安全风险并完成全量回归验证。
This commit is contained in:
1 parent
456171aa85
commit
4f0b50c7f1
84 files changed
+7367
-5180
No files matched your search
@@ -4,7 +4,7 @@ import type { TemplatePackageManifest } from "./index.js";
|
||||
export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[] = [
|
||||
{
|
||||
"packageKey": "acheng-campus-food",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"displayName": "阿成校园餐",
|
||||
"defaultBrandSlug": "default-brand",
|
||||
"runtimeContract": "1.0",
|
||||
@@ -1659,6 +1659,42 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
|
||||
"pages/records"
|
||||
],
|
||||
"visualTemplateKey": "acheng-campus-food",
|
||||
"visualPresentation": {
|
||||
"description": "适合校园餐饮、套餐预订和团体定制的暖橙菜单视觉。",
|
||||
"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"
|
||||
]
|
||||
}
|
||||
},
|
||||
"previewFixture": {
|
||||
"food": {
|
||||
"schemaVersion": "1",
|
||||
@@ -2050,7 +2086,7 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
|
||||
},
|
||||
{
|
||||
"packageKey": "atelier-solopreneur",
|
||||
"version": "1.3.1",
|
||||
"version": "1.3.2",
|
||||
"displayName": "独立工坊 · 品牌小程序",
|
||||
"defaultBrandSlug": "atelier-studio",
|
||||
"runtimeContract": "1.0",
|
||||
@@ -4343,11 +4379,45 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
|
||||
}
|
||||
}
|
||||
},
|
||||
"visualTemplateKey": "atelier-solopreneur"
|
||||
"visualTemplateKey": "atelier-solopreneur",
|
||||
"visualPresentation": {
|
||||
"description": "展示品牌小程序服务、试点案例与合作流程,承接需求咨询。",
|
||||
"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"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"packageKey": "linjing-editorial",
|
||||
"version": "1.0.5",
|
||||
"version": "1.0.6",
|
||||
"displayName": "林境建筑画册",
|
||||
"defaultBrandSlug": "linjing-doors",
|
||||
"runtimeContract": "1.0",
|
||||
@@ -6264,6 +6334,43 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
|
||||
"pages/bookings/index"
|
||||
],
|
||||
"visualTemplateKey": "linjing-editorial",
|
||||
"visualPresentation": {
|
||||
"description": "适合高端定制、建筑作品和项目型个人品牌。",
|
||||
"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"
|
||||
]
|
||||
}
|
||||
},
|
||||
"previewFixture": {
|
||||
"doors": {
|
||||
"schemaVersion": "1",
|
||||
@@ -6868,4 +6975,4 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
|
||||
}
|
||||
];
|
||||
export const generatedTemplatePackageRegistryHash =
|
||||
"dc82c85917f137a0f2a3a473147f32426ea0f46bf107adf709afd34cd5699db8";
|
||||
"6c629f916b92e889a8984fde3ffc8ea3cb39ba25542b070da1f029ae57665d73";
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { TemplateVisualPresentation } from "@personal-brand/template-contract";
|
||||
import type { BrandTemplateKey } from "./template-keys.js";
|
||||
import type { CapabilityKey } from "./template-keys.js";
|
||||
import type { VisualTemplateKey } from "./template-keys.js";
|
||||
@@ -28,6 +29,7 @@ export interface TemplatePackageManifest {
|
||||
version: string;
|
||||
displayName: string;
|
||||
visualTemplateKey: VisualTemplateKey;
|
||||
visualPresentation: TemplateVisualPresentation;
|
||||
runtimeContract: "1.0";
|
||||
supportedIndustryTemplates: readonly BrandTemplateKey[];
|
||||
entrypoints: Readonly<Record<string, string>>;
|
||||
|
||||
@@ -1,280 +1,12 @@
|
||||
import type { VisualTemplateKey } from "./template-keys.js";
|
||||
import type { VisualTemplateDefinition, VisualTemplateManifest } from "./brand-contracts.js";
|
||||
import { getTemplatePackageManifestForVisualKey } from "./template-packages.js";
|
||||
import { getVisualTemplate } from "./visual-templates.js";
|
||||
|
||||
const linjingEditorialManifest: VisualTemplateManifest = {
|
||||
schemaVersion: "1.0",
|
||||
key: "linjing-editorial",
|
||||
version: "1.0.0",
|
||||
name: "林境建筑画册",
|
||||
description: "以个人品牌信任为主线、以高端项目作品为表达重点的编辑式视觉模板。",
|
||||
supportedIndustryTemplates: ["personal", "doors"],
|
||||
brandFirst: true,
|
||||
tokens: {
|
||||
colors: {
|
||||
background: "#F7F5F1",
|
||||
surface: "#FFFFFF",
|
||||
foreground: "#252525",
|
||||
muted: "#77736C",
|
||||
accent: "#8A6846",
|
||||
dark: "#202221",
|
||||
},
|
||||
spacing: { page: "32rpx", section: "56rpx", module: "24rpx" },
|
||||
typography: { display: "56rpx", heading: "36rpx", body: "28rpx", caption: "22rpx" },
|
||||
radius: { card: "16rpx", button: "999rpx", media: "12rpx" },
|
||||
shadows: { card: "0 8rpx 32rpx rgba(32,34,33,0.08)" },
|
||||
},
|
||||
assets: [
|
||||
{ key: "brand.logo", label: "品牌标志", required: false, kind: "logo" },
|
||||
{
|
||||
key: "home.hero",
|
||||
label: "首页首屏图",
|
||||
required: true,
|
||||
kind: "image",
|
||||
aspectRatio: "16:9",
|
||||
},
|
||||
{
|
||||
key: "offering.cover",
|
||||
label: "业务提供项封面",
|
||||
required: true,
|
||||
kind: "image",
|
||||
aspectRatio: "1:1",
|
||||
},
|
||||
{
|
||||
key: "profile.portrait",
|
||||
label: "主理人肖像",
|
||||
required: false,
|
||||
kind: "image",
|
||||
aspectRatio: "1:1",
|
||||
},
|
||||
{ key: "brand.texture", label: "品牌底纹", required: false, kind: "texture" },
|
||||
],
|
||||
dataSlots: [
|
||||
{
|
||||
key: "brand.identity",
|
||||
source: "brand",
|
||||
required: true,
|
||||
description: "品牌名、定位和主理人身份",
|
||||
},
|
||||
{ key: "brand.hero", source: "brand", required: true, description: "品牌首屏表达和行动入口" },
|
||||
{ key: "trust.proof", source: "trust", required: true, description: "经历、资质、案例和方法" },
|
||||
{
|
||||
key: "offerings.list",
|
||||
source: "offering",
|
||||
required: true,
|
||||
description: "可展示的业务提供项",
|
||||
},
|
||||
{
|
||||
key: "offering.detail",
|
||||
source: "offering",
|
||||
required: true,
|
||||
description: "单个提供项的详情内容",
|
||||
},
|
||||
{ key: "inquiry.form", source: "inquiry", required: true, description: "品牌咨询或预约表单" },
|
||||
{
|
||||
key: "records.items",
|
||||
source: "records",
|
||||
required: true,
|
||||
description: "用户提交后的跟进记录",
|
||||
},
|
||||
{
|
||||
key: "profile.contact",
|
||||
source: "profile",
|
||||
required: true,
|
||||
description: "联系方式和合作预期",
|
||||
},
|
||||
],
|
||||
pages: [
|
||||
{
|
||||
key: "home",
|
||||
title: "首页",
|
||||
renderer: "linjing-home",
|
||||
modules: [
|
||||
{
|
||||
key: "identity",
|
||||
type: "brand-identity",
|
||||
variant: "editorial-card",
|
||||
required: true,
|
||||
dataSlots: ["brand.identity"],
|
||||
assetSlots: ["brand.logo"],
|
||||
},
|
||||
{
|
||||
key: "hero",
|
||||
type: "hero",
|
||||
variant: "architectural",
|
||||
required: true,
|
||||
dataSlots: ["brand.hero"],
|
||||
assetSlots: ["home.hero"],
|
||||
},
|
||||
{
|
||||
key: "proof",
|
||||
type: "trust",
|
||||
variant: "proof-strip",
|
||||
required: true,
|
||||
dataSlots: ["trust.proof"],
|
||||
},
|
||||
{
|
||||
key: "offerings",
|
||||
type: "offering-list",
|
||||
variant: "editorial-list",
|
||||
required: true,
|
||||
dataSlots: ["offerings.list"],
|
||||
assetSlots: ["offering.cover"],
|
||||
capability: "offerings",
|
||||
},
|
||||
{
|
||||
key: "contact",
|
||||
type: "contact",
|
||||
variant: "quiet-footer",
|
||||
required: true,
|
||||
dataSlots: ["profile.contact"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
key: "offerings",
|
||||
title: "业务提供项",
|
||||
renderer: "linjing-offerings",
|
||||
modules: [
|
||||
{
|
||||
key: "offerings",
|
||||
type: "offering-list",
|
||||
variant: "editorial-grid",
|
||||
required: true,
|
||||
dataSlots: ["offerings.list"],
|
||||
assetSlots: ["offering.cover"],
|
||||
capability: "offerings",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
key: "detail",
|
||||
title: "提供项详情",
|
||||
renderer: "linjing-offering-detail",
|
||||
modules: [
|
||||
{
|
||||
key: "detail",
|
||||
type: "offering-detail",
|
||||
variant: "project-case",
|
||||
required: true,
|
||||
dataSlots: ["offering.detail"],
|
||||
assetSlots: ["offering.cover"],
|
||||
capability: "offerings",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
key: "inquiry",
|
||||
title: "咨询与预约",
|
||||
renderer: "linjing-inquiry",
|
||||
modules: [
|
||||
{
|
||||
key: "inquiry",
|
||||
type: "inquiry-form",
|
||||
variant: "editorial-form",
|
||||
required: true,
|
||||
dataSlots: ["inquiry.form"],
|
||||
capability: "inquiry",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
key: "success",
|
||||
title: "提交成功",
|
||||
renderer: "linjing-success",
|
||||
modules: [
|
||||
{
|
||||
key: "success",
|
||||
type: "success-summary",
|
||||
variant: "editorial-confirmation",
|
||||
required: true,
|
||||
dataSlots: ["brand.identity"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
key: "records",
|
||||
title: "我的记录",
|
||||
renderer: "linjing-records",
|
||||
modules: [
|
||||
{
|
||||
key: "records",
|
||||
type: "records-list",
|
||||
variant: "timeline",
|
||||
required: true,
|
||||
dataSlots: ["records.items"],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
key: "profile",
|
||||
title: "主理人与我",
|
||||
renderer: "linjing-profile",
|
||||
modules: [
|
||||
{
|
||||
key: "identity",
|
||||
type: "brand-identity",
|
||||
variant: "profile-editorial",
|
||||
required: true,
|
||||
dataSlots: ["brand.identity"],
|
||||
assetSlots: ["profile.portrait"],
|
||||
},
|
||||
{
|
||||
key: "contact",
|
||||
type: "contact",
|
||||
variant: "contact-sheet",
|
||||
required: true,
|
||||
dataSlots: ["profile.contact"],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
capabilities: ["offerings", "inquiry"],
|
||||
};
|
||||
|
||||
export const visualTemplateManifests: Record<VisualTemplateKey, VisualTemplateManifest> = {
|
||||
"linjing-editorial": linjingEditorialManifest,
|
||||
"acheng-campus-food": {
|
||||
...linjingEditorialManifest,
|
||||
key: "acheng-campus-food",
|
||||
version: "1.0.0",
|
||||
name: "阿成校园餐",
|
||||
description: "面向校园餐饮摊贩的菜单、出摊动态和团体预订视觉模板。",
|
||||
supportedIndustryTemplates: ["food"],
|
||||
tokens: {
|
||||
...linjingEditorialManifest.tokens,
|
||||
colors: {
|
||||
background: "#FFF8F0",
|
||||
surface: "#FFFFFF",
|
||||
foreground: "#29231F",
|
||||
muted: "#7A6A60",
|
||||
accent: "#E87532",
|
||||
dark: "#3B2118",
|
||||
},
|
||||
radius: { card: "24rpx", button: "999rpx", media: "20rpx" },
|
||||
},
|
||||
pages: linjingEditorialManifest.pages.map((pageDefinition) => {
|
||||
const renderer =
|
||||
pageDefinition.key === "home"
|
||||
? "acheng-home"
|
||||
: pageDefinition.key === "offerings"
|
||||
? "acheng-offerings"
|
||||
: pageDefinition.key === "profile"
|
||||
? "acheng-profile"
|
||||
: pageDefinition.renderer;
|
||||
return renderer ? { ...pageDefinition, renderer } : pageDefinition;
|
||||
}),
|
||||
capabilities: ["offerings", "inquiry", "booking"],
|
||||
},
|
||||
};
|
||||
|
||||
export function getVisualTemplateManifest(key: string): VisualTemplateManifest | undefined {
|
||||
if (visualTemplateManifests[key]) return visualTemplateManifests[key];
|
||||
const manifest = getTemplatePackageManifestForVisualKey(key);
|
||||
const visual = getVisualTemplate(key);
|
||||
if (!manifest || !visual) return undefined;
|
||||
// 新模板从包声明投影安装快照,避免目录可选但遗漏旧版 manifest 注册。
|
||||
// 所有模板都从包 manifest 投影安装快照,不保留旧视觉 manifest 注册表。
|
||||
const roles: VisualTemplateManifest["pages"] = [
|
||||
{
|
||||
key: "home",
|
||||
|
||||
@@ -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],
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user