mirror of
https://github.com/discourse/discourse.git
synced 2026-08-08 17:53:55 +08:00
## What changed Adds `chat_integration_telegram_api_base_url` setting for the Telegram chat integration (discourse-chat-integration plugin) The setting defaults to `https://api.telegram.org`, so existing installations keep their current behavior. ## Why Some Discourse installations cannot reach `api.telegram.org` directly because Telegram is blocked or restricted by local network providers. This setting allows administrators to route Telegram Bot API requests through a trusted reverse proxy, such as a Cloudflare Worker, without patching the plugin. ## Cloudflare Worker example The following Worker can be deployed as a small Telegram Bot API proxy: ```js export default { async fetch(request) { const url = new URL(request.url); if ( !url.pathname.startsWith("/bot") && !url.pathname.startsWith("/file/bot") ) { return new Response("Not found", { status: 404 }); } url.hostname = "api.telegram.org"; url.protocol = "https:"; url.port = ""; return fetch(new Request(url, request)); }, }; ``` The proxy must be trusted because Telegram bot tokens are included in Bot API request paths. --------- Co-authored-by: Régis Hanol <regis@hanol.fr> |
||
|---|---|---|
| .. | ||
| fabricators | ||
| helpers | ||
| integration | ||
| jobs | ||
| lib/discourse_chat_integration | ||
| models | ||
| requests | ||
| services | ||
| support | ||
| system | ||
| dummy_provider.rb | ||