Add consent site + consent-only follow recorder bot
Discord OAuth login -> explicit consent (3 checkboxes, versioned text) -> bot follows consenting users into voice channels and records only their per-user streams. Revoke stops recording immediately and optionally deletes files; consent log kept; export to training wav only for active consents. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
30
consent-recorder/src/main.ts
Normal file
30
consent-recorder/src/main.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import path from 'node:path';
|
||||
import { FollowBot } from './bot.js';
|
||||
import { loadConfig, loadDotEnv } from './config.js';
|
||||
import { Store } from './db.js';
|
||||
import { createSite } from './site.js';
|
||||
|
||||
loadDotEnv(path.resolve('.env'));
|
||||
const cfg = loadConfig();
|
||||
const store = new Store(path.join(cfg.dataDir, 'consent.db'));
|
||||
const bot = new FollowBot(cfg, store);
|
||||
const site = createSite(cfg, store, {
|
||||
consentChanged: (id) => bot.consentChanged(id),
|
||||
recordingNow: (id) => bot.recordingNow(id),
|
||||
});
|
||||
|
||||
site.listen(cfg.port, cfg.host, () => console.log(`[site] ${cfg.publicUrl} (http://${cfg.host}:${cfg.port})`));
|
||||
await bot.start();
|
||||
|
||||
let stopping = false;
|
||||
for (const sig of ['SIGINT', 'SIGTERM'] as const) {
|
||||
process.on(sig, async () => {
|
||||
if (stopping) return;
|
||||
stopping = true;
|
||||
console.log('[main] 끄는 중 (녹음 중인 파일 저장)');
|
||||
site.close();
|
||||
await bot.stop().catch(() => undefined);
|
||||
store.close();
|
||||
process.exit(0);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user