From 4ad695eed6c2a3fa7fb164c4a0e4972dab2691d2 Mon Sep 17 00:00:00 2001 From: Lukas Stabe Date: Fri, 25 Sep 2020 05:23:23 +0200 Subject: [wip] client-side color-scheme handling --- src/listing.rs | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'src/listing.rs') diff --git a/src/listing.rs b/src/listing.rs index d14a188..40c84b3 100644 --- a/src/listing.rs +++ b/src/listing.rs @@ -15,7 +15,6 @@ use strum_macros::{Display, EnumString}; use crate::archive::CompressionMethod; use crate::errors::{self, ContextualError}; use crate::renderer; -use crate::themes::ColorScheme; const FRAGMENT: &AsciiSet = &CONTROLS.add(b' ').add(b'"').add(b'<').add(b'>').add(b'`'); @@ -25,7 +24,6 @@ pub struct QueryParameters { pub path: Option, pub sort: Option, pub order: Option, - pub theme: Option, qrcode: Option, download: Option, } @@ -153,7 +151,6 @@ pub fn directory_listing( file_upload: bool, random_route: Option, favicon_route: String, - default_color_scheme: ColorScheme, show_qrcode: bool, upload_route: String, tar_enabled: bool, @@ -323,8 +320,6 @@ pub fn directory_listing( } } - let color_scheme = query_params.theme.unwrap_or(default_color_scheme); - if let Some(compression_method) = query_params.download { if !compression_method.is_enabled(tar_enabled, zip_enabled) { return Ok(ServiceResponse::new( @@ -338,8 +333,6 @@ pub fn directory_listing( "/", None, None, - color_scheme, - default_color_scheme, false, false, &favicon_route, @@ -393,13 +386,10 @@ pub fn directory_listing( .content_type("text/html; charset=utf-8") .body( renderer::page( - serve_path, entries, is_root, query_params.sort, query_params.order, - default_color_scheme, - color_scheme, show_qrcode, file_upload, &upload_route, @@ -421,7 +411,6 @@ pub fn extract_query_parameters(req: &HttpRequest) -> QueryParameters { sort: query.sort, order: query.order, download: query.download, - theme: query.theme, qrcode: query.qrcode.to_owned(), path: query.path.clone(), }, @@ -432,7 +421,6 @@ pub fn extract_query_parameters(req: &HttpRequest) -> QueryParameters { sort: None, order: None, download: None, - theme: None, qrcode: None, path: None, } -- cgit v1.2.3 From dab13c9bb3336aac4e44171f3074c4ce973b9782 Mon Sep 17 00:00:00 2001 From: Lukas Stabe Date: Sat, 26 Sep 2020 04:45:31 +0200 Subject: move css out of html into its own route --- src/listing.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/listing.rs') diff --git a/src/listing.rs b/src/listing.rs index 40c84b3..322de73 100644 --- a/src/listing.rs +++ b/src/listing.rs @@ -151,6 +151,7 @@ pub fn directory_listing( file_upload: bool, random_route: Option, favicon_route: String, + css_route: String, show_qrcode: bool, upload_route: String, tar_enabled: bool, @@ -336,6 +337,7 @@ pub fn directory_listing( false, false, &favicon_route, + &css_route, ) .into_string(), ), @@ -394,6 +396,7 @@ pub fn directory_listing( file_upload, &upload_route, &favicon_route, + &css_route, &encoded_dir, breadcrumbs, tar_enabled, -- cgit v1.2.3 From 47895cad827180787a8f305ddac0372d2dbd266a Mon Sep 17 00:00:00 2001 From: Lukas Stabe Date: Thu, 1 Oct 2020 18:08:05 +0200 Subject: restore default theme cli option and add default theme dark option --- src/listing.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/listing.rs') diff --git a/src/listing.rs b/src/listing.rs index 322de73..755b026 100644 --- a/src/listing.rs +++ b/src/listing.rs @@ -152,6 +152,8 @@ pub fn directory_listing( random_route: Option, favicon_route: String, css_route: String, + default_color_scheme: &str, + default_color_scheme_dark: &str, show_qrcode: bool, upload_route: String, tar_enabled: bool, @@ -338,6 +340,8 @@ pub fn directory_listing( false, &favicon_route, &css_route, + default_color_scheme, + default_color_scheme_dark, ) .into_string(), ), @@ -397,6 +401,8 @@ pub fn directory_listing( &upload_route, &favicon_route, &css_route, + default_color_scheme, + default_color_scheme_dark, &encoded_dir, breadcrumbs, tar_enabled, -- cgit v1.2.3