Telegram Bots als eigenständige Entität mit eigener Page
- Neue Tabelle 'telegram_bots' (bot_id, name, bot_token, webhook_secret, is_public)
- Automatische Migration bestehender Session-Telegram-Configs in telegram_bots
- Sessions verweisen via telegram_bot_id auf Bot (mehrere Sessions pro Bot möglich)
- Webhook-URL: /api/telegram/webhook/{botId} statt {sessionId}
- Eigene Telegram-Bot-Page (wie Agent/Cronjob/Session) statt Modal
- Bot-Page: Name, Token, Secret, Webhook-Verwaltung (registrieren/status/entfernen), Löschen
- Dashboard: Telegram Bots Section mit Cards (Name, maskierter Token, Session-Count)
- Session-Page: Bot-Picker (wie Agent-Picker) statt Token-Input, Chat-ID readonly + Unlink-Button
- Public-Flag: Bot kann von anderen Usern in ihren Sessions ausgewählt werden
- Vereinfacht: 1 Session = max. 1 Telegram Chat, allowed_chat_ids entfällt
- /start zeigt Chat-ID an, /unlink entfernt (Unlink nur über Web-UI)
- Nachrichten-Routing: Bot + Chat-ID → Session Lookup
This commit is contained in:
1 parent
3b7bdb7a20
commit
ec73ccd71e
13 files changed
+907
-371
No files matched your search
@@ -35,8 +35,8 @@ registerPage('dashboard', {
|
||||
|
||||
// Telegram-Config parallel pro Session laden (sessions werden gleich geladen)
|
||||
|
||||
const [agents, sessions, cronjobs, shares] = await Promise.all([
|
||||
apiGetAgents(), apiGetSessions(), apiGetCronjobs(), apiListShares()
|
||||
const [agents, sessions, cronjobs, shares, telegramBots] = await Promise.all([
|
||||
apiGetAgents(), apiGetSessions(), apiGetCronjobs(), apiListShares(), apiGetTelegramBots()
|
||||
]);
|
||||
const agentMap = {};
|
||||
for (const a of agents) agentMap[a.agentId] = a;
|
||||
@@ -253,6 +253,24 @@ registerPage('dashboard', {
|
||||
// Neuer Cronjob Button
|
||||
document.getElementById('newCronjobBtn').addEventListener('click', () => navigateTo('cronjob'));
|
||||
|
||||
// Telegram Bots
|
||||
const tgGrid = document.getElementById('telegramBotCards');
|
||||
tgGrid.innerHTML = '';
|
||||
|
||||
for (const bot of telegramBots) {
|
||||
const card = buildTelegramBotCard(bot);
|
||||
|
||||
// Card klickbar → direkt zur Edit-Seite
|
||||
card.classList.add('clickable');
|
||||
card.addEventListener('click', () => navigateTo('telegram-bot', { id: bot.botId }));
|
||||
|
||||
tgGrid.appendChild(card);
|
||||
}
|
||||
|
||||
document.getElementById('newTelegramBotBtn').addEventListener('click', () => {
|
||||
navigateTo('telegram-bot');
|
||||
});
|
||||
|
||||
// Shared Links
|
||||
const sharedSection = document.getElementById('sharedLinksSection');
|
||||
const sharedGrid = document.getElementById('sharedLinksCards');
|
||||
|
||||
Reference in new issue
Block a user