Add Do Not Track support
This commit is contained in:
@@ -42,12 +42,15 @@ def _geoip2_lookup(ip):
|
||||
|
||||
@shared_task
|
||||
def ingress_request(
|
||||
service_uuid, tracker, time, payload, ip, location, user_agent, identifier=""
|
||||
service_uuid, tracker, time, payload, ip, location, user_agent, dnt=False, identifier=""
|
||||
):
|
||||
try:
|
||||
service = Service.objects.get(pk=service_uuid, status=Service.ACTIVE)
|
||||
log.debug(f"Linked to service {service}")
|
||||
|
||||
if dnt and service.respect_dnt:
|
||||
return
|
||||
|
||||
ip_data = _geoip2_lookup(ip)
|
||||
log.debug(f"Found geoip2 data")
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ def ingress(request, service_uuid, identifier, tracker, payload):
|
||||
client_ip, is_routable = get_client_ip(request)
|
||||
location = request.META.get("HTTP_REFERER", "").strip()
|
||||
user_agent = request.META.get("HTTP_USER_AGENT", "").strip()
|
||||
dnt = request.META.get("HTTP_DNT", "0").strip() == "1"
|
||||
|
||||
ingress_request.delay(
|
||||
service_uuid,
|
||||
@@ -27,7 +28,8 @@ def ingress(request, service_uuid, identifier, tracker, payload):
|
||||
client_ip,
|
||||
location,
|
||||
user_agent,
|
||||
identifier,
|
||||
dnt=dnt,
|
||||
identifier=identifier,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user