import re
THEME_REPO_URL = "https://git.falkenthal.me/falkenthal/pretix-falkenthal-theme"
control_files = [
'/pretix/src/pretix/control/templates/pretixcontrol/base.html',
'/pretix/src/pretix/control/templates/pretixcontrol/auth/base.html',
]
footer_Html = (
f' · '
f'Theme-Plugin (Quellcode)'
)
for p in control_files:
with open(p, 'r', encoding='utf-8') as f:
c = f.read()
c = re.sub(r']*rel=[\"\'](shortcut )?icon[\"\'][^>]*>', '', c, flags=re.I)
if '/static/whitelabel/control.css' not in c:
c = c.replace(
'',
''
''
''
)
if THEME_REPO_URL not in c:
c = c.replace('', footer_Html)
with open(p, 'w', encoding='utf-8') as f:
f.write(c)
presale_file = '/pretix/src/pretix/presale/templates/pretixpresale/base.html'
with open(presale_file, 'r', encoding='utf-8') as f:
c = f.read()
c = re.sub(r']*rel=[\"\'](shortcut )?icon[\"\'][^>]*>', '', c, flags=re.I)
if '/static/whitelabel/presale.css' not in c:
c = c.replace(
'',
''
''
''
)
if THEME_REPO_URL not in c:
c = c.replace('', footer_Html)
with open(presale_file, 'w', encoding='utf-8') as f:
f.write(c)
print("Pretix templates patched successfully (v1.7.3).")