add message.html integration
This commit is contained in:
parent
b56a256682
commit
7435065d18
6
message.html
Normal file
6
message.html
Normal 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>
|
@ -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>
|
||||
|
13
src/main.rs
13
src/main.rs
@ -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")]
|
||||
|
Loading…
x
Reference in New Issue
Block a user