28 lines
693 B
Rust
28 lines
693 B
Rust
use std::sync::{Arc, atomic::Ordering};
|
|
|
|
use axum::extract::State;
|
|
|
|
use crate::engine::Engine;
|
|
|
|
/// Show index status page with amount of uploaded files
|
|
pub async fn index(State(engine): State<Arc<Engine>>) -> String {
|
|
let count = engine.upl_count.load(Ordering::Relaxed);
|
|
|
|
let motd = engine.cfg.motd.clone();
|
|
|
|
motd.replace("%version%", env!("CARGO_PKG_VERSION"))
|
|
.replace("%uplcount%", &count.to_string())
|
|
}
|
|
|
|
#[rustfmt::skip]
|
|
pub async fn robots_txt() -> &'static str {
|
|
/// robots.txt that tells web crawlers not to list uploads
|
|
const ROBOTS_TXT: &str = concat!(
|
|
"User-Agent: *\n",
|
|
"Disallow: /p/*\n",
|
|
"Allow: /\n"
|
|
);
|
|
|
|
ROBOTS_TXT
|
|
}
|