Files
blog/content/posts/commits/2026-02-23-commit-c03df13.md
Betty 360f0bb46e
All checks were successful
Hugo Build & Deploy / build-deploy (push) Successful in 6s
post: commit c03df13 in bojemoi-telegram
2026-02-23 15:25:23 +01:00

1.1 KiB

title, date, draft, tags, categories, summary, author
title date draft tags categories summary author
[bojemoi-telegram] telegram: add IPv6 support — ALLOWED_IP_RANGES + ip-api.com fallback 2026-02-23T15:25:22+01:00 false
commit
bojemoi-telegram
master
Git Activity
Commit c03df13 par Betty dans bojemoi-telegram Betty

Commit c03df13

Repository bojemoi-telegram
Branch master
Author Betty
Hash c03df130d577b4723e238a5f1c50785ee6aac1d0

Description

  • config.py: extend default ALLOWED_IP_RANGES to include ::/0 so IPv6 addresses pass the is_ip_allowed() check out of the box

  • crud.py: get_country_by_ip() now tries ip2location_db1 first (IPv4), then falls back to ip-api.com/json/{ip} for IPv6 (and IPv4 if ip2location fails); no API key required

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com

Files Changed

M	telegram-bot/config.py
M	telegram-bot/database/crud.py

Diff Summary

 telegram-bot/config.py        |  2 +-
 telegram-bot/database/crud.py | 27 ++++++++++++++++++++-------
 2 files changed, 21 insertions(+), 8 deletions(-)