feat: add geolocation to download logs (country, city via ip-api.com)

This commit is contained in:
mini
2026-02-18 23:28:39 +08:00
parent 4ac8cf2f66
commit 97c58ce3f8
6 changed files with 59 additions and 4 deletions

View File

@@ -42,6 +42,9 @@ class DownloadLog(Base):
user_agent = Column(Text, default="")
browser = Column(String(64), default="") # Chrome / Firefox / Safari / Edge / …
device = Column(String(32), default="") # desktop / mobile / tablet / bot
country_code = Column(String(8), default="") # e.g. CN
country = Column(String(128), default="") # e.g. China
city = Column(String(128), default="") # e.g. Shanghai
downloaded_at = Column(DateTime, default=datetime.utcnow, index=True)
video = relationship("Video", back_populates="logs")