From 1d760f91db62cbe64617d856cf4d9deccc7bf662 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= Date: Tue, 26 Sep 2023 22:23:23 +0000 Subject: [PATCH] customizable footer --- api/advent22_api/core/config.py | 7 ++++++- api/advent22_api/routers/user.py | 12 ++++++++++++ ui/src/App.vue | 13 +++++++++---- ui/src/components/admin/ConfigView.vue | 3 +++ 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/api/advent22_api/core/config.py b/api/advent22_api/core/config.py index c51e208..fa0aba1 100644 --- a/api/advent22_api/core/config.py +++ b/api/advent22_api/core/config.py @@ -13,7 +13,7 @@ class User(BaseModel): class Puzzle(BaseModel): # Titel - # TODO neue Route GET /user/title + # TODO penner neue Route GET /user/title title: str # Lösungswort @@ -65,6 +65,11 @@ class Config(BaseModel): # Serverseitiger zusätzlicher "random" seed random_seed: str = "" + # Fußzeile der Seite + footer: str = ( + 'Advent22 by Lenaisten e.V.' + ) + async def get_config() -> Config: """ diff --git a/api/advent22_api/routers/user.py b/api/advent22_api/routers/user.py index b51aed7..175e221 100644 --- a/api/advent22_api/routers/user.py +++ b/api/advent22_api/routers/user.py @@ -5,6 +5,7 @@ from fastapi.responses import StreamingResponse from PIL import Image from ..core.calendar_config import CalendarConfig, DoorsSaved, get_calendar_config +from ..core.config import Config, get_config from ..core.depends import get_all_event_dates, get_day_image from ..core.helpers import EventDates, api_return_image, load_image from ._security import user_can_view_day, user_is_admin, user_visible_days @@ -38,6 +39,17 @@ async def get_doors( return [door for door in cal_cfg.doors if door.day in visible_days] +@router.get("/footer") +async def get_footer( + cfg: Config = Depends(get_config), +) -> str: + """ + Seiten-Fußzeile lesen + """ + + return cfg.footer + + @router.get( "/image_{day}", response_class=StreamingResponse, diff --git a/ui/src/App.vue b/ui/src/App.vue index c2cda96..09a637d 100644 --- a/ui/src/App.vue +++ b/ui/src/App.vue @@ -16,10 +16,7 @@