Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
standard_static_files.rs 878 B
Newer Older
Pierre Jarriges's avatar
Pierre Jarriges committed
use actix_files::NamedFile;

pub async fn favicon() -> actix_web::Result<NamedFile> {
    let standard_dir = std::path::PathBuf::from(
        std::env::var("RESOURCES_DIR").expect("RESOURCES_DIR is not defined"),
    )
    .join("public/standard");

    Ok(NamedFile::open(standard_dir.join("favicon.ico"))?)
}

pub async fn robots() -> actix_web::Result<NamedFile> {
    let standard_dir = std::path::PathBuf::from(
        std::env::var("RESOURCES_DIR").expect("RESOURCES_DIR is not defined"),
    )
    .join("public/standard");

    Ok(NamedFile::open(standard_dir.join("robots.txt"))?)
}

pub async fn sitemap() -> actix_web::Result<NamedFile> {
    let standard_dir = std::path::PathBuf::from(
        std::env::var("RESOURCES_DIR").expect("RESOURCES_DIR is not defined"),
    )
    .join("public/standard");

    Ok(NamedFile::open(standard_dir.join("sitemap.xml"))?)
}