Small bug fixes

This commit is contained in:
R. Miles McCain 2020-04-14 17:33:57 -04:00
parent 6d542e81e5
commit d84ed28ef7
No known key found for this signature in database
GPG Key ID: 91CB47BDDF2671A5
6 changed files with 8 additions and 8 deletions

View File

@ -44,7 +44,7 @@ def ingress_request(
service_uuid, tracker, time, payload, ip, location, user_agent, identifier="" service_uuid, tracker, time, payload, ip, location, user_agent, identifier=""
): ):
try: try:
service = Service.objects.get(uuid=service_uuid, status=Service.ACTIVE) service = Service.objects.get(pk=service_uuid, status=Service.ACTIVE)
log.debug(f"Linked to service {service}") log.debug(f"Linked to service {service}")
ip_data = _geoip2_lookup(ip) ip_data = _geoip2_lookup(ip)

View File

@ -15,8 +15,8 @@ from ..tasks import ingress_request
def ingress(request, service_uuid, identifier, tracker, payload): def ingress(request, service_uuid, identifier, tracker, payload):
time = timezone.now() time = timezone.now()
client_ip, is_routable = get_client_ip(request) client_ip, is_routable = get_client_ip(request)
location = request.META.get("HTTP_REFERER") location = request.META.get("HTTP_REFERER") or ""
user_agent = request.META.get("HTTP_USER_AGENT") user_agent = request.META.get("HTTP_USER_AGENT") or ""
ingress_request.delay( ingress_request.delay(
service_uuid, service_uuid,

View File

@ -80,7 +80,7 @@
<tbody> <tbody>
{% for location in stats.locations %} {% for location in stats.locations %}
<tr> <tr>
<td>{{location.location|urldisplay}}</td> <td>{{location.location|default:"Unknown"|urldisplay}}</td>
<td class="rf">{{location.count|intcomma}}</td> <td class="rf">{{location.count|intcomma}}</td>
</tr> </tr>
{% endfor %} {% endfor %}

View File

@ -73,7 +73,7 @@
</div> </div>
<div class="md:flex card ~neutral !low flex-grow justify-between"> <div class="md:flex card ~neutral !low flex-grow justify-between">
<div class="mb-4 md:mb-0 md:w-1/2"> <div class="mb-4 md:mb-0 md:w-1/2">
<p class="label font-medium text-lg">{{hit.location|urlize}}</p> <p class="label font-medium text-lg">{{hit.location|default:"Unknown"|urlize}}</p>
{% if hit.referrer %} {% if hit.referrer %}
<p>via {{hit.referrer|urlize}}<p> <p>via {{hit.referrer|urlize}}<p>
{% endif %} {% endif %}

View File

@ -14,8 +14,8 @@
<p>Place the following snippet at the end of the <code>&lt;body&gt;</code> tag on any page you'd like to track.</p> <p>Place the following snippet at the end of the <code>&lt;body&gt;</code> tag on any page you'd like to track.</p>
<div class="card ~neutral !high font-mono text-sm"> <div class="card ~neutral !high font-mono text-sm">
{% filter force_escape %}<noscript><img {% filter force_escape %}<noscript><img
src="{{base_url}}/ingress/fc4008d3-f2fa-4500-9968-d96719e3819c/pixel.gif"></noscript> src="//{{request.site.domain}}/ingress/{{object.uuid}}/pixel.gif"></noscript>
<script src="{{base_url}}/ingress/fc4008d3-f2fa-4500-9968-d96719e3819c/identifier/script.js"></script> <script src="//{{request.site.domain}}/ingress/{{object.uuid}}/identifier/script.js"></script>
{% endfilter %} {% endfilter %}
</div> </div>
<hr class="sep h-4"> <hr class="sep h-4">

View File

@ -214,7 +214,7 @@ SITE_ID = 1
# Celery # Celery
CELERY_TASK_ALWAYS_EAGER = True CELERY_TASK_ALWAYS_EAGER = os.getenv("CELERY_TASK_ALWAYS_EAGER", "False") == "True"
CELERY_BROKER_URL = os.getenv("CELERY_BROKER_URL") CELERY_BROKER_URL = os.getenv("CELERY_BROKER_URL")
CELERY_REDIS_SOCKET_TIMEOUT = 15 CELERY_REDIS_SOCKET_TIMEOUT = 15