Compare commits
13 Commits
8efc001bf7
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 89700afbfa | |||
| 087f854247 | |||
| 75c2d0b323 | |||
| 18d5bec9e3 | |||
| b13a7ab724 | |||
| a79806038d | |||
| a02377a1d4 | |||
| f04df44d93 | |||
| 6c2a13e578 | |||
| 7b1f143cec | |||
| 19d457bde6 | |||
| 5256d4cbbf | |||
| 238830b779 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -14,3 +14,6 @@ venv/
|
|||||||
# OS
|
# OS
|
||||||
.DS_Store
|
.DS_Store
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
|
|
||||||
|
# Configuration file
|
||||||
|
config.yaml
|
||||||
|
|||||||
@@ -10,3 +10,4 @@ processing:
|
|||||||
server:
|
server:
|
||||||
host: "0.0.0.0"
|
host: "0.0.0.0"
|
||||||
port: 8000
|
port: 8000
|
||||||
|
root_path: "/cf-zeiten"
|
||||||
@@ -55,7 +55,7 @@ def get_upcoming_events(days_to_show=None, limit=None):
|
|||||||
|
|
||||||
# PRIORITÄT 2: Tage-Logik
|
# PRIORITÄT 2: Tage-Logik
|
||||||
ende = heute + timedelta(days=int(days_to_show))
|
ende = heute + timedelta(days=int(days_to_show))
|
||||||
return [e for e in _cache["events"] if heute <= e[date_col] <= ende]
|
return [e for e in _cache["events"] if heute <= e[date_col] < ende]
|
||||||
|
|
||||||
def get_remarks():
|
def get_remarks():
|
||||||
if _is_cache_valid() and _cache["remarks"] is not None:
|
if _is_cache_valid() and _cache["remarks"] is not None:
|
||||||
|
|||||||
10
main.py
10
main.py
@@ -11,4 +11,12 @@ app.include_router(web_router)
|
|||||||
app.mount("/static", StaticFiles(directory="static"), name="static")
|
app.mount("/static", StaticFiles(directory="static"), name="static")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
uvicorn.run(app, host=config['server']['host'], port=config['server']['port'])
|
root_p = config['server'].get('root_path', "")
|
||||||
|
uvicorn.run(
|
||||||
|
"main:app",
|
||||||
|
reload=True,
|
||||||
|
host=config['server']['host'],
|
||||||
|
port=config['server']['port'],
|
||||||
|
root_path=root_p,
|
||||||
|
proxy_headers=True, # Wichtig für Caddy
|
||||||
|
forwarded_allow_ips="*")
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ async def admin_page(request: Request):
|
|||||||
"config_days": config['processing']['days_to_show']
|
"config_days": config['processing']['days_to_show']
|
||||||
})
|
})
|
||||||
|
|
||||||
@router.get("/cache-clear")
|
@router.get("/cache-clear", name="clear_cache")
|
||||||
async def clear_cache():
|
async def clear_cache(request: Request):
|
||||||
invalidate_cache()
|
invalidate_cache()
|
||||||
return RedirectResponse(url="/")
|
# Nutzt url_for, um den Redirect-Pfad inkl. root_path zu generieren
|
||||||
|
return RedirectResponse(url=request.url_for("admin_page"))
|
||||||
@@ -16,16 +16,14 @@
|
|||||||
}
|
}
|
||||||
.card { border: 1px solid #ddd; padding: 20px; margin-bottom: 20px; border-radius: 8px; }
|
.card { border: 1px solid #ddd; padding: 20px; margin-bottom: 20px; border-radius: 8px; }
|
||||||
|
|
||||||
/* Flex-Container für die Linksbündigkeit (Standard) */
|
|
||||||
.input-row {
|
.input-row {
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-start; /* Alles nach links */
|
justify-content: flex-start;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 25px; /* Abstand zwischen den Paaren (Tage / Zeilen) */
|
gap: 25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Gruppiert Label und Input eng zusammen */
|
|
||||||
.input-group {
|
.input-group {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -61,17 +59,17 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="action-row">
|
<div class="action-row">
|
||||||
<a id="preview_link" href="/zeiten?test=1" target="_blank" class="btn" style="background: #2ed573;">➔ Vorschau mit Test-Hintergrund</a>
|
<a id="preview_link" href="{{ url_for('public_table') }}?test=1" target="_blank" class="btn" style="background: #2ed573;">➔ Vorschau mit Test-Hintergrund</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<h3>Cache Management</h3>
|
<h3>Cache Management</h3>
|
||||||
<p>Der Cache wird automatisch alle 60 Minuten aktualisiert. Nach manuellen Änderungen in Google Sheets können Sie ihn hier sofort leeren.</p>
|
<p>Der Cache wird automatisch alle 60 Minuten aktualisiert. Nach manuellen Änderungen in Google Sheets können Sie ihn hier sofort leeren.</p>
|
||||||
<a href="/cache-clear" class="btn">Cache jetzt löschen</a>
|
<a href="{{ url_for('clear_cache') }}" class="btn">Cache jetzt löschen</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p><a href="/zeiten">← Zurück zur Ansicht</a></p>
|
<p><a href="{{ url_for('public_table') }}">← Zurück zur Ansicht</a></p>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const daysInput = document.getElementById('days_input');
|
const daysInput = document.getElementById('days_input');
|
||||||
@@ -81,18 +79,24 @@
|
|||||||
function updateUrl() {
|
function updateUrl() {
|
||||||
const days = parseInt(daysInput.value) || 0;
|
const days = parseInt(daysInput.value) || 0;
|
||||||
const lines = parseInt(linesInput.value) || 0;
|
const lines = parseInt(linesInput.value) || 0;
|
||||||
|
const baseUrl = "{{ url_for('public_table') }}"; // Holt den korrekten Pfad inkl. root_path
|
||||||
|
|
||||||
let url = "/zeiten?test=1";
|
// Wir bauen die Parameter-Kette sauber auf
|
||||||
|
let params = "?test=1";
|
||||||
|
|
||||||
if (lines > 0) {
|
if (lines > 0) {
|
||||||
url += `&lines=${lines}`;
|
// Zeilen-Limitierung hat Priorität
|
||||||
|
params += `&lines=${lines}`;
|
||||||
} else if (days > 0) {
|
} else if (days > 0) {
|
||||||
url += `&days=${days}`;
|
// Tage-Filterung als Fallback
|
||||||
|
params += `&days=${days}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
previewLink.href = url;
|
// Den Link final zusammensetzen
|
||||||
|
previewLink.href = baseUrl + params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Event-Listener für Änderungen an den Eingabefeldern
|
||||||
daysInput.addEventListener('input', updateUrl);
|
daysInput.addEventListener('input', updateUrl);
|
||||||
linesInput.addEventListener('input', updateUrl);
|
linesInput.addEventListener('input', updateUrl);
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -3,18 +3,18 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<style>
|
<style>
|
||||||
body { font-family: sans-serif; color: white; background: transparent; margin: 0; padding: 0; }
|
body { font-family: sans-serif; color: white; background: transparent; margin: 0; padding: 0; font-size: 14px; }
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'BrittanySignature';
|
font-family: 'BrittanySignature';
|
||||||
src: url('/static/BrittanySignature.woff2') format('woff2');
|
src: url("{{ url_for('static', path='BrittanySignature.woff2') }}") format('woff2');
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap; /* Verhindert unsichtbaren Text beim Laden */
|
font-display: swap; /* Verhindert unsichtbaren Text beim Laden */
|
||||||
}
|
}
|
||||||
|
|
||||||
.monat {
|
.monat {
|
||||||
font-size: 25px;
|
font-size: 130%;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
padding: 1.5ex 0.5em 0.5ex 0.5em;
|
padding: 1.5ex 0.5em 0.5ex 0.5em;
|
||||||
color: rgba(255, 255, 255, 0.9);
|
color: rgba(255, 255, 255, 0.9);
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
td {
|
td {
|
||||||
padding: 0.5ex 0.5em;
|
padding: 0.5ex 0.5em;
|
||||||
font-size: 15px;
|
font-size: 100%;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
/* border-top: 1px solid rgba(255, 255, 255, 0.2);
|
/* border-top: 1px solid rgba(255, 255, 255, 0.2);
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* tr:nth-of-type(odd) { background-color: rgba(255, 255, 255, 0.1); } */
|
/* tr:nth-of-type(odd) { background-color: rgba(255, 255, 255, 0.1); } */
|
||||||
tr { background-color: rgba(255, 255, 255, 0.1); }
|
tr { background-color: rgba(0, 0, 0, 0.2); }
|
||||||
tr.week-spacer { border: none !important; background: transparent !important; height: 15px; }
|
tr.week-spacer { border: none !important; background: transparent !important; height: 15px; }
|
||||||
|
|
||||||
/* Feste Prozentwerte für identische Spalten in allen Tabellen */
|
/* Feste Prozentwerte für identische Spalten in allen Tabellen */
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{% if test %}
|
{% if test %}
|
||||||
<div style="width: 300px ; margin: 20px auto; padding: 10px; background: rgb(55, 55, 55); border-radius: 8px;">
|
<div style="width: 310px ; margin: 20px auto; padding: 10px; background: rgb(100, 100, 100); border-radius: 8px;">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% set monate = ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'] %}
|
{% set monate = ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'] %}
|
||||||
{% set ns = namespace(last_month=none, last_week=none) %}
|
{% set ns = namespace(last_month=none, last_week=none) %}
|
||||||
|
|||||||
Reference in New Issue
Block a user