From 518b5f6323fa1e361358a454585ec77dab4b5139 Mon Sep 17 00:00:00 2001 From: paisley <8197966+su8su@users.noreply.github.com> Date: Tue, 10 Feb 2026 16:18:34 +0800 Subject: [PATCH] fix: correct Telegram allowlist configuration key (#31) --- electron/utils/channel-config.ts | 29 +++++++++++++++++++++++++++++ electron/utils/whatsapp-login.ts | 4 ++++ src/types/channel.ts | 8 ++++++++ 3 files changed, 41 insertions(+) diff --git a/electron/utils/channel-config.ts b/electron/utils/channel-config.ts index bc2d350cc..cf1612de5 100644 --- a/electron/utils/channel-config.ts +++ b/electron/utils/channel-config.ts @@ -120,6 +120,23 @@ export function saveChannelConfig( } } + // Special handling for Telegram: convert allowedUsers string to allowlist array + if (channelType === 'telegram') { + const { allowedUsers, ...restConfig } = config; + transformedConfig = { ...restConfig }; + + if (allowedUsers && typeof allowedUsers === 'string') { + const users = allowedUsers.split(',') + .map(u => u.trim()) + .filter(u => u.length > 0); + + if (users.length > 0) { + transformedConfig.allowFrom = users; // Use 'allowFrom' (correct key) + // transformedConfig.groupPolicy = 'allowlist'; // Default is allowlist + } + } + } + // Merge with existing config currentConfig.channels[channelType] = { ...currentConfig.channels[channelType], @@ -177,6 +194,18 @@ export function getChannelFormValues(channelType: string): Record setTimeout(resolve, 2000)); + this.emit('success', { accountId }); } } catch (innerErr) { diff --git a/src/types/channel.ts b/src/types/channel.ts index 0a7c289d7..941ffcf09 100644 --- a/src/types/channel.ts +++ b/src/types/channel.ts @@ -127,6 +127,14 @@ export const CHANNEL_META: Record = { required: true, envVar: 'TELEGRAM_BOT_TOKEN', }, + { + key: 'allowedUsers', + label: 'Allowed User IDs (optional)', + type: 'text', + placeholder: 'e.g. 123456789, 987654321', + description: 'Comma separated list of User IDs allowed to use the bot. Leave empty to allow everyone (if public) or require pairing.', + required: false, + }, ], instructions: [ 'Open Telegram and search for @BotFather',