diff options
author | Sven-Hendrik Haase <svenstaro@gmail.com> | 2021-09-23 18:36:26 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-23 18:36:26 +0000 |
commit | d5995e82cecd5138fa092694292444a02af1bba9 (patch) | |
tree | 833a6f473138418e2e275675de16c4463cd029a2 /src/listing.rs | |
parent | Rename Archlinux -> Arch Linux (diff) | |
parent | cargo fmt (diff) | |
download | miniserve-d5995e82cecd5138fa092694292444a02af1bba9.tar.gz miniserve-d5995e82cecd5138fa092694292444a02af1bba9.zip |
Merge pull request #508 from Jikstra/feat_raw_mode
Implement a raw rendering mode for recursive folder download
Diffstat (limited to 'src/listing.rs')
-rw-r--r-- | src/listing.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/listing.rs b/src/listing.rs index ef4c8c8..9273025 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<PathBuf>, pub sort: Option<SortingMethod>, pub order: Option<SortingOrder>, + pub raw: Option<bool>, qrcode: Option<String>, download: Option<ArchiveMethod>, } @@ -152,6 +154,9 @@ pub fn directory_listing( dir: &actix_files::Directory, req: &HttpRequest, ) -> io::Result<ServiceResponse> { + let extensions = req.extensions(); + let current_user: Option<&CurrentUser> = extensions.get::<CurrentUser>(); + use actix_web::dev::BodyEncoding; let conf = req.app_data::<crate::MiniserveConfig>().unwrap(); let serve_path = req.path(); @@ -374,6 +379,7 @@ pub fn directory_listing( breadcrumbs, &encoded_dir, conf, + current_user, ) .into_string(), ), |