优化访客日志

This commit is contained in:
NewName
2025-05-03 15:55:13 +08:00
parent 288cbe6182
commit c87a7fbef2
2 changed files with 19 additions and 5 deletions

View File

@@ -199,10 +199,10 @@ class Database:
def add_access_log(self, ip_address, path, status, status_code):
"""添加访问日志"""
# 过滤掉内网IP地址
if (ip_address.startswith(('10.', '172.', '192.168.')) or
ip_address in ['127.0.0.1', 'localhost']):
return
# 注释掉内网IP过滤确保记录所有来源IP包括通过代理转发的
# if (ip_address.startswith(('10.', '172.', '192.168.')) or
# ip_address in ['127.0.0.1', 'localhost']):
# return
with self.get_connection() as conn:
conn.execute("""