DUNGEONS-33: clean shutdown locks and add optional Telegram 2048

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
2026-09-06 09:14:08 +05:00
parent eb135ac6ef
commit 5e7b24cbaf
9 changed files with 240 additions and 22 deletions

View File

@@ -5,6 +5,15 @@ import { safeNext, readCookie, clientIp } from '../src/http.js';
const base = { SESSION_SECRET: 'a-secure-test-secret-longer-than-32-chars' };
test('Telegram games are optional and use a BotFather short name', () => {
assert.equal(loadConfig(base).telegram.gameShortName, '');
assert.equal(loadConfig({ ...base, TELEGRAM_GAME_SHORT_NAME: ' ' }).telegram.gameShortName, '');
assert.equal(loadConfig({ ...base, TELEGRAM_GAME_SHORT_NAME: ' dungeons_2048 ' }).telegram.gameShortName, 'dungeons_2048');
for (const name of ['@gamebot', 'https://t.me/gamebot?game=2048', 'my game', 'a'.repeat(31)]) {
assert.throws(() => loadConfig({ ...base, TELEGRAM_GAME_SHORT_NAME: name }), /TELEGRAM_GAME_SHORT_NAME/);
}
});
test('configuration rejects unsafe origins, weak secrets, invalid numbers, and incomplete bots', () => {
for (const options of [
{ SESSION_SECRET: '' }, { SESSION_SECRET: 'replace-with-a-random-secret-at-least-32-characters' },