DUNGEONS-30: add access gateway with Telegram and Discord approvals
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
22
scripts/revoke-sessions.js
Normal file
22
scripts/revoke-sessions.js
Normal 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(); }
|
||||
}
|
||||
Reference in New Issue
Block a user