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:
@@ -17,6 +17,7 @@ import {
|
||||
PUBLIC_ZONE_DIR,
|
||||
resolveLegacyPublishDir,
|
||||
resolveGoosedSandboxRoot,
|
||||
resolvePageDataDeliveryBaseUrl,
|
||||
} from './user-publish.mjs';
|
||||
import { syncSkillsToWorkspace } from './skills-registry.mjs';
|
||||
import { listPlatformSkillCatalog } from './skills-registry.mjs';
|
||||
@@ -157,3 +158,21 @@ test('isPathInsidePublishDir blocks escape', () => {
|
||||
assert.equal(isPathInsidePublishDir(publishDir, `/var/h5/${PUBLISH_ROOT_DIR}/${USER_ID}/report.html`), true);
|
||||
assert.equal(isPathInsidePublishDir(publishDir, `/var/h5/${PUBLISH_ROOT_DIR}/other-id/x.html`), false);
|
||||
});
|
||||
|
||||
test('resolvePageDataDeliveryBaseUrl prefers Portal when public base points at local Vite', () => {
|
||||
assert.equal(
|
||||
resolvePageDataDeliveryBaseUrl({ H5_PUBLIC_BASE_URL: 'http://127.0.0.1:5173', H5_PORT: '8081' }),
|
||||
'http://127.0.0.1:8081',
|
||||
);
|
||||
assert.equal(
|
||||
resolvePageDataDeliveryBaseUrl({
|
||||
MEMIND_PAGE_DATA_DELIVERY_BASE_URL: 'http://127.0.0.1:8081',
|
||||
H5_PUBLIC_BASE_URL: 'http://127.0.0.1:5173',
|
||||
}),
|
||||
'http://127.0.0.1:8081',
|
||||
);
|
||||
assert.equal(
|
||||
resolvePageDataDeliveryBaseUrl({ H5_PUBLIC_BASE_URL: 'https://m.tkmind.cn' }),
|
||||
'https://m.tkmind.cn',
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user