feat: Add HTTP/HTTPS proxy support for Telegram API connections#1
Draft
feat: Add HTTP/HTTPS proxy support for Telegram API connections#1
Conversation
- Add getTelegramProxyUrl() and proxyFetchOptions() helpers in telegram-utils.ts using Node.js built-in undici ProxyAgent (no new dependencies) - Validate proxy URL protocol (http/https only) before use - Apply proxy to all Telegram fetch calls: callTelegramApi, resolveBotIdentity, getUpdates polling loop, and media downloads (getFile + file download) - Add telegram_proxy_url to settings API keys for SQLite persistence - Add proxy URL input field with client-side validation in TelegramBridgeSection UI - Add i18n strings (en + zh) for proxy label, description, placeholder, hint, and validation error messages Co-authored-by: cccssw <1233438+cccssw@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add proxy server support for Telegram connection
feat: Add HTTP/HTTPS proxy support for Telegram API connections
Mar 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Telegram API requests had no proxy support, making the integration non-functional in regions where Telegram is blocked.
Changes
Core proxy utility (
telegram-utils.ts)getTelegramProxyUrl()readstelegram_proxy_urlfrom SQLite settingsproxyFetchOptions()validates the URL (http/https only), instantiatesundici.ProxyAgent(bundled with Node.js 22+ — zero new dependencies), and returns{ dispatcher }to spread intofetch()initCoverage — proxy applied to all 5 outbound Telegram fetch sites:
callTelegramApi()(used by all bot methods +sendMessageDraft)resolveBotIdentity()(getMe) intelegram-adapter.tsgetUpdatesloop intelegram-adapter.tsgetFileAPI call intelegram-media.tstelegram-media.tsSettings persistence (
route.ts)telegram_proxy_urladded toTELEGRAM_KEYSfor read/write via the existing settings APIUI (
TelegramBridgeSection.tsx)http:///https://URLs before savingi18n — 5 new keys added to
en.tsandzh.ts(label, description, placeholder, hint, two validation error messages)💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.