feat(mindspace): enforce PostgreSQL user data delivery

This commit is contained in:
john
2026-07-13 15:29:29 +08:00
parent b33c943b69
commit a6620fb719
57 changed files with 2779 additions and 164 deletions
+29
View File
@@ -121,6 +121,35 @@ test('resolveMindSpacePublicRequest coordinates canonical redirect, serve, and n
});
});
test('resolveMindSpacePublicRequest keeps legacy browser-storage pages available during migration', async () => {
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'ms-public-storage-ban-'));
const ownerKey = '123e4567-e89b-12d3-a456-426614174000';
const targetDir = path.join(root, 'MindSpace', ownerKey, 'public');
fs.mkdirSync(targetDir, { recursive: true });
fs.writeFileSync(
path.join(targetDir, 'ledger.html'),
'<script>localStorage.setItem("ledger", "[]")</script>',
);
fs.writeFileSync(
path.join(targetDir, 'ledger.js'),
'sessionStorage.setItem("ledger", "[]")',
);
const result = await resolveMindSpacePublicRequest({
h5Root: root,
requestPath: `/${ownerKey}/public/ledger.html`,
});
assert.equal(result.action, 'serve');
assert.equal(result.filePath, path.join(targetDir, 'ledger.html'));
const scriptResult = await resolveMindSpacePublicRequest({
h5Root: root,
requestPath: `/${ownerKey}/public/ledger.js`,
});
assert.equal(scriptResult.action, 'serve');
assert.equal(scriptResult.filePath, path.join(targetDir, 'ledger.js'));
});
test('resolveMindSpacePublicRequest serves missing thumbnail png when svg sidecar exists', async () => {
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'ms-public-thumb-'));
const ownerKey = '123e4567-e89b-12d3-a456-426614174000';