tdlight-team/tdlight-telegram-bot-api

Implement local download from https file url

luckydonald opened this issue · 3 comments

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:

  • Having the files accessible only in the local network
  • Being able to increase the size limits (5 MB max size for photos and 20 MB max for other types of content.)

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

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.

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.

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.