mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2024-11-23 00:03:07 +00:00
Merge branch 'develop' into wip/rect_rework
This commit is contained in:
commit
b3a4a20f16
4 changed files with 42 additions and 15 deletions
|
@ -13,7 +13,7 @@ class User(BaseModel):
|
||||||
|
|
||||||
class Puzzle(BaseModel):
|
class Puzzle(BaseModel):
|
||||||
# Titel
|
# Titel
|
||||||
# TODO neue Route GET /user/title
|
# TODO penner neue Route GET /user/title
|
||||||
title: str
|
title: str
|
||||||
|
|
||||||
# Lösungswort
|
# Lösungswort
|
||||||
|
@ -65,6 +65,11 @@ class Config(BaseModel):
|
||||||
# Serverseitiger zusätzlicher "random" seed
|
# Serverseitiger zusätzlicher "random" seed
|
||||||
random_seed: str = ""
|
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:
|
async def get_config() -> Config:
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -5,6 +5,7 @@ from fastapi.responses import StreamingResponse
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
from ..core.calendar_config import CalendarConfig, DoorsSaved, get_calendar_config
|
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.depends import get_all_event_dates, get_day_image
|
||||||
from ..core.helpers import EventDates, api_return_image, load_image
|
from ..core.helpers import EventDates, api_return_image, load_image
|
||||||
from ._security import user_can_view_day, user_is_admin, user_visible_days
|
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]
|
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(
|
@router.get(
|
||||||
"/image_{day}",
|
"/image_{day}",
|
||||||
response_class=StreamingResponse,
|
response_class=StreamingResponse,
|
||||||
|
|
|
@ -16,10 +16,7 @@
|
||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<nav class="level is-mobile">
|
<nav class="level is-mobile">
|
||||||
<div class="level-item">
|
<div class="level-item">
|
||||||
<p>
|
<p v-html="footer" />
|
||||||
<strong>Advent22</strong> by
|
|
||||||
<a href="https://www.lenaisten.de/">Lenaisten.de</a>.
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="level-right">
|
<div class="level-right">
|
||||||
<div class="level-item">
|
<div class="level-item">
|
||||||
|
@ -46,6 +43,14 @@ import UserView from "./components/UserView.vue";
|
||||||
})
|
})
|
||||||
export default class extends Vue {
|
export default class extends Vue {
|
||||||
public is_admin = false;
|
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>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,9 @@
|
||||||
<dd v-if="next_door === null">Kein nächstes Türchen</dd>
|
<dd v-if="next_door === null">Kein nächstes Türchen</dd>
|
||||||
<dd v-else><CountDown :millis="next_door" /></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>
|
<dt>Erstes Türchen</dt>
|
||||||
<dd>{{ fmt_puzzle_date("first") }}</dd>
|
<dd>{{ fmt_puzzle_date("first") }}</dd>
|
||||||
|
|
||||||
|
@ -49,13 +52,12 @@
|
||||||
<dt>Hintergrundbild</dt>
|
<dt>Hintergrundbild</dt>
|
||||||
<dd>{{ config_model.calendar.background }}</dd>
|
<dd>{{ config_model.calendar.background }}</dd>
|
||||||
|
|
||||||
<dt>Türchen</dt>
|
<dt>Türchen ({{ doors.length }} Stück)</dt>
|
||||||
<dd>
|
<dd>
|
||||||
<template v-for="(part, day) in day_parts" :key="`door-${day}`">
|
<template v-for="(door, index) in doors" :key="`door-${index}`">
|
||||||
<span>
|
<span>
|
||||||
<template v-if="Number(day) > 1">, </template>
|
<template v-if="door.day > 1">, </template>
|
||||||
<span v-if="part == ''" class="tag is-warning">_</span>
|
{{ door.day }}
|
||||||
<template v-else>{{ part }}</template>
|
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</dd>
|
</dd>
|
||||||
|
@ -122,7 +124,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { ConfigModel, Credentials, DoorsSaved, NumStrDict } from "@/lib/api";
|
import { ConfigModel, Credentials, DoorsSaved } from "@/lib/api";
|
||||||
import { DateTime } from "luxon";
|
import { DateTime } from "luxon";
|
||||||
import { Options, Vue } from "vue-class-component";
|
import { Options, Vue } from "vue-class-component";
|
||||||
|
|
||||||
|
@ -162,7 +164,8 @@ export default class extends Vue {
|
||||||
config_file: "sed diam nonumy",
|
config_file: "sed diam nonumy",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
public day_parts: NumStrDict = {};
|
public doors: DoorsSaved = [];
|
||||||
|
public footer = "";
|
||||||
public num_user_doors = 0;
|
public num_user_doors = 0;
|
||||||
public next_door: number | null = null;
|
public next_door: number | null = null;
|
||||||
public dav_credentials: Credentials = ["", ""];
|
public dav_credentials: Credentials = ["", ""];
|
||||||
|
@ -178,14 +181,16 @@ export default class extends Vue {
|
||||||
public on_open(ready: () => void, fail: () => void): void {
|
public on_open(ready: () => void, fail: () => void): void {
|
||||||
Promise.all([
|
Promise.all([
|
||||||
this.$advent22.api_get<ConfigModel>("admin/config_model"),
|
this.$advent22.api_get<ConfigModel>("admin/config_model"),
|
||||||
this.$advent22.api_get<NumStrDict>("admin/day_parts"),
|
this.$advent22.api_get<DoorsSaved>("admin/doors"),
|
||||||
this.$advent22.api_get<DoorsSaved>("user/doors"),
|
this.$advent22.api_get<DoorsSaved>("user/doors"),
|
||||||
|
this.$advent22.api_get<string>("user/footer"),
|
||||||
this.$advent22.api_get<number | null>("user/next_door"),
|
this.$advent22.api_get<number | null>("user/next_door"),
|
||||||
])
|
])
|
||||||
.then(([config_model, day_parts, user_doors, next_door]) => {
|
.then(([config_model, doors, user_doors, footer, next_door]) => {
|
||||||
this.config_model = config_model;
|
this.config_model = config_model;
|
||||||
this.day_parts = day_parts;
|
this.doors = doors;
|
||||||
this.num_user_doors = user_doors.length;
|
this.num_user_doors = user_doors.length;
|
||||||
|
this.footer = footer;
|
||||||
this.next_door = next_door;
|
this.next_door = next_door;
|
||||||
|
|
||||||
ready();
|
ready();
|
||||||
|
|
Loading…
Reference in a new issue