Extract memind_adm admin server, add local dev tooling, and remove image-generation.
Split platform admin and ops APIs into standalone admin-server.mjs with network guards; simplify billing to RMB token pricing, refactor user auth, and add rsync deploy plus local-test scripts and docs. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -8,9 +8,7 @@ import {
|
||||
generateHtmlThumbnail,
|
||||
isModernFeedThumbnail,
|
||||
resolveCoverDataUri,
|
||||
resolveWorkspaceHtmlContentBaseDir,
|
||||
shouldUseScenicBackground,
|
||||
thumbnailHasEmbeddedPhoto,
|
||||
} from './mindspace-thumbnails.mjs';
|
||||
import fs from 'node:fs/promises';
|
||||
import os from 'node:os';
|
||||
@@ -165,38 +163,3 @@ test('resolveCoverDataUri rejects paths outside content base', async () => {
|
||||
});
|
||||
assert.equal(dataUri, null);
|
||||
});
|
||||
|
||||
test('resolveWorkspaceHtmlContentBaseDir resolves nested html paths', () => {
|
||||
assert.equal(
|
||||
resolveWorkspaceHtmlContentBaseDir('/workspace', 'oa/report.html'),
|
||||
path.join('/workspace', 'oa'),
|
||||
);
|
||||
assert.equal(resolveWorkspaceHtmlContentBaseDir('/workspace', 'page.html'), '/workspace');
|
||||
});
|
||||
|
||||
test('ensureHtmlThumbnail refreshes cached thumbnail when cover image becomes resolvable', async () => {
|
||||
const root = await fs.mkdtemp(path.join(os.tmpdir(), 'mindspace-thumb-refresh-'));
|
||||
const htmlDir = path.join(root, 'oa');
|
||||
await fs.mkdir(htmlDir, { recursive: true });
|
||||
const png = Buffer.from(
|
||||
'iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAFUlEQVR42mNk+M9Qz0AEYBxVSF+FABJADveWkH6oAAAAAElFTkSuQmCC',
|
||||
'base64',
|
||||
);
|
||||
await fs.writeFile(path.join(htmlDir, 'hero.png'), png);
|
||||
const html = `<!doctype html><html><head>
|
||||
<title>OA 报告</title>
|
||||
<meta name="mindspace-cover" content='{"cover":"hero.png","tag":"报告"}' />
|
||||
</head><body></body></html>`;
|
||||
const key = 'users/u1/pages/p1/thumbnail.svg';
|
||||
const cached = buildFeedThumbnailSvg(extractCoverSignals(html, { title: 'OA 报告' }));
|
||||
assert.equal(thumbnailHasEmbeddedPhoto(cached), false);
|
||||
await fs.mkdir(path.dirname(path.join(root, key)), { recursive: true });
|
||||
await fs.writeFile(path.join(root, key), cached, 'utf8');
|
||||
|
||||
const svg = await ensureHtmlThumbnail(root, key, html, {
|
||||
title: 'OA 报告',
|
||||
contentBaseDir: htmlDir,
|
||||
});
|
||||
assert.equal(thumbnailHasEmbeddedPhoto(svg), true);
|
||||
assert.match(svg, /href="data:image\/png;base64,/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user