Files
gh-christianlouis-leagueledger/app/views/static.py
T
Christian Krakau-Louis d595b468e9 Add Impressum and QR code management templates
- Created a new Impressum page with legal information and contact details.
- Developed admin link page for linking QR codes to events with form functionality.
- Implemented QR code dashboard for managing QR code sets, including creation and quick actions.
- Added detailed view for QR code sets, allowing addition of QR codes and management actions.
- Introduced static file serving for favicon and related images.
- Established views for static content pages (about, contact, privacy, terms).
- Implemented translation management scripts for compiling and updating translations.
2025-04-14 03:19:41 +02:00

61 lines
2.4 KiB
Python

from fastapi import APIRouter
from fastapi.staticfiles import StaticFiles
from fastapi.responses import FileResponse
import os
router = APIRouter()
# Function to setup static files that will be called from main.py
def configure_static_files(app):
"""Configure static files mounting for the application."""
static_dir = os.path.join(os.path.dirname(__file__), "..", "static")
app.mount("/static", StaticFiles(directory=static_dir), name="static")
# Serve favicon.ico
@router.get("/favicon.ico")
async def serve_favicon():
"""Serve favicon.ico."""
file_path = os.path.join(os.path.dirname(__file__), "..", "static", "images", "favicon", "favicon.ico")
return FileResponse(file_path)
# Serve android-chrome-192x192.png
@router.get("/android-chrome-192x192.png")
async def serve_android_chrome_192():
"""Serve android-chrome-192x192.png."""
file_path = os.path.join(os.path.dirname(__file__), "..", "static", "images", "favicon", "android-chrome-192x192.png")
return FileResponse(file_path)
# Serve android-chrome-512x512.png
@router.get("/android-chrome-512x512.png")
async def serve_android_chrome_512():
"""Serve android-chrome-512x512.png."""
file_path = os.path.join(os.path.dirname(__file__), "..", "static", "images", "favicon", "android-chrome-512x512.png")
return FileResponse(file_path)
# Serve apple-touch-icon.png
@router.get("/apple-touch-icon.png")
async def serve_apple_touch_icon():
"""Serve apple-touch-icon.png."""
file_path = os.path.join(os.path.dirname(__file__), "..", "static", "images", "favicon", "apple-touch-icon.png")
return FileResponse(file_path)
# Serve favicon-16x16.png
@router.get("/favicon-16x16.png")
async def serve_favicon_16():
"""Serve favicon-16x16.png."""
file_path = os.path.join(os.path.dirname(__file__), "..", "static", "images", "favicon", "favicon-16x16.png")
return FileResponse(file_path)
# Serve favicon-32x32.png
@router.get("/favicon-32x32.png")
async def serve_favicon_32():
"""Serve favicon-32x32.png."""
file_path = os.path.join(os.path.dirname(__file__), "..", "static", "images", "favicon", "favicon-32x32.png")
return FileResponse(file_path)
# Serve site.webmanifest
@router.get("/images/favicon/site.webmanifest")
async def serve_site_webmanifest():
"""Serve site.webmanifest."""
file_path = os.path.join(os.path.dirname(__file__), "..", "static", "images", "favicon", "site.webmanifest")
return FileResponse(file_path)