fix: 收口依赖兼容与会话撤销

为 miniprogram-ci 和 Jimp 依赖增加兼容 patch 与 smoke test;修复平台模板管理员路由漏配;收紧模板契约校验;为 admin/customer 增加 token 撤销和集中会话存储;同步品牌切换角色、doctor source hash、多屏宽截图证据和 CI 构建门禁。
This commit is contained in:
que01 committed 2026-10-18 23:43:25 +08:00
1 parent 4f0b50c7f1
commit 3017e3eb49
65 files changed
+1623 -975

No files matched your search

+46 -25
View File
@@ -189,37 +189,58 @@ export function validateTemplatePackageManifest(value: unknown): string[] {
if (!manifest.packageKey?.trim()) errors.push("packageKey is required");
if (!manifest.version?.trim()) errors.push("version is required");
if (!manifest.visualTemplateKey?.trim()) errors.push("visualTemplateKey is required");
if (manifest.packageKey !== manifest.visualTemplateKey)
errors.push("visualTemplateKey must match packageKey");
if (manifest.runtimeContract !== TEMPLATE_RUNTIME_CONTRACT)
errors.push(`runtimeContract must be ${TEMPLATE_RUNTIME_CONTRACT}`);
if (!manifest.displayName?.trim()) errors.push("displayName is required");
const presentation = manifest.visualPresentation;
if (
!presentation ||
typeof presentation !== "object" ||
!presentation.description?.trim() ||
!presentation.variants ||
typeof presentation.variants !== "object" ||
Array.isArray(presentation.variants) ||
!Object.values(presentation.variants).every(
(variant) => typeof variant === "string" && variant.trim(),
) ||
!presentation.theme ||
typeof presentation.theme !== "object" ||
!presentation.theme.colors ||
typeof presentation.theme.colors !== "object" ||
!presentation.theme.radius ||
typeof presentation.theme.radius !== "object"
) {
const validPresentation =
presentation &&
typeof presentation === "object" &&
presentation.description?.trim() &&
presentation.variants &&
typeof presentation.variants === "object" &&
!Array.isArray(presentation.variants) &&
presentation.theme &&
typeof presentation.theme === "object" &&
presentation.theme.colors &&
typeof presentation.theme.colors === "object" &&
presentation.theme.radius &&
typeof presentation.theme.radius === "object";
if (!validPresentation) {
errors.push("visualPresentation requires description, variants, theme.colors and theme.radius");
} else if (presentation.layout) {
const layout = presentation.layout;
} else {
const requiredVariant = (key: string) =>
typeof presentation.variants[key] === "string" && presentation.variants[key].trim();
if (!(["hero", "offeringList", "detail"] as const).every(requiredVariant))
errors.push("visualPresentation.variants requires hero, offeringList and detail");
const requiredColor = (key: string) =>
typeof presentation.theme.colors[key] === "string" && presentation.theme.colors[key].trim();
if (!(["background", "foreground", "accent", "dark"] as const).every(requiredColor))
errors.push(
"visualPresentation.theme.colors requires background, foreground, accent and dark",
);
if (
!(["home", "offerings", "detail", "profile"] as const).every(
(page) =>
Array.isArray(layout[page]) && layout[page].every((item) => typeof item === "string"),
)
) {
errors.push("visualPresentation.layout must contain page module arrays");
typeof presentation.theme.radius.card !== "string" ||
!presentation.theme.radius.card.trim()
)
errors.push("visualPresentation.theme.radius requires card");
if (presentation.layout) {
const layout = presentation.layout;
if (
!(["home", "offerings", "detail", "profile"] as const).every(
(page) =>
Array.isArray(layout[page]) &&
layout[page].length > 0 &&
layout[page].every((item) => typeof item === "string" && item.trim()),
)
) {
errors.push("visualPresentation.layout must contain non-empty page module arrays");
}
}
}
if (