daleghent / nina-ground-station

NINA plugin - Ground Station
Mozilla Public License 2.0
13 stars 2 forks source link

Telegram bot API server is blocked in mainland China #1

Open CoolTowel opened 2 years ago

CoolTowel commented 2 years ago

I have a telescope set up in China. For the well-known reason, the Telegram service cannot be accessed in mainland China. I want to use this NINA plugin by a reverse proxy. But I'm totally new to C# and can't find where to modify the code to change the API address to my reverse proxy address. I guess the api.telegram.org should be written in somewhere. Hopefully someone can help me point out where it is. Thanks in advance!

CoolTowel commented 2 years ago

Found it in https://github.com/TelegramBots/Telegram.Bot/blob/master/src/Telegram.Bot/TelegramBotClient.cs

linuxkidd commented 2 years ago

fyi @CoolTowel -- it may be easiest to use a hosts file override for the api.telegram.org name. This would let you keep running stock code and not run into issues during upgrades.

More details on windows hosts file editing here.

You would want to create an entry with the IP of your Proxy, followed by the hostname api.telegram.org.

Example:

192.168.1.8  api.telegram.org
CoolTowel commented 2 years ago

fyi @CoolTowel -- it may be easiest to use a hosts file override for the api.telegram.org name. This would let you keep running stock code and not run into issues during upgrades.

More details on windows hosts file editing here.

You would want to create an entry with the IP of your Proxy, followed by the hostname api.telegram.org.

Example:

192.168.1.8  api.telegram.org

Thank you very much! That is a better solution. I looked into it and found this method needs more settings in my server and making the computer on which NINA is running force trust in the certificate generated on my server. I don’t know if it is correct.

linuxkidd commented 2 years ago

Ah, yes... you can create a self-signed certificate, then add the Certificate Authority that you used to sign it, into the Windows CA trust store. That would solve that portion of the issue. Google will be your friend here. :)

Best of luck!

CoolTowel commented 2 years ago

Ah, yes... you can create a self-signed certificate, then add the Certificate Authority that you used to sign it, into the Windows CA trust store. That would solve that portion of the issue. Google will be your friend here. :)

Best of luck!

Thank you! Just wanted to make sure I didn't choose the wrong way again : )

CoolTowel commented 2 years ago

fyi @CoolTowel -- it may be easiest to use a hosts file override for the api.telegram.org name. This would let you keep running stock code and not run into issues during upgrades.

More details on windows hosts file editing here.

You would want to create an entry with the IP of your Proxy, followed by the hostname api.telegram.org.

Example:

192.168.1.8  api.telegram.org

It doesn't work. The Great Fire Wall just block everything related to telegram not only the IP address. The esiest way may be using a VPN.

linuxkidd commented 2 years ago

Ah, bummer @CoolTowel ... best of luck with the VPN and your future telegram endeavors. I wonder if Pushover would be easier to get going just for notifications, since it's not a social network or person to person messaging app.

daleghent commented 2 years ago

Hi @CoolTowel . Would it be helpful if I investigated WeChat support? Is there another service you would recommend?

CoolTowel commented 2 years ago

Hi @daleghent, I successfully replaced the telegram API address and dent messages by recompiling the code. Personally, I don't use WeChat a lot. If there was a way to push messages to WeChat, I'm sure astrophotographers in mainland China would be very happy. But I don't know if WeChat has a convenient interface like Telegram, as it is a very closed software. And I don't know if there are other services usable in mainland China, I guess the Pushover is also blocked in China. Because I am not in China I can ask my friends help me have some test. If you are willing to add some specific support for Chinese users, maybe I can help in some way.