fix(page-data): harden structural delivery and Portal base URL

Reject /api/page-data/ legacy passthrough, verify live API before send,
and resolve delivery links to Portal (8081) instead of Vite (5173).
Add local repair/verify scripts for daily-register Page Data flow.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-07-13 09:35:40 +08:00
parent 249b0697cb
commit 804f13bc04
11 changed files with 712 additions and 51 deletions
+9
View File
@@ -4,8 +4,17 @@ import {
assertPolicyMatchesHtmlDatasets,
buildPageDataPolicyDatasetsFromRegistry,
detectPageDataDatasetUsageFromHtml,
htmlUsesForbiddenLegacyPageDataApi,
htmlUsesPageDataApi,
} from './page-data-html-detect.mjs';
test('htmlUsesForbiddenLegacyPageDataApi detects /api/page-data passthrough', () => {
const html = `fetch('/api/page-data/daily_todo', { method: 'POST' })`;
assert.equal(htmlUsesForbiddenLegacyPageDataApi(html), true);
assert.equal(htmlUsesPageDataApi(html), true);
assert.equal(detectPageDataDatasetUsageFromHtml(html).size, 0);
});
test('detectPageDataDatasetUsageFromHtml finds insert and read datasets', () => {
const html = `
await c.insertRow('tkmind_exp_survey', { satisfaction: '满意' });