Files
memind/mindspace-workspace-path.mjs
T
john e3063ea806 fix(mindspace): refresh published HTML after workspace sync
Keep online publication snapshots aligned when public/*.html changes, default static page binds to public access with MindSpace delivery URLs, and split browser-safe workspace helpers out of the Vite import chain.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-10 20:44:04 +08:00

26 lines
798 B
JavaScript

import fs from 'node:fs';
import path from 'node:path';
import {
normalizeWorkspaceRelativePath,
resolveAssetWorkspaceRelativePath,
resolvePageWorkspaceRelativePath,
} from './mindspace-workspace-relative-path.mjs';
import { resolvePublishDir } from './user-publish.mjs';
export {
normalizeWorkspaceRelativePath,
resolveAssetWorkspaceRelativePath,
resolvePageWorkspaceRelativePath,
};
export async function readWorkspacePublishHtml(h5Root, userId, relativePath) {
const normalized = normalizeWorkspaceRelativePath(relativePath);
if (!h5Root || !userId || !normalized) return null;
const filePath = path.join(resolvePublishDir(h5Root, { id: userId }), ...normalized.split('/'));
try {
return await fs.promises.readFile(filePath, 'utf8');
} catch {
return null;
}
}