37 lines
1.4 KiB
Rust
37 lines
1.4 KiB
Rust
use rocket::{get, request::FlashMessage};
|
|
use rocket_dyn_templates::{tera::Context, Template};
|
|
|
|
use crate::routes::authentication::Authenticated;
|
|
|
|
// HELPERS AND ROUTES FOR /settings/scuttlebutt
|
|
|
|
/// Scuttlebutt settings menu.
|
|
#[get("/")]
|
|
pub fn ssb_settings_menu(flash: Option<FlashMessage>, _auth: Authenticated) -> Template {
|
|
let mut context = Context::new();
|
|
context.insert("back", &Some("/settings".to_string()));
|
|
context.insert("title", &Some("Scuttlebutt Settings".to_string()));
|
|
|
|
if let Some(flash) = flash {
|
|
context.insert("flash_name", &Some(flash.kind().to_string()));
|
|
context.insert("flash_msg", &Some(flash.message().to_string()));
|
|
};
|
|
|
|
Template::render("settings/scuttlebutt/menu", &context.into_json())
|
|
}
|
|
|
|
/// Sbot configuration page (includes form for updating configuration parameters).
|
|
#[get("/configure")]
|
|
pub fn configure_sbot(flash: Option<FlashMessage>, _auth: Authenticated) -> Template {
|
|
let mut context = Context::new();
|
|
context.insert("back", &Some("/settings/scuttlebutt".to_string()));
|
|
context.insert("title", &Some("Sbot Configuration".to_string()));
|
|
|
|
if let Some(flash) = flash {
|
|
context.insert("flash_name", &Some(flash.kind().to_string()));
|
|
context.insert("flash_msg", &Some(flash.message().to_string()));
|
|
};
|
|
|
|
Template::render("settings/scuttlebutt/configure_sbot", &context.into_json())
|
|
}
|