add message.html integration

This commit is contained in:
mark 2025-03-10 14:34:06 +01:00
parent b56a256682
commit 7435065d18
3 changed files with 23 additions and 2 deletions

6
message.html Normal file
View File

@ -0,0 +1,6 @@
<h2>Streiks und Ausfälle</h2>
<!-- insert p element ^here^ for each known thing -->
<p>
Gerne auch an <a href="/info/me">mich</a> melden, wenn hier etwas fehlt
<small> (ich kriege das meiste selbst nicht früh genug mit)</small>, danke :)
</p>

View File

@ -13,7 +13,7 @@ td {
</head>
<body>
<h2>Merklingen <small><small>Schwäbische Alb</small></small></h2>
%DEPARTURES%
%%DEPARTURES%%
<h2>🚐 967 / 968</h2>
<script>
async function nmv(name, mins) {
@ -91,6 +91,10 @@ async function con(change) {
<br><br>
<hr>
<br><br>
%%MESSAGE%%
<br><br>
<hr>
<br><br>
<p>
Diese Seite soll eine einfache Möglichkeit darstellen, zu prüfen,
ob der Bus und Zug von/nach Merklingen heute kommt, oder ob er mal wieder streikt oder aus sonstigen Gründen fehlt.<br>

View File

@ -223,7 +223,18 @@ async fn index(
Some((_, Err(e))) => format!("<small>{}</small>", html_escape::encode_safe(e)),
None => "<small>failed</small>".to_owned(),
};
RawHtml(include_str!("index.html").replace("%DEPARTURES%", &departures_str))
RawHtml(
include_str!("index.html")
.replace("%%DEPARTURES%%", &departures_str)
.replace(
"%%MESSAGE%%",
tokio::fs::read_to_string("message.html")
.await
.as_ref()
.map(|v| v.as_str())
.unwrap_or(""),
),
)
}
#[get("/api")]