tdlight-team / tdlight-telegram-bot-api

The TDLight Telegram Bot API is an actively enhanced fork of the original Bot API, featuring experimental user support, proxies, unlimited files size, and more.
https://t.me/TDLight
Boost Software License 1.0
124 stars 27 forks source link

Implement local download from https file url #42

Open luckydonald opened 3 years ago

luckydonald commented 3 years ago

So the original Bot servers lets url uploads be handled by the actual telegram backend.

This means the self hosted version of the API in your network doesn't solve the following use cases:

The latter being the reason why I looked into self host the API, as 5 MB for images is often not enough.

MarcoBuster commented 3 years ago

You can disable file limits as described by #3. I don't think add support to https to the project it's a good idea, use a reverse proxy.

luckydonald commented 3 years ago

No, I think you might have misunderstood what I meant, let me improve my explanation:

What I meant was like

GET /bot1234:abc/sendPhoto?chat_id=1234&photo=http://192.168.178.69:4458/some_image.png

If 192.168.178.69 is a purely local IP address, which is reachable for the bot-api server but not from outside (Telegram servers) it would fail. Additionally it is not possible to increase those file limits when using urls (instead of manually downloading and re-uploading those yourself or using existing file_ids). Lastly, only https:// seems supported by that.

Which is a bummer, as I actually wanted to increase the size limits with uploads by url, and the fact that you send the API server a url but some other server in some datacenter attempts to download the file instead can be confusing as well.

SonicCodes commented 3 years ago

Yes this was what happened to me. but you can try downloading the data as a buffer and send it to the local server, I don't think it'd have that much over-head or latency difference.