feat(mindspace): 公开页分享组件、workspace 路径与 Plaza 发布增强

- 新增 public share widget 与 workspace relative path 解析
- 增强 publications/chat-plaza 发布链路与缩略图 demo
- 补充 schema、cover 检查脚本与回归测试

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-07-05 23:14:41 +08:00
parent 69be1e5293
commit e2ad3bf62b
39 changed files with 2184 additions and 256 deletions
+14 -6
View File
@@ -33,13 +33,19 @@ async function findPageByWorkspaceRelativePath(pool, userId, relativePath) {
const [rows] = await pool.query(
`SELECT p.id, p.updated_at
FROM h5_page_records p
JOIN h5_page_versions pv ON pv.id = p.current_version_id
LEFT JOIN h5_page_versions pv ON pv.id = p.current_version_id
WHERE p.user_id = ?
AND p.status <> 'deleted'
AND JSON_UNQUOTE(JSON_EXTRACT(pv.source_snapshot_json, '$.relative_path')) = ?
AND (
p.workspace_relative_path = ?
OR (
(p.workspace_relative_path IS NULL OR p.workspace_relative_path = '')
AND JSON_UNQUOTE(JSON_EXTRACT(pv.source_snapshot_json, '$.relative_path')) = ?
)
)
ORDER BY p.updated_at DESC, p.id DESC
LIMIT 1`,
[userId, relativePath],
[userId, relativePath, relativePath],
);
const row = rows[0];
if (!row) return null;
@@ -58,16 +64,18 @@ function parseJsonColumn(value, fallback = {}) {
async function loadIndexedWorkspacePages(pool, userId) {
const [rows] = await pool.query(
`SELECT p.id, p.updated_at, p.source_asset_id, pv.source_snapshot_json
`SELECT p.id, p.updated_at, p.source_asset_id, p.workspace_relative_path, pv.source_snapshot_json
FROM h5_page_records p
JOIN h5_page_versions pv ON pv.id = p.current_version_id
LEFT JOIN h5_page_versions pv ON pv.id = p.current_version_id
WHERE p.user_id = ? AND p.status <> 'deleted'`,
[userId],
);
const byPath = new Map();
for (const row of rows) {
const snapshot = parseJsonColumn(row.source_snapshot_json);
const relativePath = normalizePublicHtmlPath(snapshot.relative_path);
const relativePath =
normalizePublicHtmlPath(row.workspace_relative_path) ??
normalizePublicHtmlPath(snapshot.relative_path);
if (relativePath) {
byPath.set(relativePath, {
id: row.id,