Add smart ACK provider for WeChat MP replies
Replace fixed ackText with a rule-based AckProvider that picks response templates by message type and intent (translate, summary, rewrite, poster, ppt, mindmap, code, search, schedule). Pure sync, zero I/O, auto-falls back to config.ackText on any error. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import {
|
||||
allowPlazaEmbedFrame,
|
||||
appendPlazaEmbedQuery,
|
||||
injectPlazaEmbedBootstrap,
|
||||
isPlazaEmbedRequest,
|
||||
@@ -37,6 +38,16 @@ test('publishedPageCspForEmbed allows inline script', () => {
|
||||
assert.match(publishedPageCspForEmbed(true), /script-src 'unsafe-inline'/);
|
||||
});
|
||||
|
||||
test('allowPlazaEmbedFrame removes legacy X-Frame-Options header', () => {
|
||||
let removed = null;
|
||||
allowPlazaEmbedFrame({
|
||||
removeHeader(name) {
|
||||
removed = name;
|
||||
},
|
||||
});
|
||||
assert.equal(removed, 'X-Frame-Options');
|
||||
});
|
||||
|
||||
test('stripPublicationHtmlCspMeta removes inline CSP meta tags', () => {
|
||||
const html =
|
||||
'<html><head><meta http-equiv="Content-Security-Policy" content="script-src \'none\'"></head><body></body></html>';
|
||||
@@ -52,4 +63,13 @@ test('preparePublicationHtmlForEmbed strips CSP and injects bootstrap', () => {
|
||||
assert.doesNotMatch(out, /http-equiv="Content-Security-Policy"/);
|
||||
assert.match(out, /plaza-embed-bootstrap/);
|
||||
assert.match(out, /plaza-embed-overrides/);
|
||||
assert.match(out, /\.hero\{height:auto!important;min-height:0!important/);
|
||||
});
|
||||
|
||||
test('embed bootstrap does not cap tall publication height', () => {
|
||||
const html = '<!doctype html><html><body><main style="height:24000px">Tall</main></body></html>';
|
||||
const out = preparePublicationHtmlForEmbed(html);
|
||||
assert.doesNotMatch(out, /Math\.min\(measured,\s*16000\)/);
|
||||
assert.match(out, /body\.children\.length/);
|
||||
assert.match(out, /MutationObserver/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user