From 8ed18a551696ba4f89d7dfbdeaa879b21e079d33 Mon Sep 17 00:00:00 2001 From: boasting-squirrel Date: Mon, 1 Apr 2019 20:36:35 +0200 Subject: Color schemes --- src/main.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index f662a73..92f4352 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,5 @@ #![feature(proc_macro_hygiene)] +#![feature(custom_attribute)] use actix_web::{fs, middleware, server, App}; use clap::crate_version; @@ -15,6 +16,7 @@ mod auth; mod errors; mod listing; mod renderer; +mod themes; #[derive(Clone, Debug)] /// Configuration of the Miniserve application -- cgit v1.2.3 From ab36fd82b6b02f967e577adfdfdd6dce982bb3d2 Mon Sep 17 00:00:00 2001 From: boasting-squirrel Date: Mon, 1 Apr 2019 20:57:57 +0200 Subject: Removed useless feature --- src/main.rs | 1 - 1 file changed, 1 deletion(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 92f4352..1a4a68f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,4 @@ #![feature(proc_macro_hygiene)] -#![feature(custom_attribute)] use actix_web::{fs, middleware, server, App}; use clap::crate_version; -- cgit v1.2.3 From 0304ea92390c06ccbbd7d29a88ecedc9718d72c2 Mon Sep 17 00:00:00 2001 From: boasting-squirrel Date: Wed, 3 Apr 2019 20:07:33 +0200 Subject: Added CLI argument to set default theme --- src/main.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 1a4a68f..79a5db2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -43,6 +43,9 @@ pub struct MiniserveConfig { /// Enable random route generation pub random_route: Option, + + /// Default color scheme + pub default_color_scheme: themes::ColorScheme, } fn main() { @@ -179,6 +182,7 @@ fn configure_app(app: App) -> App { let path = &app.state().path; let no_symlinks = app.state().no_symlinks; let random_route = app.state().random_route.clone(); + let default_color_scheme = app.state().default_color_scheme.clone(); if path.is_file() { None } else { @@ -187,7 +191,13 @@ fn configure_app(app: App) -> App { .expect("Couldn't create path") .show_files_listing() .files_listing_renderer(move |dir, req| { - listing::directory_listing(dir, req, no_symlinks, random_route.clone()) + listing::directory_listing( + dir, + req, + no_symlinks, + random_route.clone(), + default_color_scheme.clone(), + ) }), ) } -- cgit v1.2.3 From bbdafc3e121942c95ba81db1cba30fe438d88dfb Mon Sep 17 00:00:00 2001 From: boasting-squirrel Date: Sun, 7 Apr 2019 13:27:25 +0200 Subject: Use strum to reduce boilerplate on ColorScheme enum + removed useless Debug derives --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 64de8d3..a703b00 100644 --- a/src/main.rs +++ b/src/main.rs @@ -19,7 +19,7 @@ mod listing; mod renderer; mod themes; -#[derive(Clone, Debug)] +#[derive(Clone)] /// Configuration of the Miniserve application pub struct MiniserveConfig { /// Enable verbose mode -- cgit v1.2.3