From f01659ea5025579676d853db5ba161b474d0da2a Mon Sep 17 00:00:00 2001 From: AINDUSTRIES Date: Mon, 6 Oct 2025 22:33:32 +0200 Subject: [PATCH] Changed file serving to use asset directory from config --- src/pages/files.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/files.rs b/src/pages/files.rs index 7eb8939..f695d92 100644 --- a/src/pages/files.rs +++ b/src/pages/files.rs @@ -1,13 +1,13 @@ +use crate::AppState; use actix_web::web::Path; -use actix_web::{HttpResponse, Responder, get}; +use actix_web::{HttpResponse, Responder, get, web}; use std::fs::File; use std::io::Read; use std::path::PathBuf; #[get("/static/{file_type}/{file_name}")] -async fn file(file: Path<(String, String)>) -> impl Responder { - //TODO use assets dir - let mut path = PathBuf::from("assets"); +async fn file(file: Path<(String, String)>, data: web::Data) -> impl Responder { + let mut path = PathBuf::from(&data.assets); path.push(&file.0.replace("/", "")); path.push(&file.1.replace("/", "")); let mut file = File::open(path).unwrap();