diff --git a/Dockerfile b/Dockerfile index 61c3462..4950ca7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,11 +12,11 @@ RUN pip3 install --no-cache-dir \ pretix-pages \ /tmp/pretix-falkenthal-theme -# 3. Primäre Fallback-Farbwerte (#3b1c4a) im Quellbaum auf Royalblau/Indigo umstellen -# (Veranstalter können ihre Shop-Farben weiterhin frei im Web-Interface überschreiben) +# 3. Primäre Fallback-Farbwerte (#3b1c4a) im Quellbaum konsistent auf Indigo (#4f46e5) umstellen +# (Veranstalter können ihre Shop-Farben weiterhin frei im Web-Interface auf Veranstalter- & Event-Ebene überschreiben) RUN sed -i 's/#3b1c4a/#4f46e5/gI' /pretix/src/pretix/base/settings.py && \ find /pretix/src/pretix -type f \( -name "*.scss" -o -name "*.less" -o -name "*.css" \) -exec sed -i \ - -e 's/#3b1c4a/#2563eb/gI' \ + -e 's/#3b1c4a/#4f46e5/gI' \ -e 's/#5f2977/#4f46e5/gI' \ -e 's/#7f4a88/#475569/gI' \ -e 's/#8e44ad/#4f46e5/gI' \ @@ -36,7 +36,7 @@ USER root # 6. Vorkompilierte CSS-Dateien bereinigen & statische Theme-Assets bereitstellen RUN find /pretix/src/pretix/static.dist -type f -name "*.css" -exec sed -i \ - -e 's/#3b1c4a/#2563eb/gI' \ + -e 's/#3b1c4a/#4f46e5/gI' \ -e 's/#5f2977/#4f46e5/gI' \ -e 's/#7f4a88/#475569/gI' \ -e 's/#6c3386/#4f46e5/gI' \ diff --git a/patch_templates.py b/patch_templates.py index e7d0d9b..5badcfc 100644 --- a/patch_templates.py +++ b/patch_templates.py @@ -1,9 +1,11 @@ +import os import re +import sys THEME_REPO_URL = "https://git.falkenthal.me/falkenthal/pretix-falkenthal-theme" PLATFORM_IMPRINT_URL = "https://tickets.falkenthal.me/impressum" PLATFORM_PRIVACY_URL = "https://tickets.falkenthal.me/datenschutz" -ASSET_VERSION = "1.7.3" +ASSET_VERSION = "1.8.0" control_files = [ '/pretix/src/pretix/control/templates/pretixcontrol/base.html', @@ -25,36 +27,115 @@ platform_footer_html = ( '' ) +# 1. Control & Auth Templates patchen (Plattform-Backend: immer Falkenthal-Branding) for p in control_files: + if not os.path.exists(p): + print(f"ERROR: Expected template not found: {p}", file=sys.stderr) + sys.exit(1) + with open(p, 'r', encoding='utf-8') as f: c = f.read() + + # Standard-Pretix-Favicon im Backend durch Falkenthal-Favicon ersetzen c = re.sub(r']*rel=[\"\'](shortcut )?icon[\"\'][^>]*>', '', c, flags=re.I) + + # Eindeutige Body-Klasse für Auth/Login-Seiten setzen (verhindert CSS-Leaks im normalen Backend) + if p.endswith('auth/base.html') and 'falkenthal-auth-body' not in c: + if '
]*)class=["\']([^"\']*)["\']', + r'' not in c: + print(f"ERROR: tag not found in {p}", file=sys.stderr) + sys.exit(1) c = c.replace( '', f'' f'' f'' ) + if 'falkenthal-platform-bar' not in c: + if '' not in c: + print(f"ERROR: tag not found in {p}", file=sys.stderr) + sys.exit(1) c = c.replace('', platform_footer_html) + with open(p, 'w', encoding='utf-8') as f: f.write(c) +# 2. Presale Template patchen (Ticketshop: Veranstalter-Favicons respektieren, Fallback = Falkenthal) presale_file = '/pretix/src/pretix/presale/templates/pretixpresale/base.html' +if not os.path.exists(presale_file): + print(f"ERROR: Expected template not found: {presale_file}", file=sys.stderr) + sys.exit(1) + with open(presale_file, 'r', encoding='utf-8') as f: c = f.read() -c = re.sub(r']*rel=[\"\'](shortcut )?icon[\"\'][^>]*>', '', c, flags=re.I) + +# Nur die statischen Standard-Pretix-Favicon-Fallbacks ersetzen, damit individuelle +# Veranstalter-/Event-Favicons ({% if request.event.settings.favicon %}) erhalten bleiben! +c = re.sub( + r']*rel=[\"\'](shortcut )?icon[\"\'][^>]*static\s+[\"\']pretixbase/img/favicon[^\"\']*[\"\'][^>]*>', + '', + c, + flags=re.I, +) +# Falls in einem {% else %}-Zweig der Standard-Favicon-Block nun leer wäre oder direkt vor : if '/static/whitelabel/presale.css' not in c: - c = c.replace( - '', + if '' not in c: + print(f"ERROR: tag not found in {presale_file}", file=sys.stderr) + sys.exit(1) + presale_head_inject = ( + '{% if not request.event or not request.event.settings.favicon %}' f'' f'' + '{% endif %}' f'' ) + c = c.replace('', presale_head_inject) + if 'falkenthal-platform-bar' not in c: + if '' not in c: + print(f"ERROR: tag not found in {presale_file}", file=sys.stderr) + sys.exit(1) c = c.replace('', platform_footer_html) + with open(presale_file, 'w', encoding='utf-8') as f: f.write(c) -print(f"Pretix templates patched successfully (v{ASSET_VERSION}).") +# 3. Globale Fehlerseiten (400, 403, 404, 500, 503) mit Plattform-Rechtstexten ausstatten +error_templates_dir = '/pretix/src/pretix/base/templates' +for err_name in ['400.html', '403.html', '403_csrf.html', '404.html', '500.html', '503.html']: + err_path = os.path.join(error_templates_dir, err_name) + if os.path.exists(err_path): + with open(err_path, 'r', encoding='utf-8') as f: + ec = f.read() + if 'falkenthal-platform-bar' not in ec and '