1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
use std::sync::LazyLock;
use serde::{Deserialize, Serialize};
static REMARKS: LazyLock<Vec<Remark>> = LazyLock::new(|| {
serde_json::from_str(include_str!("../../content/json/remarks.json")).unwrap()
});
#[derive(Serialize, Deserialize)]
struct Remark {
#[allow(clippy::struct_field_names)]
remark: String,
created: String,
edited: Option<String>,
}
pub fn module(router: &mut windmark::router::Router) {
crate::route::track_mount(
router,
"/remarks",
"Fuwn's thoughts which are too short to be their own blog; but just long \
enough to be a remark.",
|context| {
crate::response::success(
&format!(
"# Remarks\n\nFuwn's thoughts which are too short to be their own \
blog; but just long enough to be a remark.\n\n{}",
REMARKS
.iter()
.map(|r| {
format!(
"* \"{}\" {}{}",
r.remark,
r.created,
r.edited.as_ref().map_or_else(String::new, |edited| {
format!(" Edited {edited}")
})
)
})
.collect::<Vec<String>>()
.join("\n")
),
&context,
)
},
);
}
|