diff options
Diffstat (limited to 'src/routes.rs')
-rw-r--r-- | src/routes.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/routes.rs b/src/routes.rs index 982e5ef..7369f98 100644 --- a/src/routes.rs +++ b/src/routes.rs @@ -8,6 +8,7 @@ use tera::Tera; use url::form_urlencoded; use crate::controller; +use crate::controller::utils::file; use crate::controller::wallet::Wallet; use crate::db; use crate::model::config::Config; @@ -40,9 +41,13 @@ pub async fn routes( ) .await } - (&Method::GET, ["assets", _, file]) => { - controller::utils::file(&format!("assets/{}", file)).await - } + (&Method::GET, ["assets", _, filename]) => match *filename { + "main.js" => file("assets/main.js", "text/javascript").await, + "chart.js" => file("assets/chart.js", "text/javascript").await, + "main.css" => file("assets/main.css", "text/css").await, + "icon.png" => file("assets/icon.png", "image/png").await, + _ => controller::utils::not_found(), + }, _ => match connected_user(&pool, &request).await { Some(user) => { let wallet = Wallet { |