Upload aller lokalen Dateien
This commit is contained in:
commit
cc536ee2e2
16 files changed
+2021
No files matched your search
@@ -0,0 +1,60 @@
|
||||
import re
|
||||
|
||||
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"
|
||||
|
||||
control_files = [
|
||||
'/pretix/src/pretix/control/templates/pretixcontrol/base.html',
|
||||
'/pretix/src/pretix/control/templates/pretixcontrol/auth/base.html',
|
||||
]
|
||||
|
||||
platform_footer_html = (
|
||||
'<div class="falkenthal-platform-bar">'
|
||||
'<div class="falkenthal-platform-info">'
|
||||
'<span>Technischer Plattformbetrieb: <strong class="ft-brand">FALKENTHAL</strong></span>'
|
||||
'<span class="ft-sep">·</span>'
|
||||
f'<a href="{PLATFORM_IMPRINT_URL}" target="_blank" rel="noopener">Plattform-Impressum</a>'
|
||||
'<span class="ft-sep">·</span>'
|
||||
f'<a href="{PLATFORM_PRIVACY_URL}" target="_blank" rel="noopener">Plattform-Datenschutz</a>'
|
||||
'<span class="ft-sep">·</span>'
|
||||
f'<a href="{THEME_REPO_URL}" target="_blank" rel="noopener">Theme & Quellcode (AGPLv3)</a>'
|
||||
'</div>'
|
||||
'</div>'
|
||||
'</footer>'
|
||||
)
|
||||
|
||||
for p in control_files:
|
||||
with open(p, 'r', encoding='utf-8') as f:
|
||||
c = f.read()
|
||||
c = re.sub(r'<link[^>]*rel=[\"\'](shortcut )?icon[\"\'][^>]*>', '', c, flags=re.I)
|
||||
if '/static/whitelabel/control.css' not in c:
|
||||
c = c.replace(
|
||||
'</head>',
|
||||
f'<link rel="icon" type="image/svg+xml" href="/static/whitelabel/favicon.svg?v={ASSET_VERSION}">'
|
||||
f'<link rel="shortcut icon" href="/static/whitelabel/favicon.svg?v={ASSET_VERSION}">'
|
||||
f'<link rel="stylesheet" type="text/css" href="/static/whitelabel/control.css?v={ASSET_VERSION}"></head>'
|
||||
)
|
||||
if 'falkenthal-platform-bar' not in c:
|
||||
c = c.replace('</footer>', platform_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'<link[^>]*rel=[\"\'](shortcut )?icon[\"\'][^>]*>', '', c, flags=re.I)
|
||||
if '/static/whitelabel/presale.css' not in c:
|
||||
c = c.replace(
|
||||
'</head>',
|
||||
f'<link rel="icon" type="image/svg+xml" href="/static/whitelabel/favicon.svg?v={ASSET_VERSION}">'
|
||||
f'<link rel="shortcut icon" href="/static/whitelabel/favicon.svg?v={ASSET_VERSION}">'
|
||||
f'<link rel="stylesheet" type="text/css" href="/static/whitelabel/presale.css?v={ASSET_VERSION}"></head>'
|
||||
)
|
||||
if 'falkenthal-platform-bar' not in c:
|
||||
c = c.replace('</footer>', 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}).")
|
||||
Reference in new issue
Block a user