feat: serve files from export dir
This commit is contained in:
parent
3d74a8ce89
commit
1e33e5303a
2 changed files with 8 additions and 2 deletions
|
@ -58,6 +58,8 @@ lazy_static! {
|
||||||
FILES.get("./static/cache/bundle/glue.js").unwrap();
|
FILES.get("./static/cache/bundle/glue.js").unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub const DOWNLOAD_SCOPE: &str = "/download";
|
||||||
|
|
||||||
pub const CACHE_AGE: u32 = 604800;
|
pub const CACHE_AGE: u32 = 604800;
|
||||||
|
|
||||||
pub const COMPILED_DATE: &str = env!("COMPILED_DATE");
|
pub const COMPILED_DATE: &str = env!("COMPILED_DATE");
|
||||||
|
@ -109,7 +111,9 @@ async fn main() -> std::io::Result<()> {
|
||||||
.wrap(actix_middleware::NormalizePath::new(
|
.wrap(actix_middleware::NormalizePath::new(
|
||||||
actix_middleware::TrailingSlash::Trim,
|
actix_middleware::TrailingSlash::Trim,
|
||||||
))
|
))
|
||||||
.service(Files::new("/download", &settings.publish.dir).show_files_listing())
|
.service(
|
||||||
|
Files::new(DOWNLOAD_SCOPE, &settings.publish.dir).show_files_listing(),
|
||||||
|
)
|
||||||
.configure(services)
|
.configure(services)
|
||||||
.app_data(data.clone())
|
.app_data(data.clone())
|
||||||
})
|
})
|
||||||
|
|
|
@ -126,7 +126,9 @@ macro_rules! get_app {
|
||||||
.wrap(actix_web::middleware::NormalizePath::new(
|
.wrap(actix_web::middleware::NormalizePath::new(
|
||||||
actix_web::middleware::TrailingSlash::Trim,
|
actix_web::middleware::TrailingSlash::Trim,
|
||||||
))
|
))
|
||||||
.service(Files::new("/download", &$settings.publish.dir).show_files_listing())
|
.service(
|
||||||
|
Files::new("/download", &$settings.publish.dir).show_files_listing(),
|
||||||
|
)
|
||||||
.configure($crate::services)
|
.configure($crate::services)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue