fix(plaza): use hero-generated thumbnails and portal cover URLs
Plaza posts now resolve cover_url to /u/{slug}/pages/{urlSlug}.thumbnail.png
instead of MindSpace workspace paths that fail on plaza.tkmind.cn. Public-html
and chat quick-plaza flows regenerate workspace thumbnails with force:true
after hero images are on disk so feed cards embed the generated art.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -255,21 +255,43 @@ export async function quickPlazaFromChat({
|
||||
mindSpacePages,
|
||||
mindSpacePublications,
|
||||
plazaPosts,
|
||||
ensureWorkspaceHtmlThumbnail,
|
||||
publishDir,
|
||||
}) {
|
||||
if (!mindSpacePages || !mindSpacePublications || !plazaPosts) {
|
||||
throw Object.assign(new Error('Plaza 或 MindSpace 未启用'), { code: 'plaza_unavailable' });
|
||||
}
|
||||
|
||||
const { analysis } = bundle;
|
||||
const { analysis, resolvedHtml } = bundle;
|
||||
const page = await ensureChatPageForPlaza({
|
||||
userId: user.id,
|
||||
bundle,
|
||||
mindSpacePages,
|
||||
ensureWorkspaceHtmlThumbnail,
|
||||
publishDir,
|
||||
body,
|
||||
skipThumbnail: true,
|
||||
skipThumbnail: !ensureWorkspaceHtmlThumbnail || !publishDir,
|
||||
});
|
||||
|
||||
if (
|
||||
analysis.contentMode === 'static_html' &&
|
||||
analysis.relativePath &&
|
||||
resolvedHtml?.content &&
|
||||
ensureWorkspaceHtmlThumbnail &&
|
||||
publishDir
|
||||
) {
|
||||
await ensureWorkspaceHtmlThumbnail(
|
||||
publishDir,
|
||||
analysis.relativePath,
|
||||
resolvedHtml.content,
|
||||
{
|
||||
title: page.title,
|
||||
subtitle: page.summary,
|
||||
force: true,
|
||||
},
|
||||
).catch(() => {});
|
||||
}
|
||||
|
||||
if (analysis.contentMode === 'static_html' && analysis.relativePath) {
|
||||
await assertWorkspacePathNotAlreadyOnPlaza({
|
||||
userId: user.id,
|
||||
@@ -372,6 +394,8 @@ export async function quickPlazaFromPublicHtml({
|
||||
mindSpacePublications,
|
||||
plazaPosts,
|
||||
readWorkspaceHtml,
|
||||
ensureWorkspaceHtmlThumbnail,
|
||||
publishDir,
|
||||
}) {
|
||||
if (!mindSpacePages || !mindSpacePublications || !plazaPosts) {
|
||||
throw Object.assign(new Error('Plaza 或 MindSpace 未启用'), { code: 'plaza_unavailable' });
|
||||
@@ -396,11 +420,19 @@ export async function quickPlazaFromPublicHtml({
|
||||
relativePath: normalized,
|
||||
});
|
||||
|
||||
const title = titleFromPublicHtml(content, normalized);
|
||||
if (ensureWorkspaceHtmlThumbnail && publishDir) {
|
||||
await ensureWorkspaceHtmlThumbnail(publishDir, normalized, content, {
|
||||
title,
|
||||
force: true,
|
||||
}).catch(() => {});
|
||||
}
|
||||
|
||||
const page = await ensureWorkspaceHtmlPageForPlaza({
|
||||
userId: user.id,
|
||||
relativePath: normalized,
|
||||
content,
|
||||
title: titleFromPublicHtml(content, normalized),
|
||||
title,
|
||||
mindSpacePages,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user