DUNGEONS-30: add access gateway with Telegram and Discord approvals

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
2026-09-05 17:09:53 +05:00
commit b87a8ef70e
30 changed files with 1838 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
import 'dotenv/config';
import { loadConfig } from '../src/config.js';
import { AccessStore } from '../src/store.js';
const [platform, userId] = process.argv.slice(2);
if (!['telegram', 'discord'].includes(platform) || !/^\d+$/.test(userId || '')) {
console.error('Stop the gateway first, then run: npm run sessions:revoke -- telegram|discord USER_ID');
process.exitCode = 1;
} else {
let store;
try {
store = new AccessStore(loadConfig());
store.change(state => {
state.sessions = state.sessions.filter(s => s.platform !== platform || s.userId !== userId);
for (const request of state.requests) {
if (request.platform === platform && request.user_id === userId) { request.status = 'revoked'; delete request.codeHash; }
}
});
console.log('Access numbers, pending requests and sessions revoked for the specified user. Restart the gateway.');
} catch (error) { console.error(error.message); process.exitCode = 1; }
finally { store?.close(); }
}