fix: inject Rybbit tracking on m.tkmind.cn publication pages
Memind CI / Test, build, and release guards (push) Successful in 1m36s

Publication routes and share shells were missing the Rybbit tracker, and
bootstrap now reuses the stored MindSpace analytics secret when Rybbit env
secret is absent.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-07-27 22:10:07 +08:00
parent 48c61a3279
commit c7718c683b
9 changed files with 199 additions and 8 deletions
+11
View File
@@ -26,6 +26,17 @@ test('rybbit config is disabled unless explicitly enabled and configured', () =>
assert.equal(config.scriptPath, '/rybbit/script.js');
});
test('rybbit config can reuse stored analytics secret', () => {
const config = resolveMindSpaceRybbitConfig({
MEMIND_RYBBIT_ENABLED: 'true',
MEMIND_RYBBIT_SITE_ID: '2',
}, {
idSecret: 'stored-secret',
});
assert.equal(config.enabled, true);
assert.equal(config.idSecret, 'stored-secret');
});
test('injects one local same-origin rybbit tracker with page dimensions', () => {
const html = '<!doctype html><html><head><title>Demo</title></head><body><h1>Demo</h1></body></html>';
const out = injectMindSpaceRybbit(html, {