mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2024-11-23 00:03:07 +00:00
customizable footer
This commit is contained in:
parent
62f570aaca
commit
1d760f91db
4 changed files with 30 additions and 5 deletions
|
@ -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 = (
|
||||
'<strong>Advent22</strong> by <a href="//www.lenaisten.de">Lenaisten e.V.</a>'
|
||||
)
|
||||
|
||||
|
||||
async def get_config() -> Config:
|
||||
"""
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -16,10 +16,7 @@
|
|||
<footer class="footer">
|
||||
<nav class="level is-mobile">
|
||||
<div class="level-item">
|
||||
<p>
|
||||
<strong>Advent22</strong> by
|
||||
<a href="https://www.lenaisten.de/">Lenaisten.de</a>.
|
||||
</p>
|
||||
<p v-html="footer" />
|
||||
</div>
|
||||
<div class="level-right">
|
||||
<div class="level-item">
|
||||
|
@ -46,6 +43,14 @@ import UserView from "./components/UserView.vue";
|
|||
})
|
||||
export default class extends Vue {
|
||||
public is_admin = false;
|
||||
public footer = "";
|
||||
|
||||
public mounted(): void {
|
||||
this.$advent22
|
||||
.api_get<string>("user/footer")
|
||||
.then((footer) => (this.footer = footer))
|
||||
.catch((error) => alert(this.$advent22.format_user_error(error)));
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -20,6 +20,9 @@
|
|||
<dd v-if="next_door === null">Kein nächstes Türchen</dd>
|
||||
<dd v-else><CountDown :millis="next_door" /></dd>
|
||||
|
||||
<dt>Fußzeile</dt>
|
||||
<dd class="is-family-monospace">{{ footer }}</dd>
|
||||
|
||||
<dt>Erstes Türchen</dt>
|
||||
<dd>{{ fmt_puzzle_date("first") }}</dd>
|
||||
|
||||
|
|
Loading…
Reference in a new issue