7 Commits

Author SHA1 Message Date
53d5309d65 Add sitemap.xml and robots.txt for SEO optimization 2025-08-04 11:29:06 +02:00
a131fc8077 Vorlesen-Buttons kontrastreicher gestaltet: schwarze Symbole auf hellem Hintergrund 2025-08-03 14:07:50 +02:00
deec62fec0 Update Screenshot 2025-08-03 13:54:19 +02:00
9e5906943d Screenshot zur Demo verlinkt 2025-08-03 13:40:52 +02:00
cabe628875 Bump version to 1.4.15 2025-08-03 13:32:43 +02:00
35ecba348b Fix stats route UnboundLocalError and bump version to 1.4.14 2025-08-03 12:59:41 +02:00
31b1c12dcb Code cleanup and dependency updates
- Remove unused imports (abort, g, ngettext) from app.py
- Remove unused variables (werktage, datumsrechnung, werktagsrechnung, wochen_monate)
- Update Flask from 3.0.0 to 3.1.1
- Update requests from 2.31.0 to 2.32.4
- Update pytest from 7.4.3 to 8.4.1
- Update numpy from 1.26.4 to 2.3.2 (safe migration based on NumPy 2.0 guide)
- Add pytest to requirements.txt (was missing)
2025-08-03 12:56:09 +02:00
7 changed files with 131 additions and 25 deletions

View File

