routing::get, Router, TypedHeader, }, axum_server::Handle, rust_embed::RustEmbed, rustls_acme::{ acme::{LETS_ENCRYPT_PRODUCTION_DIRECTORY, LETS_ENCRYPT_STAGING_DIRECTORY}, axum::AxumAcceptor, caches::DirCache, AcmeConfig, }, std::{cmp::Ordering, str, sync::Arc}, tokio_stream::StreamExt, tower_http::{ compression::CompressionLayer, cors::{Any, CorsLayer}, set_header::SetResponseHeaderLayer, }, }; mod accept_encoding; mod accept_json; mod error; #[derive(Clone)] pub struct ServerConfig { pub is_json_api_enabled: bool, } enum InscriptionQuery { Id(InscriptionId), Number(i32), } impl FromStr for InscriptionQuery { type Err = Error; fn from_str(s: &str) -> Result { Ok(if s.contains('i') { InscriptionQuery::Id(s.parse()?) } else { InscriptionQuery::Number(s.parse()?) }) } } enum BlockQuery { Height(u32), Hash(BlockHash), } impl FromStr for BlockQuery { type Err = Error; fn from_str(s: &str) -> Result {