aboutsummaryrefslogtreecommitdiffstats
path: root/src/listing.rs
diff options
context:
space:
mode:
authorjikstra <jikstra@disroot.org>2021-04-25 15:48:09 +0000
committerjikstra <jikstra@disroot.org>2021-09-01 19:08:00 +0000
commit06db56e40820ec0067d18840648ee786163a3862 (patch)
tree638eb60a484ba0b17a8373703141e19812dd0859 /src/listing.rs
parentAdd CHANGELOG entry for printing QR codes on terminal (diff)
downloadminiserve-06db56e40820ec0067d18840648ee786163a3862.tar.gz
miniserve-06db56e40820ec0067d18840648ee786163a3862.zip
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
Diffstat (limited to '')
-rw-r--r--src/listing.rs7
1 files changed, 7 insertions, 0 deletions
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<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();
@@ -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,
}