aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--Cargo.lock37
-rw-r--r--Cargo.toml1
-rw-r--r--data/style.scss2
-rw-r--r--src/args.rs6
-rw-r--r--src/listing.rs18
-rw-r--r--src/main.rs15
7 files changed, 30 insertions, 50 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 85bf11e..0e8f721 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased] - ReleaseDate
- Print QR codes on terminal [#524](https://github.com/svenstaro/miniserve/pull/524) (thanks @aliemjay)
+- Fix mobile layout info pills taking whole width [#591](https://github.com/svenstaro/miniserve/issues/591)
## [0.16.0] - 2021-08-31
- Fix serving files with backslashes in their names [#578](https://github.com/svenstaro/miniserve/pull/578) (thanks @Jikstra)
diff --git a/Cargo.lock b/Cargo.lock
index 4a3b2c2..d0dfc80 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -513,9 +513,9 @@ checksum = "4964518bd3b4a8190e832886cdc0da9794f12e8e6c1613a9e90ff331c4c8724b"
[[package]]
name = "cc"
-version = "1.0.69"
+version = "1.0.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e70cc2f62c6ce1868963827bd677764c62d07c3d9a3e1fb1177ee1a9ab199eb2"
+checksum = "d26a6ce4b6a484fa3edb70f7efa6fc430fd2b87285fe8b84304fd0936faa0dc0"
dependencies = [
"jobserver",
]
@@ -663,9 +663,9 @@ dependencies = [
[[package]]
name = "ctor"
-version = "0.1.20"
+version = "0.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5e98e2ad1a782e33928b96fc3948e7c355e5af34ba4de7670fe8bac2a3b2006d"
+checksum = "ccc0a48a9b826acdf4028595adc9db92caea352f7af011a3034acd172a52a0aa"
dependencies = [
"quote",
"syn",
@@ -1404,7 +1404,6 @@ dependencies = [
"assert_cmd",
"assert_fs",
"atty",
- "bytes",
"bytesize",
"chrono",
"chrono-humanize",
@@ -1508,9 +1507,9 @@ dependencies = [
[[package]]
name = "num-bigint"
-version = "0.4.1"
+version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "76e97c412795abf6c24ba30055a8f20642ea57ca12875220b854cfa501bf1e48"
+checksum = "74e768dff5fb39a41b3bcd30bb25cf989706c90d028d1ad71971987aa309d535"
dependencies = [
"autocfg",
"num-integer",
@@ -1849,9 +1848,9 @@ checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086"
[[package]]
name = "proc-macro2"
-version = "1.0.28"
+version = "1.0.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5c7ed8b8c7b886ea3ed7dde405212185f423ab44682667c8c6dd14aa1d9f6612"
+checksum = "b9f5105d4fdaab20335ca9565e106a5d9b82b6219b5ba735731124ac6711d23d"
dependencies = [
"unicode-xid",
]
@@ -2291,9 +2290,9 @@ dependencies = [
[[package]]
name = "siphasher"
-version = "0.3.6"
+version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "729a25c17d72b06c68cb47955d44fda88ad2d3e7d77e025663fdd69b93dd71a1"
+checksum = "533494a8f9b724d33625ab53c6c4800f7cc445895924a8ef649222dcb76e938b"
[[package]]
name = "slab"
@@ -2438,9 +2437,9 @@ dependencies = [
[[package]]
name = "syn"
-version = "1.0.75"
+version = "1.0.76"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b7f58f7e8eaa0009c5fec437aabf511bd9933e4b2d7407bd05273c01a8906ea7"
+checksum = "c6f107db402c2c2055242dbf4d2af0e69197202e9faacbef9571bbe47f5a1b84"
dependencies = [
"proc-macro2",
"quote",
@@ -2615,9 +2614,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]]
name = "tokio"
-version = "1.10.1"
+version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "92036be488bb6594459f2e03b60e42df6f937fe6ca5c5ffdcb539c6b84dc40f5"
+checksum = "b4efe6fc2395938c8155973d7be49fe8d03a843726e285e100a8a383cc0154ce"
dependencies = [
"autocfg",
"bytes",
@@ -2645,9 +2644,9 @@ dependencies = [
[[package]]
name = "tokio-util"
-version = "0.6.7"
+version = "0.6.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1caa0b0c8d94a049db56b5acf8cba99dc0623aab1b26d5b5f5e2d945846b3592"
+checksum = "08d3725d3efa29485e87311c5b699de63cde14b00ed4d256b8318aa30ca452cd"
dependencies = [
"bytes",
"futures-core",
@@ -2707,9 +2706,9 @@ dependencies = [
[[package]]
name = "typenum"
-version = "1.13.0"
+version = "1.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06"
+checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec"
[[package]]
name = "ucd-trie"
diff --git a/Cargo.toml b/Cargo.toml
index ada8e05..db51a4d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -50,7 +50,6 @@ qrcodegen = "1"
mime = "0.3"
httparse = "1"
http = "0.2"
-bytes = "1"
atty = "0.2"
rustls = { version = "0.19", optional = true }
socket2 = "0.4"
diff --git a/data/style.scss b/data/style.scss
index 7e63751..03ad0af 100644
--- a/data/style.scss
+++ b/data/style.scss
@@ -469,6 +469,8 @@ th span.active span {
.mobile-info {
display: block;
+ float: right;
+ margin-top: 0.5rem;
}
table tbody tr td {
diff --git a/src/args.rs b/src/args.rs
index 5467573..ff8d92b 100644
--- a/src/args.rs
+++ b/src/args.rs
@@ -1,4 +1,3 @@
-use bytes::Bytes;
use clap::{Clap, ValueHint};
use clap_generate::Shell;
use http::header::{HeaderMap, HeaderName, HeaderValue};
@@ -212,15 +211,14 @@ fn parse_auth(src: &str) -> Result<auth::RequiredAuth, ContextualError> {
/// Custom header parser (allow multiple headers input)
pub fn parse_header(src: &str) -> Result<HeaderMap, httparse::Error> {
let mut headers = [httparse::EMPTY_HEADER; 1];
- let mut header = src.to_string();
- header.push('\n');
+ let header = format!("{}\n", src);
httparse::parse_headers(header.as_bytes(), &mut headers)?;
let mut header_map = HeaderMap::new();
if let Some(h) = headers.first() {
if h.name != httparse::EMPTY_HEADER.name {
header_map.insert(
- HeaderName::from_bytes(&Bytes::copy_from_slice(h.name.as_bytes())).unwrap(),
+ HeaderName::from_bytes(h.name.as_bytes()).unwrap(),
HeaderValue::from_bytes(h.value).unwrap(),
);
}
diff --git a/src/listing.rs b/src/listing.rs
index b2730de..ef4c8c8 100644
--- a/src/listing.rs
+++ b/src/listing.rs
@@ -27,7 +27,7 @@ mod percent_encode_sets {
}
/// Query parameters
-#[derive(Deserialize)]
+#[derive(Deserialize, Default)]
pub struct QueryParameters {
pub path: Option<PathBuf>,
pub sort: Option<SortingMethod>,
@@ -383,23 +383,11 @@ pub fn directory_listing(
pub fn extract_query_parameters(req: &HttpRequest) -> QueryParameters {
match Query::<QueryParameters>::from_query(req.query_string()) {
- Ok(query) => QueryParameters {
- sort: query.sort,
- order: query.order,
- download: query.download,
- qrcode: query.qrcode.to_owned(),
- path: query.path.clone(),
- },
+ Ok(Query(query_params)) => query_params,
Err(e) => {
let err = ContextualError::ParseError("query parameters".to_string(), e.to_string());
errors::log_error_chain(err.to_string());
- QueryParameters {
- sort: None,
- order: None,
- download: None,
- qrcode: None,
- path: None,
- }
+ QueryParameters::default()
}
}
}
diff --git a/src/main.rs b/src/main.rs
index 5259bee..133f320 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -297,17 +297,10 @@ fn create_tcp_listener(addr: SocketAddr) -> io::Result<TcpListener> {
}
fn configure_header(conf: &MiniserveConfig) -> middleware::DefaultHeaders {
- let headers = conf.clone().header;
-
- let mut default_headers = middleware::DefaultHeaders::new();
- for header in headers {
- for (header_name, header_value) in header.into_iter() {
- if let Some(header_name) = header_name {
- default_headers = default_headers.header(&header_name, header_value);
- }
- }
- }
- default_headers
+ conf.header.iter().flatten().fold(
+ middleware::DefaultHeaders::new(),
+ |headers, (header_name, header_value)| headers.header(header_name, header_value),
+ )
}
/// Configures the Actix application