feat: secure Telegram access and connect AI Office

This commit is contained in:
pompy 2026-08-20 11:56:53 +08:00
parent e3ae772106
commit b0606159e0
30 changed files with 2045 additions and 302 deletions

View file

@ -0,0 +1,20 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { normalizeTelegramAllowedUsers } from '../../../plugin-src/host/channels/telegram/production.mjs';
test('Telegram production normalizes and validates private-message allowlists', () => {
assert.deepEqual(normalizeTelegramAllowedUsers(undefined), []);
assert.deepEqual(
normalizeTelegramAllowedUsers([6087707998, '1202499116', '6087707998']),
['6087707998', '1202499116'],
);
assert.throws(
() => normalizeTelegramAllowedUsers('6087707998'),
/must be an array/,
);
assert.throws(
() => normalizeTelegramAllowedUsers([0, '-100123', 'username']),
/invalid Telegram User ID/,
);
});