fix(brand): require TKMind platform marker on wechat page delivery

Backfill missing platform-brand footer at serve time and block service-
account links when the HTML file omits data-mindspace-page-tag.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-07-04 14:15:42 +08:00
parent cd81c4b2bb
commit b5a88d9746
8 changed files with 79 additions and 14 deletions
+8
View File
@@ -3,6 +3,7 @@ import test from 'node:test';
import {
MINDSPACE_PAGE_TAG_ATTR,
MINDSPACE_PAGE_TAG_PLATFORM_BRAND,
ensurePlatformBrandFooter,
ensurePlatformBrandPageTags,
normalizePlatformBrandHtml,
prepareHtmlPageBrandMarkers,
@@ -28,3 +29,10 @@ test('prepareHtmlPageBrandMarkers keeps existing marker', () => {
const result = prepareHtmlPageBrandMarkers(html);
assert.equal(result.match(new RegExp(MINDSPACE_PAGE_TAG_ATTR, 'g'))?.length, 1);
});
test('ensurePlatformBrandFooter appends brand line when marker is missing', () => {
const html = '<html><body><main>content</main></body></html>';
const result = ensurePlatformBrandFooter(html);
assert.match(result, /data-mindspace-page-tag="platform-brand"/);
assert.match(result, /TKMind · 智趣/);
});