diff options
author | boasting-squirrel <boasting.squirrel@gmail.com> | 2019-04-03 18:07:33 +0000 |
---|---|---|
committer | boasting-squirrel <boasting.squirrel@gmail.com> | 2019-04-03 18:07:33 +0000 |
commit | 0304ea92390c06ccbbd7d29a88ecedc9718d72c2 (patch) | |
tree | 670c3b12843187e042ca3981960b0cf56230985e /src/listing.rs | |
parent | Added light theme (diff) | |
download | miniserve-0304ea92390c06ccbbd7d29a88ecedc9718d72c2.tar.gz miniserve-0304ea92390c06ccbbd7d29a88ecedc9718d72c2.zip |
Added CLI argument to set default theme
Diffstat (limited to 'src/listing.rs')
-rw-r--r-- | src/listing.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/listing.rs b/src/listing.rs index 4a20db2..64eb575 100644 --- a/src/listing.rs +++ b/src/listing.rs @@ -13,9 +13,6 @@ use crate::errors; use crate::renderer; use crate::themes; -/// Default color scheme, when none is set through query parameters -const DEFAULT_COLORSCHEME: themes::ColorScheme = themes::ColorScheme::Archlinux; - /// Query parameters #[derive(Debug, Deserialize)] struct QueryParameters { @@ -150,6 +147,7 @@ pub fn directory_listing<S>( req: &HttpRequest<S>, skip_symlinks: bool, random_route: Option<String>, + default_color_scheme: themes::ColorScheme, ) -> Result<HttpResponse, io::Error> { let title = format!("Index of {}", req.path()); let base = Path::new(req.path()); @@ -255,7 +253,7 @@ pub fn directory_listing<S>( } } - let color_scheme = color_scheme.unwrap_or(DEFAULT_COLORSCHEME); + let color_scheme = color_scheme.unwrap_or(default_color_scheme); if let Some(compression_method) = &download { log::info!( |