2023-09-10 03:10:22 +00:00
|
|
|
<template>
|
2023-09-14 12:51:30 +00:00
|
|
|
<BulmaDrawer header="Konfiguration" @open="on_open" refreshable>
|
2023-09-10 03:25:12 +00:00
|
|
|
<div class="card-content">
|
2023-09-10 03:38:24 +00:00
|
|
|
<div class="columns">
|
2023-09-10 03:54:54 +00:00
|
|
|
<div class="column is-one-third">
|
|
|
|
<div class="content">
|
2023-10-31 19:18:18 +00:00
|
|
|
<h3>Lösung</h3>
|
|
|
|
<dl>
|
|
|
|
<dt>Wert</dt>
|
|
|
|
<dd>
|
|
|
|
Eingabe:
|
|
|
|
<span class="is-family-monospace">
|
|
|
|
"{{ config_model.solution.value }}"
|
|
|
|
</span>
|
|
|
|
</dd>
|
|
|
|
<dd>
|
|
|
|
Ausgabe:
|
|
|
|
<span class="is-family-monospace">
|
|
|
|
"{{ config_model.solution.clean }}"
|
|
|
|
</span>
|
|
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>Transformation</dt>
|
|
|
|
<dd>
|
|
|
|
Whitespace:
|
|
|
|
<span class="is-uppercase is-family-monospace">
|
|
|
|
{{ config_model.solution.whitespace }}
|
|
|
|
</span>
|
|
|
|
</dd>
|
|
|
|
<dd>
|
|
|
|
Buchstaben:
|
|
|
|
<span class="is-uppercase is-family-monospace">
|
|
|
|
{{ config_model.solution.case }}
|
|
|
|
</span>
|
|
|
|
</dd>
|
|
|
|
</dl>
|
|
|
|
|
2023-09-21 08:52:35 +00:00
|
|
|
<h3>Rätsel</h3>
|
2023-09-10 03:54:54 +00:00
|
|
|
<dl>
|
2023-09-11 19:39:02 +00:00
|
|
|
<dt>Titel</dt>
|
2023-09-14 15:00:34 +00:00
|
|
|
<!-- TODO -->
|
|
|
|
<dd>Advent22</dd>
|
2023-09-11 19:39:02 +00:00
|
|
|
|
2023-09-10 03:54:54 +00:00
|
|
|
<dt>Offene Türchen</dt>
|
2023-09-12 21:06:52 +00:00
|
|
|
<dd>{{ num_user_doors }}</dd>
|
2023-09-10 03:10:22 +00:00
|
|
|
|
2023-09-15 16:55:03 +00:00
|
|
|
<dt>Zeit zum nächsten Türchen</dt>
|
2023-09-15 17:01:38 +00:00
|
|
|
<dd v-if="next_door === null">Kein nächstes Türchen</dd>
|
|
|
|
<dd v-else><CountDown :millis="next_door" /></dd>
|
2023-09-10 03:10:22 +00:00
|
|
|
|
2023-09-26 22:23:23 +00:00
|
|
|
<dt>Fußzeile</dt>
|
|
|
|
<dd class="is-family-monospace">{{ footer }}</dd>
|
|
|
|
|
2023-09-10 03:54:54 +00:00
|
|
|
<dt>Erstes Türchen</dt>
|
2023-09-16 00:17:13 +00:00
|
|
|
<dd>{{ fmt_puzzle_date("first") }}</dd>
|
2023-09-10 03:10:22 +00:00
|
|
|
|
2023-09-15 17:06:28 +00:00
|
|
|
<dt>Nächstes Türchen</dt>
|
2023-09-16 00:17:13 +00:00
|
|
|
<dd>{{ fmt_puzzle_date("next") }}</dd>
|
2023-09-15 17:06:28 +00:00
|
|
|
|
2023-09-10 03:54:54 +00:00
|
|
|
<dt>Letztes Türchen</dt>
|
2023-09-16 00:17:13 +00:00
|
|
|
<dd>{{ fmt_puzzle_date("last") }}</dd>
|
2023-09-10 03:10:22 +00:00
|
|
|
|
2023-09-14 23:40:06 +00:00
|
|
|
<dt>Rätsel schließt nach</dt>
|
2023-09-16 00:17:13 +00:00
|
|
|
<dd>{{ fmt_puzzle_date("end") }}</dd>
|
2023-09-10 03:10:22 +00:00
|
|
|
|
2023-09-10 03:54:54 +00:00
|
|
|
<dt>Zufalls-Seed</dt>
|
2023-09-11 22:50:11 +00:00
|
|
|
<dd class="is-family-monospace">
|
2023-09-12 16:26:12 +00:00
|
|
|
"{{ config_model.puzzle.seed }}"
|
2023-09-11 22:50:11 +00:00
|
|
|
</dd>
|
2023-09-10 03:54:54 +00:00
|
|
|
</dl>
|
|
|
|
</div>
|
2023-09-10 03:10:22 +00:00
|
|
|
</div>
|
2023-09-10 03:54:54 +00:00
|
|
|
<div class="column is-one-third">
|
|
|
|
<div class="content">
|
2023-09-21 08:52:35 +00:00
|
|
|
<h3>Kalender</h3>
|
2023-09-10 03:54:54 +00:00
|
|
|
<dl>
|
|
|
|
<dt>Definition</dt>
|
2023-09-12 16:26:12 +00:00
|
|
|
<dd>{{ config_model.calendar.config_file }}</dd>
|
2023-09-10 03:54:54 +00:00
|
|
|
|
|
|
|
<dt>Hintergrundbild</dt>
|
2023-09-12 16:26:12 +00:00
|
|
|
<dd>{{ config_model.calendar.background }}</dd>
|
2023-09-10 03:54:54 +00:00
|
|
|
|
2023-09-26 22:23:43 +00:00
|
|
|
<dt>Türchen ({{ doors.length }} Stück)</dt>
|
2023-09-11 02:36:51 +00:00
|
|
|
<dd>
|
2023-09-26 22:23:43 +00:00
|
|
|
<template v-for="(door, index) in doors" :key="`door-${index}`">
|
2023-09-12 13:56:05 +00:00
|
|
|
<span>
|
2023-10-29 16:28:19 +00:00
|
|
|
<template v-if="index > 0">, </template>
|
2023-09-26 22:23:43 +00:00
|
|
|
{{ door.day }}
|
2023-09-11 02:36:51 +00:00
|
|
|
</span>
|
2023-09-12 13:56:05 +00:00
|
|
|
</template>
|
2023-09-11 02:36:51 +00:00
|
|
|
</dd>
|
2023-09-10 03:54:54 +00:00
|
|
|
</dl>
|
|
|
|
|
2023-09-21 08:52:35 +00:00
|
|
|
<h3>Bilder</h3>
|
2023-09-10 03:54:54 +00:00
|
|
|
<dl>
|
|
|
|
<dt>Größe</dt>
|
2023-09-12 16:26:12 +00:00
|
|
|
<dd>{{ config_model.image.size }} px</dd>
|
2023-09-10 03:54:54 +00:00
|
|
|
|
|
|
|
<dt>Rand</dt>
|
2023-09-12 16:26:12 +00:00
|
|
|
<dd>{{ config_model.image.border }} px</dd>
|
2023-09-10 03:54:54 +00:00
|
|
|
|
|
|
|
<dt>Schriftarten</dt>
|
2023-09-11 22:50:11 +00:00
|
|
|
<dd
|
2023-09-12 16:26:12 +00:00
|
|
|
v-for="(font, index) in config_model.image.fonts"
|
2023-09-12 14:55:08 +00:00
|
|
|
:key="`font-${index}`"
|
2023-09-11 22:50:11 +00:00
|
|
|
>
|
|
|
|
{{ font.file }} (Größe {{ font.size }})
|
|
|
|
</dd>
|
2023-09-10 03:54:54 +00:00
|
|
|
</dl>
|
|
|
|
</div>
|
2023-09-10 03:10:22 +00:00
|
|
|
</div>
|
2023-09-10 03:54:54 +00:00
|
|
|
<div class="column is-one-third">
|
|
|
|
<div class="content">
|
2023-09-21 08:52:35 +00:00
|
|
|
<h3>WebDAV</h3>
|
2023-09-10 03:54:54 +00:00
|
|
|
<dl>
|
|
|
|
<dt>URL</dt>
|
2023-09-12 16:26:12 +00:00
|
|
|
<dd>{{ config_model.webdav.url }}</dd>
|
2023-09-10 03:54:54 +00:00
|
|
|
|
|
|
|
<dt>Zugangsdaten</dt>
|
2023-09-12 22:05:48 +00:00
|
|
|
<dd class="is-family-monospace">
|
|
|
|
<BulmaSecret @load="load_dav_credentials">
|
|
|
|
<span class="tag is-danger">user</span>
|
2023-09-21 12:25:23 +00:00
|
|
|
{{ dav_credentials[0] }}
|
2023-09-12 22:05:48 +00:00
|
|
|
<br />
|
|
|
|
<span class="tag is-danger">pass</span>
|
2023-09-21 12:25:23 +00:00
|
|
|
{{ dav_credentials[1] }}
|
2023-09-12 22:05:48 +00:00
|
|
|
</BulmaSecret>
|
2023-09-11 02:36:51 +00:00
|
|
|
</dd>
|
2023-09-10 03:54:54 +00:00
|
|
|
|
|
|
|
<dt>Cache-Dauer</dt>
|
2023-09-12 16:26:12 +00:00
|
|
|
<dd>{{ config_model.webdav.cache_ttl }} s</dd>
|
2023-09-10 03:54:54 +00:00
|
|
|
|
|
|
|
<dt>Konfigurationsdatei</dt>
|
2023-09-12 16:26:12 +00:00
|
|
|
<dd>{{ config_model.webdav.config_file }}</dd>
|
2023-09-10 03:54:54 +00:00
|
|
|
|
|
|
|
<dt>UI-Admin</dt>
|
2023-09-12 22:05:48 +00:00
|
|
|
<dd class="is-family-monospace">
|
|
|
|
<BulmaSecret @load="load_ui_credentials">
|
|
|
|
<span class="tag is-danger">user</span>
|
2023-09-21 12:25:23 +00:00
|
|
|
{{ ui_credentials[0] }}
|
2023-09-12 22:05:48 +00:00
|
|
|
<br />
|
|
|
|
<span class="tag is-danger">pass</span>
|
2023-09-21 12:25:23 +00:00
|
|
|
{{ ui_credentials[1] }}
|
2023-09-12 22:05:48 +00:00
|
|
|
</BulmaSecret>
|
2023-09-11 02:36:51 +00:00
|
|
|
</dd>
|
2023-09-10 03:54:54 +00:00
|
|
|
</dl>
|
|
|
|
</div>
|
2023-09-10 03:10:22 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-09-10 03:38:24 +00:00
|
|
|
</BulmaDrawer>
|
2023-09-10 03:10:22 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2023-09-26 22:23:43 +00:00
|
|
|
import { ConfigModel, Credentials, DoorsSaved } from "@/lib/api";
|
2023-09-16 00:17:13 +00:00
|
|
|
import { DateTime } from "luxon";
|
2023-09-10 03:10:22 +00:00
|
|
|
import { Options, Vue } from "vue-class-component";
|
|
|
|
|
2023-09-14 12:51:30 +00:00
|
|
|
import BulmaDrawer from "../bulma/Drawer.vue";
|
2023-09-13 16:08:05 +00:00
|
|
|
import BulmaSecret from "../bulma/Secret.vue";
|
2023-09-15 16:55:03 +00:00
|
|
|
import CountDown from "../CountDown.vue";
|
2023-09-12 22:05:48 +00:00
|
|
|
|
2023-09-10 03:10:22 +00:00
|
|
|
@Options({
|
|
|
|
components: {
|
|
|
|
BulmaDrawer,
|
2023-09-12 22:05:48 +00:00
|
|
|
BulmaSecret,
|
2023-09-15 16:55:03 +00:00
|
|
|
CountDown,
|
2023-09-10 03:10:22 +00:00
|
|
|
},
|
|
|
|
})
|
2023-09-11 22:24:01 +00:00
|
|
|
export default class extends Vue {
|
2023-09-12 16:26:12 +00:00
|
|
|
public config_model: ConfigModel = {
|
2023-10-31 19:18:18 +00:00
|
|
|
solution: {
|
|
|
|
value: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
|
|
|
whitespace: null,
|
|
|
|
case: null,
|
|
|
|
clean: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
|
|
|
},
|
2023-09-11 22:24:01 +00:00
|
|
|
puzzle: {
|
2023-09-16 00:17:13 +00:00
|
|
|
first: "2023-12-01",
|
|
|
|
next: "2023-12-01",
|
|
|
|
last: "2023-12-24",
|
|
|
|
end: "2024-04-01",
|
2023-09-11 22:24:01 +00:00
|
|
|
seed: "",
|
|
|
|
},
|
|
|
|
calendar: {
|
2023-09-16 00:17:13 +00:00
|
|
|
config_file: "lorem ipsum",
|
|
|
|
background: "dolor sit amet",
|
2023-09-11 22:24:01 +00:00
|
|
|
},
|
|
|
|
image: {
|
|
|
|
size: 500,
|
2023-09-16 00:17:13 +00:00
|
|
|
border: 0,
|
|
|
|
fonts: [{ file: "consetetur", size: 0 }],
|
2023-09-11 22:24:01 +00:00
|
|
|
},
|
|
|
|
webdav: {
|
2023-09-16 00:17:13 +00:00
|
|
|
url: "sadipscing elitr",
|
|
|
|
cache_ttl: 0,
|
|
|
|
config_file: "sed diam nonumy",
|
2023-09-11 22:24:01 +00:00
|
|
|
},
|
|
|
|
};
|
2023-09-26 22:23:43 +00:00
|
|
|
public doors: DoorsSaved = [];
|
|
|
|
public footer = "";
|
2023-09-12 21:06:52 +00:00
|
|
|
public num_user_doors = 0;
|
2023-09-15 16:55:03 +00:00
|
|
|
public next_door: number | null = null;
|
2023-09-21 12:25:23 +00:00
|
|
|
public dav_credentials: Credentials = ["", ""];
|
|
|
|
public ui_credentials: Credentials = ["", ""];
|
2023-09-11 22:24:01 +00:00
|
|
|
|
2023-09-16 00:17:13 +00:00
|
|
|
public fmt_puzzle_date(name: keyof ConfigModel["puzzle"]): string {
|
|
|
|
const iso_date = this.config_model.puzzle[name];
|
|
|
|
if (iso_date === null) return "-";
|
|
|
|
|
|
|
|
return DateTime.fromISO(iso_date).toLocaleString(DateTime.DATE_SHORT);
|
|
|
|
}
|
|
|
|
|
2023-09-14 12:51:30 +00:00
|
|
|
public on_open(ready: () => void, fail: () => void): void {
|
2023-09-12 16:26:12 +00:00
|
|
|
Promise.all([
|
|
|
|
this.$advent22.api_get<ConfigModel>("admin/config_model"),
|
2023-09-26 22:23:43 +00:00
|
|
|
this.$advent22.api_get<DoorsSaved>("admin/doors"),
|
2023-09-12 21:06:52 +00:00
|
|
|
this.$advent22.api_get<DoorsSaved>("user/doors"),
|
2023-09-26 22:23:43 +00:00
|
|
|
this.$advent22.api_get<string>("user/footer"),
|
2023-09-15 16:55:03 +00:00
|
|
|
this.$advent22.api_get<number | null>("user/next_door"),
|
2023-09-12 16:26:12 +00:00
|
|
|
])
|
2023-09-26 22:23:43 +00:00
|
|
|
.then(([config_model, doors, user_doors, footer, next_door]) => {
|
2023-09-12 16:26:12 +00:00
|
|
|
this.config_model = config_model;
|
2023-09-26 22:23:43 +00:00
|
|
|
this.doors = doors;
|
2023-09-12 21:06:52 +00:00
|
|
|
this.num_user_doors = user_doors.length;
|
2023-09-26 22:23:43 +00:00
|
|
|
this.footer = footer;
|
2023-09-15 16:55:03 +00:00
|
|
|
this.next_door = next_door;
|
2023-09-12 21:06:52 +00:00
|
|
|
|
2023-09-14 12:51:30 +00:00
|
|
|
ready();
|
2023-09-12 15:10:54 +00:00
|
|
|
})
|
2023-09-14 12:51:30 +00:00
|
|
|
.catch(fail);
|
2023-09-11 22:24:01 +00:00
|
|
|
}
|
2023-09-12 22:05:48 +00:00
|
|
|
|
|
|
|
public load_dav_credentials(): void {
|
|
|
|
this.$advent22
|
2023-09-21 12:25:23 +00:00
|
|
|
.api_get<Credentials>("admin/dav_credentials")
|
|
|
|
.then((creds) => (this.dav_credentials = creds))
|
2023-09-13 15:58:15 +00:00
|
|
|
.catch(() => {});
|
2023-09-12 22:05:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public load_ui_credentials(): void {
|
|
|
|
this.$advent22
|
2023-09-21 12:25:23 +00:00
|
|
|
.api_get<Credentials>("admin/ui_credentials")
|
|
|
|
.then((creds) => (this.ui_credentials = creds))
|
2023-09-13 15:58:15 +00:00
|
|
|
.catch(() => {});
|
2023-09-12 22:05:48 +00:00
|
|
|
}
|
2023-09-11 22:24:01 +00:00
|
|
|
}
|
2023-09-10 03:10:22 +00:00
|
|
|
</script>
|
2023-09-10 20:08:13 +00:00
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
dd {
|
|
|
|
overflow-x: auto;
|
|
|
|
}
|
|
|
|
</style>
|