From 06db56e40820ec0067d18840648ee786163a3862 Mon Sep 17 00:00:00 2001 From: jikstra Date: Sun, 25 Apr 2021 17:48:09 +0200 Subject: Implement a raw rendering mode for recursive folder download - Raw mode only displays file/folders and is more focused on computer processing - Display a banner in footer to recursively download the current folder with wget --- src/listing.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/listing.rs') diff --git a/src/listing.rs b/src/listing.rs index b2730de..b00a671 100644 --- a/src/listing.rs +++ b/src/listing.rs @@ -12,6 +12,7 @@ use std::time::SystemTime; use strum_macros::{Display, EnumString}; use crate::archive::ArchiveMethod; +use crate::auth::CurrentUser; use crate::errors::{self, ContextualError}; use crate::renderer; use percent_encode_sets::PATH_SEGMENT; @@ -32,6 +33,7 @@ pub struct QueryParameters { pub path: Option, pub sort: Option, pub order: Option, + pub raw: Option, qrcode: Option, download: Option, } @@ -152,6 +154,9 @@ pub fn directory_listing( dir: &actix_files::Directory, req: &HttpRequest, ) -> io::Result { + let extensions = req.extensions(); + let current_user: Option<&CurrentUser> = extensions.get::(); + use actix_web::dev::BodyEncoding; let conf = req.app_data::().unwrap(); let serve_path = req.path(); @@ -387,6 +392,7 @@ pub fn extract_query_parameters(req: &HttpRequest) -> QueryParameters { sort: query.sort, order: query.order, download: query.download, + raw: query.raw, qrcode: query.qrcode.to_owned(), path: query.path.clone(), }, @@ -397,6 +403,7 @@ pub fn extract_query_parameters(req: &HttpRequest) -> QueryParameters { sort: None, order: None, download: None, + raw: None, qrcode: None, path: None, } -- cgit v1.2.3 From b94bb361e30e90656edfce5f9a63d41452ba100f Mon Sep 17 00:00:00 2001 From: jikstra Date: Thu, 2 Sep 2021 15:33:58 +0200 Subject: Fix rebase --- src/listing.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'src/listing.rs') diff --git a/src/listing.rs b/src/listing.rs index b00a671..c1c9597 100644 --- a/src/listing.rs +++ b/src/listing.rs @@ -379,6 +379,7 @@ pub fn directory_listing( breadcrumbs, &encoded_dir, conf, + current_user ) .into_string(), ), -- cgit v1.2.3 From 680b0d001d58a32b0caac3263103dbd9ddb5fe84 Mon Sep 17 00:00:00 2001 From: jikstra Date: Thu, 2 Sep 2021 15:50:35 +0200 Subject: cargo fmt & cargo clippy --- src/listing.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/listing.rs') diff --git a/src/listing.rs b/src/listing.rs index c1c9597..20768f1 100644 --- a/src/listing.rs +++ b/src/listing.rs @@ -379,7 +379,7 @@ pub fn directory_listing( breadcrumbs, &encoded_dir, conf, - current_user + current_user, ) .into_string(), ), -- cgit v1.2.3