use std::{fs, path::PathBuf, str::FromStr}; use blog_tools::{ medium::{get_medium_blog, MediumBlog, MediumBlogEntry}, sitemap::SitemapOptions, Blog, }; use lazy_static::lazy_static; use rocket::{ fs::{relative, FileServer}, response::{content::RawXml, Redirect}, Request, Route, }; use rocket_dyn_templates::Template; #[macro_use] extern crate rocket; #[rocket::main] async fn main() { let port = 8080_u16; let figment = rocket::Config::figment() .merge(("port", port)) .merge(("address", "0.0.0.0")); if let Err(e) = rocket::custom(figment) .mount("/", FileServer::from(relative!("examples/assets/"))) .register("/", catchers![not_found, error]) .attach(Template::fairing()) // .attach(config) .mount("/", get_all_routes()) // .manage(bucket_info) .launch() .await { println!("Did not run. Error: {:?}", e) } } #[get("/sitemap.xml")] fn sitemap() -> RawXml { let blog = get_blog_context(); return RawXml(blog.sitemap.clone()); } #[get("/blog")] fn blog_index() -> Option