22 lines
844 B
Rust
22 lines
844 B
Rust
use maud::PreEscaped;
|
|
|
|
use crate::{templates, utils::sbot};
|
|
|
|
/// Scuttlebutt blocks list template builder.
|
|
pub fn build_template() -> PreEscaped<String> {
|
|
// retrieve the list of blocked peers
|
|
match sbot::get_blocks_list() {
|
|
// populate the peers_list template with blocks and render it
|
|
Ok(blocks) => templates::peers_list::build_template(blocks, "Blocks"),
|
|
Err(e) => {
|
|
// render the sbot error template with the error message
|
|
let error_template = templates::error::build_template(e.to_string());
|
|
// wrap the nav bars around the error template content
|
|
let body = templates::nav::build_template(error_template, "Blocks", Some("/"));
|
|
|
|
// render the base template with the provided body
|
|
templates::base::build_template(body)
|
|
}
|
|
}
|
|
}
|