|
|
@@ -20,7 +20,7 @@ import re
|
|
20
|
20
|
from counter.models import Counter, Reset
|
|
21
|
21
|
from bot.models import TelegramUser, TelegramUserCheck, TelegramUserChat, TelegramChat
|
|
22
|
22
|
|
|
23
|
|
-telegram_ips = ['149.154.167.' + str(i) for i in range(197, 234)]
|
|
|
23
|
+telegram_ips = ['149.154.' + str(i) + '.' for i in range(160, 176)] + ['91.108.' + str(i) + '.' for i in range(4, 8)]
|
|
24
|
24
|
telegram_url = 'https://api.telegram.org/bot' + settings.BOT_TELEGRAM_KEY + '/'
|
|
25
|
25
|
telegram_bot_id = settings.BOT_TELEGRAM_ID
|
|
26
|
26
|
telegram_bot_name = settings.BOT_TELEGRAM_NAME
|
|
|
@@ -59,11 +59,8 @@ def link(request, verif_key):
|
|
59
|
59
|
|
|
60
|
60
|
@csrf_exempt
|
|
61
|
61
|
def webhook(request):
|
|
62
|
|
- ip = request.META.get('REMOTE_ADDR')
|
|
|
62
|
+ ip = re.sub(r"\.([^.]+)$", '.', request.META.get('REMOTE_ADDR'))
|
|
63
|
63
|
|
|
64
|
|
- # Uncomment the following two lines, and correctly configure the
|
|
65
|
|
- # reverse proxy to enable the security, or everyone will be able
|
|
66
|
|
- # to put le seum to everyone
|
|
67
|
64
|
if not ip in telegram_ips:
|
|
68
|
65
|
return HttpResponse(status=401)
|
|
69
|
66
|
|