aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLzzzt <liuzitao0123@gmail.com>2025-03-03 06:45:12 +0000
committerLzzzt <liuzitao0123@gmail.com>2025-03-03 06:49:25 +0000
commit6d6d836d2dbe7b37bc46311d0535c14a25264ac0 (patch)
tree6b88522390c3dfcd79030db6b467b5a44087eb9f
parentShow File Size in Bytes (diff)
downloadminiserve-6d6d836d2dbe7b37bc46311d0535c14a25264ac0.tar.gz
miniserve-6d6d836d2dbe7b37bc46311d0535c14a25264ac0.zip
make the option effect raw mode
Signed-off-by: Lzzzt <liuzitao0123@gmail.com>
-rw-r--r--src/args.rs4
-rw-r--r--src/config.rs4
-rw-r--r--src/renderer.rs10
3 files changed, 9 insertions, 9 deletions
diff --git a/src/args.rs b/src/args.rs
index 783d671..b54c3cb 100644
--- a/src/args.rs
+++ b/src/args.rs
@@ -352,8 +352,8 @@ pub struct CliArgs {
pub enable_webdav: bool,
/// Show served file size in exact bytes.
- #[arg(long, default_value = "false", env = "MINISERVE_SHOW_SIZE_IN_BYTE")]
- pub show_size_in_byte: bool,
+ #[arg(long, default_value = "false", env = "MINISERVE_SHOW_EXACT_BYTES")]
+ pub show_exact_bytes: bool,
}
/// Checks whether an interface is valid, i.e. it can be parsed into an IP address
diff --git a/src/config.rs b/src/config.rs
index 03d3f4b..9a470ef 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -159,7 +159,7 @@ pub struct MiniserveConfig {
pub webdav_enabled: bool,
/// If enabled, will show in exact byte size of the file
- pub show_size_in_byte: bool,
+ pub show_exact_bytes: bool,
/// If set, use provided rustls config for TLS
#[cfg(feature = "tls")]
@@ -323,7 +323,7 @@ impl MiniserveConfig {
webdav_enabled: args.enable_webdav,
tls_rustls_config: tls_rustls_server_config,
compress_response: args.compress_response,
- show_size_in_byte: args.show_size_in_byte,
+ show_exact_bytes: args.show_exact_bytes,
})
}
}
diff --git a/src/renderer.rs b/src/renderer.rs
index e86bb22..af6d3b5 100644
--- a/src/renderer.rs
+++ b/src/renderer.rs
@@ -150,7 +150,7 @@ pub fn page(
}
}
@for entry in entries {
- (entry_row(entry, sort_method, sort_order, false, conf.show_size_in_byte))
+ (entry_row(entry, sort_method, sort_order, false, conf.show_exact_bytes))
}
}
}
@@ -238,7 +238,7 @@ pub fn raw(entries: Vec<Entry>, is_root: bool, conf: &MiniserveConfig) -> Markup
}
}
@for entry in entries {
- (entry_row(entry, None, None, true, conf.show_size_in_byte))
+ (entry_row(entry, None, None, true, conf.show_exact_bytes))
}
}
}
@@ -522,7 +522,7 @@ fn entry_row(
sort_method: Option<SortingMethod>,
sort_order: Option<SortingOrder>,
raw: bool,
- show_size_in_byte: bool,
+ show_exact_bytes: bool,
) -> Markup {
html! {
tr {
@@ -555,7 +555,7 @@ fn entry_row(
@if !raw {
@if let Some(size) = entry.size {
- @if show_size_in_byte {
+ @if show_exact_bytes {
span.mobile-info.size {
(maud::display(format!("{}B", size.as_u64())))
}
@@ -576,7 +576,7 @@ fn entry_row(
}
td.size-cell {
@if let Some(size) = entry.size {
- @if show_size_in_byte {
+ @if show_exact_bytes {
(maud::display(format!("{}B", size.as_u64())))
}@else {
(maud::display(size))