diff options
| author | Fuwn <[email protected]> | 2022-04-19 23:24:10 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-04-19 23:24:10 -0700 |
| commit | 817688de7b5b0ae1f2d06791569dd708164cabd6 (patch) | |
| tree | aca46dbe0a90a1314354f77f212d10af7685cfea /src/modules/sitemap.rs | |
| parent | refactor(modules): move modules to module (diff) | |
| download | locus-817688de7b5b0ae1f2d06791569dd708164cabd6.tar.xz locus-817688de7b5b0ae1f2d06791569dd708164cabd6.zip | |
refactor(modules): move sitemap to modules module
Diffstat (limited to 'src/modules/sitemap.rs')
| -rw-r--r-- | src/modules/sitemap.rs | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/modules/sitemap.rs b/src/modules/sitemap.rs new file mode 100644 index 0000000..7e190aa --- /dev/null +++ b/src/modules/sitemap.rs @@ -0,0 +1,38 @@ +// This file is part of Locus <https://github.com/gemrest/locus>. +// Copyright (C) 2022-2022 Fuwn <[email protected]> +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 3. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +// +// Copyright (C) 2022-2022 Fuwn <[email protected]> +// SPDX-License-Identifier: GPL-3.0-only + +pub fn module(router: &mut windmark::Router) { + crate::track_mount( + router, + "/sitemap", + "A map of all publicly available routes on this Gemini capsule", + Box::new(|context| { + crate::success!( + format!( + "# SITEMAP\n\n{}", + (*crate::ROUTES.lock().unwrap()) + .iter() + .map(|(r, d)| format!("=> {} {}", r, d.description)) + .collect::<Vec<_>>() + .join("\n") + ), + context + ) + }), + ); +} |