feat: Add oxitraffic support
This commit is contained in:
		@@ -1,3 +1,4 @@
 | 
			
		||||
{% load custom_tags %}
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en">
 | 
			
		||||
<head>
 | 
			
		||||
@@ -14,7 +15,7 @@
 | 
			
		||||
    <link rel="apple-touch-icon" sizes="180x180" href="{% static 'fellchensammlung/favicon/apple-touch-icon.png' %}">
 | 
			
		||||
    <link rel="icon" type="image/png" sizes="32x32" href="{% static 'fellchensammlung/favicon/favicon-32x32.png' %}">
 | 
			
		||||
    <link rel="icon" type="image/png" sizes="16x16" href="{% static 'fellchensammlung/favicon/favicon-16x16.png' %}">
 | 
			
		||||
 | 
			
		||||
    {% get_oxitraffic_script_if_enabled %}
 | 
			
		||||
</head>
 | 
			
		||||
<body>
 | 
			
		||||
{% block header %}
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,7 @@ import markdown
 | 
			
		||||
from django import template
 | 
			
		||||
from django.template.defaultfilters import stringfilter
 | 
			
		||||
from django.utils.safestring import mark_safe
 | 
			
		||||
from notfellchen import settings
 | 
			
		||||
 | 
			
		||||
register = template.Library()
 | 
			
		||||
 | 
			
		||||
@@ -30,6 +31,7 @@ def join_link(value, arg):
 | 
			
		||||
def get_type(value):
 | 
			
		||||
    return type(value)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@register.filter
 | 
			
		||||
@stringfilter
 | 
			
		||||
def render_markdown(value):
 | 
			
		||||
@@ -37,3 +39,11 @@ def render_markdown(value):
 | 
			
		||||
    html = md.convert(value)
 | 
			
		||||
 | 
			
		||||
    return mark_safe(html)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@register.simple_tag
 | 
			
		||||
def get_oxitraffic_script_if_enabled():
 | 
			
		||||
    if settings.OXITRAFFIC_ENABLED:
 | 
			
		||||
        return mark_safe(f'<script type="module" src="https://{settings.OXITRAFFIC_BASE_URL}/count.js"></script>')
 | 
			
		||||
    else:
 | 
			
		||||
        return ""
 | 
			
		||||
 
 | 
			
		||||
@@ -82,6 +82,10 @@ LOCALE_PATHS = [os.path.join(BASE_DIR, 'locale')]
 | 
			
		||||
""" GEOCODING """
 | 
			
		||||
GEOCODING_API_URL = config.get("geocoding", "api_url", fallback="https://nominatim.hyteck.de/search")
 | 
			
		||||
 | 
			
		||||
""" OxiTraffic"""
 | 
			
		||||
OXITRAFFIC_ENABLED = config.get("tracking", "oxitraffic_enabled", fallback=False)
 | 
			
		||||
OXITRAFFIC_BASE_URL = config.get("tracking", "oxitraffic_base_url", fallback="")
 | 
			
		||||
 | 
			
		||||
""" E-MAIL  """
 | 
			
		||||
console_only = config.getboolean("mail", "console_only", fallback="true")
 | 
			
		||||
EMAIL_SUBJECT_PREFIX = config.get("mail", "prefix", fallback="[notfellchen]]")
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user