@@ -42,7 +42,7 @@ Diese moderne Python-Webanwendung (Flask) ermöglicht verschiedene Datumsberechn
Datumsrechner Live: [https://date.elpatron.me](https://date.elpatron.me)
![App Screenshot](./assets/image-20250725095959116.png)
[![App Screenshot](./assets/image-20250725095959116.png)](https://date.elpatron.me)
**[Lighthouse](https://en.wikipedia.org/wiki/Lighthouse_(software))-Performance-Score:**

19
app.py
View File

@@ -1,5 +1,5 @@
from flask import Flask, render_template, request, redirect, url_for, session, abort, jsonify, g, make_response
from flask_babel import Babel, gettext, ngettext, get_locale
from flask import Flask, render_template, request, redirect, url_for, session, jsonify, make_response
from flask_babel import Babel, gettext, get_locale
from datetime import datetime, timedelta
import numpy as np
from dateutil.relativedelta import relativedelta
@@ -20,7 +20,7 @@ app.config['BABEL_TRANSLATION_DIRECTORIES'] = 'translations'
babel = Babel()
# Version der App
APP_VERSION = "1.4.13"
APP_VERSION = "1.4.15"
def add_cache_headers(response):
"""Fügt Cache-Control-Header hinzu, die den Back-Forward-Cache ermöglichen"""
@@ -118,7 +118,7 @@ def index():
with open(log_path, 'a', encoding='utf-8') as f:
from datetime import datetime as dt
f.write(f"{dt.now().isoformat()} PAGEVIEW\n")
tage = werktage = wochentag = datumsrechnung = werktagsrechnung = kw_berechnen = kw_datum = wochen_monate = None
tage = wochentag = kw_berechnen = kw_datum = None
feiertage_anzahl = wochenendtage_anzahl = None
active_idx = 0
plusminus_result = None
@@ -245,7 +245,7 @@ def index():
plusminus_result = f"Datum {d.strftime('%d.%m.%Y')} {'plus' if anzahl_int>=0 else 'minus'} {abs(anzahl_int)} Monate: {result.strftime('%d.%m.%Y')}"
except Exception:
plusminus_result = gettext('Ungültige Eingabe')
response = make_response(render_template('index.html', tage=tage, werktage=werktage, wochentag=wochentag, plusminus_result=plusminus_result, kw_berechnen=kw_berechnen, kw_datum=kw_datum, active_idx=active_idx
response = make_response(render_template('index.html', tage=tage, wochentag=wochentag, plusminus_result=plusminus_result, kw_berechnen=kw_berechnen, kw_datum=kw_datum, active_idx=active_idx
, feiertage_anzahl=feiertage_anzahl, wochenendtage_anzahl=wochenendtage_anzahl, app_version=APP_VERSION, get_locale=get_locale
))
return add_cache_headers(response)
@@ -323,8 +323,11 @@ def stats():
else:
response = make_response(render_template('stats_login.html', error='Falsches Passwort!'))
return add_cache_headers(response)
else:
response = make_response(render_template('stats_login.html', error=None))
return add_cache_headers(response)
# Wenn authentifiziert, zeige Dashboard
log_path = os.path.join('log', 'pageviews.log')
pageviews, func_counts, func_counts_hourly, impressions_per_day, impressions_per_hour, api_counts, api_counts_hourly = parse_log_stats(log_path)
response = make_response(render_template('stats_dashboard.html', pageviews=pageviews, func_counts=func_counts, func_counts_hourly=func_counts_hourly, impressions_per_day=impressions_per_day, impressions_per_hour=impressions_per_hour, api_counts=api_counts, api_counts_hourly=api_counts_hourly))
@@ -500,6 +503,12 @@ def api_docs():
response = make_response(render_template('swagger.html'))
return add_cache_headers(response)
@app.route('/sitemap.xml')
def sitemap():
"""Serviert die Sitemap für Suchmaschinen"""
from flask import send_file
return send_file('sitemap.xml', mimetype='application/xml')
if __name__ == '__main__':
app.run(debug=True, host="0.0.0.0")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 57 KiB

View File

@@ -1,5 +1,6 @@
Flask==3.0.0
numpy==1.26.4
Flask==3.1.1
numpy==2.3.2
python-dateutil==2.9.0.post0
requests==2.31.0
requests==2.32.4
Flask-Babel==4.0.0
pytest==8.4.1

View File

@@ -1,2 +1,14 @@
User-agent: *
Allow: /
# Sitemap
Sitemap: https://date.elpatron.me/sitemap.xml
# Disallow private areas
Disallow: /stats
Disallow: /log/
Disallow: /htmlcov/
# Allow API endpoints for documentation
Allow: /api-docs
Allow: /static/swagger.json

83
sitemap.xml Normal file
View File

@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<!-- Hauptseite -->
<url>
<loc>https://date.elpatron.me/</loc>
<lastmod>2025-08-03</lastmod>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>
<!-- API-Dokumentation -->
<url>
<loc>https://date.elpatron.me/api-docs</loc>
<lastmod>2025-08-03</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
<!-- Statische Ressourcen -->
<url>
<loc>https://date.elpatron.me/static/favicon.ico</loc>
<lastmod>2025-08-03</lastmod>
<changefreq>yearly</changefreq>
<priority>0.1</priority>
</url>
<url>
<loc>https://date.elpatron.me/static/favicon.png</loc>
<lastmod>2025-08-03</lastmod>
<changefreq>yearly</changefreq>
<priority>0.1</priority>
</url>
<url>
<loc>https://date.elpatron.me/static/favicon.svg</loc>
<lastmod>2025-08-03</lastmod>
<changefreq>yearly</changefreq>
<priority>0.1</priority>
</url>
<url>
<loc>https://date.elpatron.me/static/logo.svg</loc>
<lastmod>2025-08-03</lastmod>
<changefreq>yearly</changefreq>
<priority>0.1</priority>
</url>
<url>
<loc>https://date.elpatron.me/static/manifest.json</loc>
<lastmod>2025-08-03</lastmod>
<changefreq>monthly</changefreq>
<priority>0.3</priority>
</url>
<url>
<loc>https://date.elpatron.me/static/service-worker.js</loc>
<lastmod>2025-08-03</lastmod>
<changefreq>monthly</changefreq>
<priority>0.3</priority>
</url>
<url>
<loc>https://date.elpatron.me/static/swagger.json</loc>
<lastmod>2025-08-03</lastmod>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
<!-- Sprachversionen der Hauptseite -->
<url>
<loc>https://date.elpatron.me/?lang=de</loc>
<lastmod>2025-08-03</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://date.elpatron.me/?lang=en</loc>
<lastmod>2025-08-03</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
</urlset>

View File

@@ -498,9 +498,9 @@ button:focus, .accordion-header:focus {
position: absolute;
top: 0.5em;
right: 0.5em;
background: rgba(37, 99, 235, 0.15);
color: var(--primary-dark);
border: 1px solid var(--border);
background: #ffffff;
color: #000000;
border: 2px solid #000000;
border-radius: 4px;
padding: 0.3em 0.6em;
font-size: 0.8em;
@@ -514,19 +514,20 @@ button:focus, .accordion-header:focus {
z-index: 5;
}
.read-aloud-btn:hover {
background: rgba(37, 99, 235, 0.25);
border-color: var(--primary);
background: #f0f0f0;
border-color: #333333;
}
.read-aloud-btn:focus {
outline: 3px solid #facc15;
outline-offset: 2px;
box-shadow: 0 0 0 4px #1e293b;
background: rgba(37, 99, 235, 0.25);
border-color: var(--primary);
background: #f0f0f0;
border-color: #333333;
}
.read-aloud-btn.playing {
background: var(--primary);
color: white;
background: #000000;
color: #ffffff;
border-color: #000000;
}
.accordion {
border-radius: 12px;
@@ -1499,7 +1500,7 @@ footer br + a {
{% if request.form.get('werktage') %}
{{ _('Anzahl der Werktage zwischen') }} <b>{{ format_date(request.form.get('start1', '')) }}</b> {{ _('und') }} <b>{{ format_date(request.form.get('end1', '')) }}:</b>{% if request.form.get('bundesland') %} {{ _('(Feiertage:') }} {{ request.form.get('bundesland') }}){% endif %}: {{ tage }}
{% else %}
{{ _('Anzahl der Tage zwischen') }} <b>{{ format_date(request.form.get('start1', '')) }}</b> {{ _('und') }} <b>{{ format_date(request.form.get('end1', '')) }}</b>: {{ tage }}.
{{ _('Anzahl der Tage zwischen') }} <b>{{ format_date(request.form.get('start1', '')) }}</b> {{ _('und') }} <b>{{ format_date(request.form.get('end1', '')) }}</b>: {{ tage }}
{% endif %}
{% if wochenendtage_anzahl is not none or (feiertage_anzahl is not none and request.form.get('bundesland')) %}
<br>