diff --git a/src/rweb.rs b/src/rweb.rs index 160af19..88a1058 100644 --- a/src/rweb.rs +++ b/src/rweb.rs @@ -3,20 +3,16 @@ use std::io::Write; use std::net::SocketAddr; use std::path::PathBuf; -use cacher::Cacher; use google_photoslibrary1 as photos; use log::error; use photos::schemas::{Album, MediaItem}; use prometheus::Encoder; -use rocket::error::LaunchError; use rocket::http::ContentType; -use rocket::response::content::Html; use rocket::response::status::NotFound; use rocket::response::Content; -use rocket::{Request, State}; +use rocket::State; use rocket_contrib::json::Json; use rust_embed::RustEmbed; -use serde::Deserialize; use crate::library::Library; @@ -34,22 +30,22 @@ fn metrics() -> Content> { } #[get("/")] -fn index(lib: State) -> Result>, NotFound> { - file("index.html", lib) +fn index() -> Result>, NotFound> { + file("index.html") } #[get("/", rank = 99)] -fn path(path: PathBuf, lib: State) -> Result>, NotFound> { +fn path(path: PathBuf) -> Result>, NotFound> { let path = path.to_str().unwrap(); let path = if path.ends_with("/") { format!("{}index.html", path.to_string()) } else { path.to_string() }; - file(&path, lib) + file(&path) } -fn file(path: &str, lib: State) -> Result>, NotFound> { +fn file(path: &str) -> Result>, NotFound> { match Asset::get(path) { Some(bytes) => { let mime = mime_guess::from_path(path).first_or_octet_stream(); @@ -119,7 +115,7 @@ fn embedz() -> Content> { Content(ContentType::HTML, w) } -pub fn run(addr: SocketAddr, lib: Library) -> Result<(), Box> { +pub fn run(_addr: SocketAddr, lib: Library) -> Result<(), Box> { let e = rocket::ignite() .manage(lib) .mount(