aboutsummaryrefslogtreecommitdiff
path: root/src/modules/directory.rs
blob: 9eddc31b0b4b99357a3e8da7dc2223b19342cd36 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
pub fn module(router: &mut windmark::router::Router) {
  crate::route::track_mount(
    router,
    "/directory",
    "A map of all publicly available routes on this Gemini capsule",
    |context| {
      crate::response::success(
        &format!(
          "# Directory\n\nA map of all publicly available routes on this \
           Gemini capsule\n\n{}",
          (*crate::route::ROUTES.lock().unwrap())
            .iter()
            .map(|(r, d)| format!("=> {} {}", r, d.description))
            .collect::<Vec<_>>()
            .join("\n")
        ),
        &context,
      )
    },
  );
}