fix: serve MindSpace public assets as same-origin relative URLs

Rewrite absolute tkmind asset download links to /api/... at delivery time
and strip base tags that violate public page CSP, so images load on any host.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-07-03 23:02:47 +08:00
parent f543a91cc4
commit c3c487a8fb
3 changed files with 65 additions and 13 deletions
+2 -2
View File
@@ -59,7 +59,7 @@ import {
resolvePublicRequestOrigin,
} from './mindspace-public-page-context.mjs';
import {
appendPublicAssetTokens,
preparePublicHtmlAssetDelivery,
verifyPublicAssetToken,
} from './mindspace-public-asset-token.mjs';
import {
@@ -5427,7 +5427,7 @@ async function sendPublishFile(req, res, filePath) {
res.status(404).json({ message: '文件不存在' });
return;
}
html = appendPublicAssetTokens(html, INTERNAL_AGENT_SECRET);
html = preparePublicHtmlAssetDelivery(html, INTERNAL_AGENT_SECRET);
const embed = isPlazaEmbedRequest(req.query);
if (embed) {
html = preparePublicationHtmlForEmbed(html);