mirror of
https://github.com/sigoden/dufs.git
synced 2026-04-09 00:59:02 +03:00
Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a493c13734 | ||
|
|
ae2f878e62 | ||
|
|
277d9d22d4 | ||
|
|
c62926d19c | ||
|
|
cccbbe9ea4 | ||
|
|
147048690f | ||
|
|
9cfd66dab9 | ||
|
|
b791549ec7 | ||
|
|
f148817c52 | ||
|
|
00ae36d486 | ||
|
|
4e823e8bba | ||
|
|
4e84e6c532 | ||
|
|
f49b590a56 | ||
|
|
cb1f3cddea | ||
|
|
05dbcfb2df | ||
|
|
76e967fa59 | ||
|
|
140a360e37 | ||
|
|
604cbb7412 | ||
|
|
c6541b1c36 | ||
|
|
b6729a3d64 |
38
CHANGELOG.md
38
CHANGELOG.md
@@ -2,6 +2,44 @@
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## [0.28.0] - 2022-07-31
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- File path contains special charactors ([#114](https://github.com/sigoden/dufs/issues/114))
|
||||
|
||||
### Features
|
||||
|
||||
- Add table row hover ([#115](https://github.com/sigoden/dufs/issues/115))
|
||||
- Support customize http log format ([#116](https://github.com/sigoden/dufs/issues/116))
|
||||
|
||||
## [0.27.0] - 2022-07-25
|
||||
|
||||
### Features
|
||||
|
||||
- Improve hidden to support glob ([#108](https://github.com/sigoden/dufs/issues/108))
|
||||
- Adjust digest auth timeout to 1day ([#110](https://github.com/sigoden/dufs/issues/110))
|
||||
|
||||
## [0.26.0] - 2022-07-11
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- Cors headers ([#100](https://github.com/sigoden/dufs/issues/100))
|
||||
|
||||
### Features
|
||||
|
||||
- Make --path-prefix works on serving single file ([#102](https://github.com/sigoden/dufs/issues/102))
|
||||
|
||||
## [0.25.0] - 2022-07-06
|
||||
|
||||
### Features
|
||||
|
||||
- Ui supports creating folder ([#91](https://github.com/sigoden/dufs/issues/91))
|
||||
- Ui supports move folder/file to new path ([#92](https://github.com/sigoden/dufs/issues/92))
|
||||
- Check permission on move/copy destination ([#93](https://github.com/sigoden/dufs/issues/93))
|
||||
- Add completions ([#97](https://github.com/sigoden/dufs/issues/97))
|
||||
- Limit the number of concurrent uploads ([#98](https://github.com/sigoden/dufs/issues/98))
|
||||
|
||||
## [0.24.0] - 2022-07-02
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
529
Cargo.lock
generated
529
Cargo.lock
generated
@@ -17,15 +17,6 @@ dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ansi_term"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "assert_cmd"
|
||||
version = "2.0.4"
|
||||
@@ -134,21 +125,6 @@ version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
|
||||
|
||||
[[package]]
|
||||
name = "bit-set"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de"
|
||||
dependencies = [
|
||||
"bit-vec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bit-vec"
|
||||
version = "0.6.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.3.2"
|
||||
@@ -192,9 +168,9 @@ checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3"
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.1.0"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"
|
||||
checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
@@ -223,9 +199,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "3.2.8"
|
||||
version = "3.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "190814073e85d238f31ff738fcb0bf6910cedeb73376c87cd69291028966fd83"
|
||||
checksum = "a3dbbb6653e7c55cc8595ad3e1f7be8f32aba4eb7ff7f0fd1163d4f3d137c0a9"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"clap_lex",
|
||||
@@ -234,6 +210,15 @@ dependencies = [
|
||||
"textwrap",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_complete"
|
||||
version = "3.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ead064480dfc4880a10764488415a97fdd36a4cf1bb022d372f02e8faf8386e1"
|
||||
dependencies = [
|
||||
"clap",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_lex"
|
||||
version = "0.2.4"
|
||||
@@ -279,9 +264,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.10"
|
||||
version = "0.8.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d82ee10ce34d7bc12c2122495e7593a9c41347ecdd64185af4ecf72cb1a7f83"
|
||||
checksum = "51887d4adc7b564537b15adcfb307936f8075dfcd5f00dde9a9f1d29383682bc"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
@@ -289,30 +274,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "crypto-common"
|
||||
version = "0.1.3"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8"
|
||||
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ctor"
|
||||
version = "0.1.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f877be4f7c9f246b183111634f75baa039715e3f46ce860677d3b19a69fb229c"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "diff"
|
||||
version = "0.1.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8"
|
||||
|
||||
[[package]]
|
||||
name = "difflib"
|
||||
version = "0.4.0"
|
||||
@@ -347,7 +316,7 @@ dependencies = [
|
||||
"digest 0.9.0",
|
||||
"hex",
|
||||
"md-5",
|
||||
"rand 0.8.5",
|
||||
"rand",
|
||||
"sha2",
|
||||
]
|
||||
|
||||
@@ -370,7 +339,7 @@ checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
|
||||
|
||||
[[package]]
|
||||
name = "dufs"
|
||||
version = "0.24.0"
|
||||
version = "0.28.0"
|
||||
dependencies = [
|
||||
"assert_cmd",
|
||||
"assert_fs",
|
||||
@@ -379,6 +348,7 @@ dependencies = [
|
||||
"base64",
|
||||
"chrono",
|
||||
"clap",
|
||||
"clap_complete",
|
||||
"diqwest",
|
||||
"futures",
|
||||
"headers",
|
||||
@@ -391,13 +361,11 @@ dependencies = [
|
||||
"percent-encoding",
|
||||
"port_check",
|
||||
"predicates",
|
||||
"pretty_assertions",
|
||||
"regex",
|
||||
"reqwest",
|
||||
"rstest",
|
||||
"rustls",
|
||||
"rustls-pemfile",
|
||||
"select",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"socket2",
|
||||
@@ -428,9 +396,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "fastrand"
|
||||
version = "1.7.0"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf"
|
||||
checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499"
|
||||
dependencies = [
|
||||
"instant",
|
||||
]
|
||||
@@ -485,16 +453,6 @@ dependencies = [
|
||||
"percent-encoding",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futf"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df420e2e84819663797d1ec6544b13c5be84629e7bb00dc960d6917db2987843"
|
||||
dependencies = [
|
||||
"mac",
|
||||
"new_debug_unreachable",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures"
|
||||
version = "0.3.21"
|
||||
@@ -600,17 +558,6 @@ dependencies = [
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.1.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"wasi 0.9.0+wasi-snapshot-preview1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.7"
|
||||
@@ -667,9 +614,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.12.1"
|
||||
version = "0.12.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db0d4cf898abf0081f964436dc980e96670a0f36863e4b83aaacdb65c9d7ccc3"
|
||||
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
||||
|
||||
[[package]]
|
||||
name = "headers"
|
||||
@@ -711,20 +658,6 @@ version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
||||
|
||||
[[package]]
|
||||
name = "html5ever"
|
||||
version = "0.25.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e5c13fb08e5d4dfc151ee5e88bae63f7773d61852f3bdc73c9f4b9e1bde03148"
|
||||
dependencies = [
|
||||
"log",
|
||||
"mac",
|
||||
"markup5ever",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "http"
|
||||
version = "0.2.8"
|
||||
@@ -761,9 +694,9 @@ checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"
|
||||
|
||||
[[package]]
|
||||
name = "hyper"
|
||||
version = "0.14.19"
|
||||
version = "0.14.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42dc3c131584288d375f2d07f822b0cb012d8c6fb899a5b9fdb3cb7eb9b6004f"
|
||||
checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-channel",
|
||||
@@ -890,9 +823,9 @@ checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d"
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.58"
|
||||
version = "0.3.59"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27"
|
||||
checksum = "258451ab10b34f8af53416d1fdab72c22e805f0c92a1136d59470ec0b11138b2"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
@@ -909,16 +842,6 @@ version = "0.2.126"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"scopeguard",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.17"
|
||||
@@ -928,38 +851,6 @@ dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mac"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4"
|
||||
|
||||
[[package]]
|
||||
name = "markup5ever"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a24f40fb03852d1cdd84330cddcaf98e9ec08a7b7768e952fad3b4cf048ec8fd"
|
||||
dependencies = [
|
||||
"log",
|
||||
"phf",
|
||||
"phf_codegen",
|
||||
"string_cache",
|
||||
"string_cache_codegen",
|
||||
"tendril",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "markup5ever_rcdom"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f015da43bcd8d4f144559a3423f4591d69b8ce0652c905374da7205df336ae2b"
|
||||
dependencies = [
|
||||
"html5ever",
|
||||
"markup5ever",
|
||||
"tendril",
|
||||
"xml5ever",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "matches"
|
||||
version = "0.1.9"
|
||||
@@ -1044,12 +935,6 @@ dependencies = [
|
||||
"tempfile",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "new_debug_unreachable"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54"
|
||||
|
||||
[[package]]
|
||||
name = "normalize-line-endings"
|
||||
version = "0.3.0"
|
||||
@@ -1087,9 +972,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.12.0"
|
||||
version = "1.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225"
|
||||
checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1"
|
||||
|
||||
[[package]]
|
||||
name = "opaque-debug"
|
||||
@@ -1099,9 +984,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
|
||||
|
||||
[[package]]
|
||||
name = "openssl"
|
||||
version = "0.10.40"
|
||||
version = "0.10.41"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fb81a6430ac911acb25fe5ac8f1d2af1b4ea8a4fdfda0f1ee4292af2e2d8eb0e"
|
||||
checksum = "618febf65336490dfcf20b73f885f5651a0c89c64c2d4a8c3662585a70bf5bd0"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cfg-if",
|
||||
@@ -1131,9 +1016,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
|
||||
|
||||
[[package]]
|
||||
name = "openssl-sys"
|
||||
version = "0.9.74"
|
||||
version = "0.9.75"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "835363342df5fba8354c5b453325b110ffd54044e588c539cf2f20a8014e4cb1"
|
||||
checksum = "e5f9bd0c2710541a3cda73d6f9ac4f1b240de4ae261065d309dbe73d9dceb42f"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"cc",
|
||||
@@ -1144,41 +1029,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "os_str_bytes"
|
||||
version = "6.1.0"
|
||||
version = "6.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21326818e99cfe6ce1e524c2a805c189a99b5ae555a35d19f9a284b427d86afa"
|
||||
|
||||
[[package]]
|
||||
name = "output_vt100"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "628223faebab4e3e40667ee0b2336d34a5b960ff60ea743ddfdbcf7770bcfb66"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
|
||||
dependencies = [
|
||||
"lock_api",
|
||||
"parking_lot_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot_core"
|
||||
version = "0.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"smallvec",
|
||||
"windows-sys",
|
||||
]
|
||||
checksum = "648001efe5d5c0102d8cea768e348da85d90af8ba91f0bea908f157951493cd4"
|
||||
|
||||
[[package]]
|
||||
name = "percent-encoding"
|
||||
@@ -1186,63 +1039,6 @@ version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
|
||||
|
||||
[[package]]
|
||||
name = "phf"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12"
|
||||
dependencies = [
|
||||
"phf_shared 0.8.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "phf_codegen"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cbffee61585b0411840d3ece935cce9cb6321f01c45477d30066498cd5e1a815"
|
||||
dependencies = [
|
||||
"phf_generator 0.8.0",
|
||||
"phf_shared 0.8.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "phf_generator"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526"
|
||||
dependencies = [
|
||||
"phf_shared 0.8.0",
|
||||
"rand 0.7.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "phf_generator"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6"
|
||||
dependencies = [
|
||||
"phf_shared 0.10.0",
|
||||
"rand 0.8.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "phf_shared"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7"
|
||||
dependencies = [
|
||||
"siphasher",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "phf_shared"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096"
|
||||
dependencies = [
|
||||
"siphasher",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.9"
|
||||
@@ -1273,12 +1069,6 @@ version = "0.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872"
|
||||
|
||||
[[package]]
|
||||
name = "precomputed-hash"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
|
||||
|
||||
[[package]]
|
||||
name = "predicates"
|
||||
version = "2.1.1"
|
||||
@@ -1309,23 +1099,11 @@ dependencies = [
|
||||
"termtree",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pretty_assertions"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c89f989ac94207d048d92db058e4f6ec7342b0971fc58d1271ca148b799b3563"
|
||||
dependencies = [
|
||||
"ansi_term",
|
||||
"ctor",
|
||||
"diff",
|
||||
"output_vt100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.40"
|
||||
version = "1.0.42"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7"
|
||||
checksum = "c278e965f1d8cf32d6e0e96de3d3e79712178ae67986d9cf9151f51e95aac89b"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
@@ -1339,20 +1117,6 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
|
||||
dependencies = [
|
||||
"getrandom 0.1.16",
|
||||
"libc",
|
||||
"rand_chacha 0.2.2",
|
||||
"rand_core 0.5.1",
|
||||
"rand_hc",
|
||||
"rand_pcg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.8.5"
|
||||
@@ -1360,18 +1124,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"rand_chacha 0.3.1",
|
||||
"rand_core 0.6.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core 0.5.1",
|
||||
"rand_chacha",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1381,16 +1135,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core 0.6.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
|
||||
dependencies = [
|
||||
"getrandom 0.1.16",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1399,41 +1144,23 @@ version = "0.6.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
|
||||
dependencies = [
|
||||
"getrandom 0.2.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_hc"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
|
||||
dependencies = [
|
||||
"rand_core 0.5.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_pcg"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429"
|
||||
dependencies = [
|
||||
"rand_core 0.5.1",
|
||||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.2.13"
|
||||
version = "0.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42"
|
||||
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.5.6"
|
||||
version = "1.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1"
|
||||
checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
@@ -1448,9 +1175,9 @@ checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.6.26"
|
||||
version = "0.6.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64"
|
||||
checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244"
|
||||
|
||||
[[package]]
|
||||
name = "remove_dir_all"
|
||||
@@ -1599,12 +1326,6 @@ dependencies = [
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
||||
|
||||
[[package]]
|
||||
name = "sct"
|
||||
version = "0.7.0"
|
||||
@@ -1638,17 +1359,6 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "select"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ee061f90afcc8678bef7a78d0d121683f0ba753f740ff7005f833ec445876b7"
|
||||
dependencies = [
|
||||
"bit-set",
|
||||
"html5ever",
|
||||
"markup5ever_rcdom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.12"
|
||||
@@ -1657,18 +1367,18 @@ checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.138"
|
||||
version = "1.0.140"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1578c6245786b9d168c5447eeacfb96856573ca56c9d68fdcf394be134882a47"
|
||||
checksum = "fc855a42c7967b7c369eb5860f7164ef1f6f81c20c7cc1141f2a604e18723b03"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.138"
|
||||
version = "1.0.140"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "023e9b1467aef8a10fb88f25611870ada9800ef7e22afce356bb0d2387b6f27c"
|
||||
checksum = "6f2122636b9fe3b81f1cb25099fcf2d3f542cdb1d45940d56c713158884a05da"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -1731,23 +1441,14 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "siphasher"
|
||||
version = "0.3.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de"
|
||||
|
||||
[[package]]
|
||||
name = "slab"
|
||||
version = "0.4.6"
|
||||
version = "0.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32"
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1"
|
||||
checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
@@ -1765,32 +1466,6 @@ version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
|
||||
|
||||
[[package]]
|
||||
name = "string_cache"
|
||||
version = "0.8.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "213494b7a2b503146286049378ce02b482200519accc31872ee8be91fa820a08"
|
||||
dependencies = [
|
||||
"new_debug_unreachable",
|
||||
"once_cell",
|
||||
"parking_lot",
|
||||
"phf_shared 0.10.0",
|
||||
"precomputed-hash",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "string_cache_codegen"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988"
|
||||
dependencies = [
|
||||
"phf_generator 0.10.0",
|
||||
"phf_shared 0.10.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.98"
|
||||
@@ -1816,17 +1491,6 @@ dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tendril"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d24a120c5fc464a3458240ee02c299ebcb9d67b5249c8848b09d639dca8d7bb0"
|
||||
dependencies = [
|
||||
"futf",
|
||||
"mac",
|
||||
"utf-8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "terminal_size"
|
||||
version = "0.1.17"
|
||||
@@ -1909,10 +1573,11 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.19.2"
|
||||
version = "1.20.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c51a52ed6686dd62c320f9b89299e9dfb46f730c7a48e635c19f21d116cb1439"
|
||||
checksum = "7a8325f63a7d4774dd041e363b2409ed1c5cbbd0f867795e661df066b2b0a581"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"bytes",
|
||||
"libc",
|
||||
"memchr",
|
||||
@@ -1980,9 +1645,9 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52"
|
||||
|
||||
[[package]]
|
||||
name = "tracing"
|
||||
version = "0.1.35"
|
||||
version = "0.1.36"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a400e31aa60b9d44a52a8ee0343b5b18566b03a8321e0d321f695cf56e940160"
|
||||
checksum = "2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"pin-project-lite",
|
||||
@@ -1991,9 +1656,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tracing-core"
|
||||
version = "0.1.28"
|
||||
version = "0.1.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7b7358be39f2f274f322d2aaed611acc57f382e8eb1e5b48cb9ae30933495ce7"
|
||||
checksum = "5aeea4303076558a00714b823f9ad67d58a3bbda1df83d8827d21193156e22f7"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
]
|
||||
@@ -2027,9 +1692,9 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.1"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c"
|
||||
checksum = "15c61ba63f9235225a22310255a29b806b907c9b8c964bcbd0a2c70f3f2deea7"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-normalization"
|
||||
@@ -2064,20 +1729,14 @@ version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "68b90931029ab9b034b300b797048cf23723400aa757e8a2bfb9d748102f9821"
|
||||
|
||||
[[package]]
|
||||
name = "utf-8"
|
||||
version = "0.7.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "1.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd6469f4314d5f1ffec476e05f17cc9a78bc7a27a6a857842170bdf8d6f98d2f"
|
||||
dependencies = [
|
||||
"getrandom 0.2.7",
|
||||
"rand 0.8.5",
|
||||
"getrandom",
|
||||
"rand",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2122,12 +1781,6 @@ dependencies = [
|
||||
"try-lock",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.9.0+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.10.0+wasi-snapshot-preview1"
|
||||
@@ -2142,9 +1795,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.81"
|
||||
version = "0.2.82"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994"
|
||||
checksum = "fc7652e3f6c4706c8d9cd54832c4a4ccb9b5336e2c3bd154d5cccfbf1c1f5f7d"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"wasm-bindgen-macro",
|
||||
@@ -2152,13 +1805,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.81"
|
||||
version = "0.2.82"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a"
|
||||
checksum = "662cd44805586bd52971b9586b1df85cdbbd9112e4ef4d8f41559c334dc6ac3f"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
@@ -2167,9 +1820,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-futures"
|
||||
version = "0.4.31"
|
||||
version = "0.4.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "de9a9cec1733468a8c657e57fa2413d2ae2c0129b95e87c5b72b8ace4d13f31f"
|
||||
checksum = "fa76fb221a1f8acddf5b54ace85912606980ad661ac7a503b4570ffd3a624dad"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
@@ -2179,9 +1832,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.81"
|
||||
version = "0.2.82"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa"
|
||||
checksum = "b260f13d3012071dfb1512849c033b1925038373aea48ced3012c09df952c602"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
@@ -2189,9 +1842,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.81"
|
||||
version = "0.2.82"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048"
|
||||
checksum = "5be8e654bdd9b79216c2929ab90721aa82faf65c48cdf08bdc4e7f51357b80da"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -2202,15 +1855,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.81"
|
||||
version = "0.2.82"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be"
|
||||
checksum = "6598dd0bd3c7d51095ff6531a5b23e02acdc81804e30d8f07afb77b7215a140a"
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.58"
|
||||
version = "0.3.59"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2fed94beee57daf8dd7d51f2b15dc2bcde92d7a72304cdf662a4371008b71b90"
|
||||
checksum = "ed055ab27f941423197eb86b2035720b1a3ce40504df082cac2ecc6ed73335a1"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
@@ -2228,9 +1881,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "webpki-roots"
|
||||
version = "0.22.3"
|
||||
version = "0.22.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44d8de8415c823c8abd270ad483c6feeac771fad964890779f9a8cb24fbbc1bf"
|
||||
checksum = "f1c760f0d366a6c24a02ed7816e23e691f5d92291f94d15e836006fd11b04daf"
|
||||
dependencies = [
|
||||
"webpki",
|
||||
]
|
||||
@@ -2323,15 +1976,3 @@ name = "xml-rs"
|
||||
version = "0.8.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3"
|
||||
|
||||
[[package]]
|
||||
name = "xml5ever"
|
||||
version = "0.16.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9234163818fd8e2418fcde330655e757900d4236acd8cc70fef345ef91f6d865"
|
||||
dependencies = [
|
||||
"log",
|
||||
"mac",
|
||||
"markup5ever",
|
||||
"time",
|
||||
]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "dufs"
|
||||
version = "0.24.0"
|
||||
version = "0.28.0"
|
||||
edition = "2021"
|
||||
authors = ["sigoden <sigoden@gmail.com>"]
|
||||
description = "Dufs is a distinctive utility file server"
|
||||
@@ -12,6 +12,7 @@ keywords = ["static", "file", "server", "webdav", "cli"]
|
||||
|
||||
[dependencies]
|
||||
clap = { version = "3", default-features = false, features = ["std", "wrap_help"] }
|
||||
clap_complete = "3"
|
||||
chrono = "0.4"
|
||||
tokio = { version = "1", features = ["rt-multi-thread", "macros", "fs", "io-util", "signal"]}
|
||||
tokio-util = { version = "0.7", features = ["io-util"] }
|
||||
@@ -46,11 +47,9 @@ tls = ["rustls", "rustls-pemfile", "tokio-rustls"]
|
||||
assert_cmd = "2"
|
||||
reqwest = { version = "0.11", features = ["blocking", "multipart", "rustls-tls"], default-features = false }
|
||||
assert_fs = "1"
|
||||
select = "0.5"
|
||||
port_check = "0.1"
|
||||
rstest = "0.15"
|
||||
regex = "1"
|
||||
pretty_assertions = "1.2"
|
||||
url = "2"
|
||||
diqwest = { version = "1", features = ["blocking"] }
|
||||
predicates = "2"
|
||||
|
||||
57
README.md
57
README.md
@@ -5,7 +5,7 @@
|
||||
|
||||
Dufs is a distinctive utility file server that supports static serving, uploading, searching, accessing control, webdav...
|
||||
|
||||

|
||||

|
||||
|
||||
## Features
|
||||
|
||||
@@ -30,7 +30,7 @@ cargo install dufs
|
||||
### With docker
|
||||
|
||||
```
|
||||
docker run -v `pwd`:/data -p 5000:5000 --rm -it sigoden/dufs /data
|
||||
docker run -v `pwd`:/data -p 5000:5000 --rm -it sigoden/dufs /data -A
|
||||
```
|
||||
|
||||
### Binaries on macOS, Linux, Windows
|
||||
@@ -51,7 +51,7 @@ ARGS:
|
||||
OPTIONS:
|
||||
-b, --bind <addr>... Specify bind address
|
||||
-p, --port <port> Specify port to listen on [default: 5000]
|
||||
--path-prefix <path> Specify an path prefix
|
||||
--path-prefix <path> Specify a path prefix
|
||||
--hidden <value> Hide directories from directory listings, separated by `,`
|
||||
-a, --auth <rule>... Add auth for path
|
||||
--auth-method <value> Select auth method [default: digest] [possible values: basic, digest]
|
||||
@@ -66,6 +66,8 @@ OPTIONS:
|
||||
--render-spa Serve SPA(Single Page Application)
|
||||
--tls-cert <path> Path to an SSL/TLS certificate to serve with HTTPS
|
||||
--tls-key <path> Path to the SSL/TLS certificate's private key
|
||||
--log-format <format> Customize http log format
|
||||
--completions <shell> Print shell completion script for <shell> [possible values: bash, elvish, fish, powershell, zsh]
|
||||
-h, --help Print help information
|
||||
-V, --version Print version information
|
||||
```
|
||||
@@ -78,7 +80,7 @@ Serve current working directory
|
||||
dufs
|
||||
```
|
||||
|
||||
Explicitly allow all operations including download/upload/delete
|
||||
Allow all operations like upload/delete/search...
|
||||
|
||||
```
|
||||
dufs -A
|
||||
@@ -96,24 +98,24 @@ Serve a specific directory
|
||||
dufs Downloads
|
||||
```
|
||||
|
||||
Serve a specific file
|
||||
Serve a single file
|
||||
|
||||
```
|
||||
dufs linux-distro.iso
|
||||
```
|
||||
|
||||
Serve index.html when requesting a directory
|
||||
|
||||
```
|
||||
dufs --render-index
|
||||
```
|
||||
|
||||
Serve single-page application like react
|
||||
Serve a single-page application like react/vue
|
||||
|
||||
```
|
||||
dufs --render-spa
|
||||
```
|
||||
|
||||
Serve a static website with index.html
|
||||
|
||||
```
|
||||
dufs --render-index
|
||||
```
|
||||
|
||||
Require username/password
|
||||
|
||||
```
|
||||
@@ -140,6 +142,12 @@ dufs --tls-cert my.crt --tls-key my.key
|
||||
|
||||
## API
|
||||
|
||||
Upload a file
|
||||
|
||||
```
|
||||
curl -T path-to-file http://127.0.0.1:5000/new-path/path-to-file
|
||||
```
|
||||
|
||||
Download a file
|
||||
```
|
||||
curl http://127.0.0.1:5000/path-to-file
|
||||
@@ -151,16 +159,10 @@ Download a folder as zip file
|
||||
curl -o path-to-folder.zip http://127.0.0.1:5000/path-to-folder?zip
|
||||
```
|
||||
|
||||
Upload a file
|
||||
|
||||
```
|
||||
curl --upload-file path-to-file http://127.0.0.1:5000/path-to-file
|
||||
```
|
||||
|
||||
Delete a file/folder
|
||||
|
||||
```
|
||||
curl -X DELETE http://127.0.0.1:5000/path-to-file
|
||||
curl -X DELETE http://127.0.0.1:5000/path-to-file-or-folder
|
||||
```
|
||||
|
||||
## Access Control
|
||||
@@ -186,6 +188,23 @@ dufs -a /@admin:pass1@* -a /ui@designer:pass2 -A
|
||||
- Account `admin:pass1` can upload/delete/view/download any files/folders.
|
||||
- Account `designer:pass2` can upload/delete/view/download any files/folders in the `ui` folder.
|
||||
|
||||
## Log format
|
||||
|
||||
dufs supports customize http log format via option `--log-format`.
|
||||
|
||||
The default format is `$remote_addr "$request" $status`.
|
||||
|
||||
All variables list below:
|
||||
|
||||
| name | description |
|
||||
| ------------ | ------------------------------------------------------------------------- |
|
||||
| $remote_addr | client address |
|
||||
| $remote_user | user name supplied with authentication |
|
||||
| $request | full original request line |
|
||||
| $status | response status |
|
||||
| $http_ | arbitrary request header field. examples: $http_user_agent, $http_referer |
|
||||
|
||||
> use `dufs --log-format=''` to disable http log
|
||||
## License
|
||||
|
||||
Copyright (c) 2022 dufs-developers.
|
||||
|
||||
@@ -59,6 +59,15 @@ body {
|
||||
height: 1.1rem;
|
||||
}
|
||||
|
||||
.toolbox .control {
|
||||
cursor: pointer;
|
||||
padding-left: 0.25em;
|
||||
}
|
||||
|
||||
.upload-file input {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.searchbar {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
@@ -90,15 +99,6 @@ body {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.upload-control {
|
||||
cursor: pointer;
|
||||
padding-left: 0.25em;
|
||||
}
|
||||
|
||||
.upload-control input {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.upload-status span {
|
||||
width: 70px;
|
||||
display: inline-block;
|
||||
@@ -131,8 +131,12 @@ body {
|
||||
padding-left: 0.6em;
|
||||
}
|
||||
|
||||
.paths-table tr:hover {
|
||||
background-color: #fafafa;
|
||||
}
|
||||
|
||||
.paths-table .cell-actions {
|
||||
width: 60px;
|
||||
width: 75px;
|
||||
display: flex;
|
||||
padding-left: 0.6em;
|
||||
}
|
||||
@@ -175,7 +179,7 @@ body {
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
padding-left: 0.4em;
|
||||
padding-right: 0.3em;
|
||||
}
|
||||
|
||||
.uploaders-table {
|
||||
|
||||
@@ -15,12 +15,18 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16"><path d="M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5z"/><path d="M7.646 11.854a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V1.5a.5.5 0 0 0-1 0v8.793L5.354 8.146a.5.5 0 1 0-.708.708l3 3z"/></svg>
|
||||
</a>
|
||||
</div>
|
||||
<div class="upload-control hidden" title="Upload files">
|
||||
<div class="control upload-file hidden" title="Upload files">
|
||||
<label for="file">
|
||||
<svg width="16" height="16" viewBox="0 0 16 16"><path d="M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5z"/><path d="M7.646 1.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1-.708.708L8.5 2.707V11.5a.5.5 0 0 1-1 0V2.707L5.354 4.854a.5.5 0 1 1-.708-.708l3-3z"/></svg>
|
||||
</label>
|
||||
<input type="file" id="file" name="file" multiple>
|
||||
</div>
|
||||
<div class="control new-folder hidden" title="New folder">
|
||||
<svg width="16" height="16" viewBox="0 0 16 16">
|
||||
<path d="m.5 3 .04.87a1.99 1.99 0 0 0-.342 1.311l.637 7A2 2 0 0 0 2.826 14H9v-1H2.826a1 1 0 0 1-.995-.91l-.637-7A1 1 0 0 1 2.19 4h11.62a1 1 0 0 1 .996 1.09L14.54 8h1.005l.256-2.819A2 2 0 0 0 13.81 3H9.828a2 2 0 0 1-1.414-.586l-.828-.828A2 2 0 0 0 6.172 1H2.5a2 2 0 0 0-2 2zm5.672-1a1 1 0 0 1 .707.293L7.586 3H2.19c-.24 0-.47.042-.683.12L1.5 2.98a1 1 0 0 1 1-.98h3.672z"/>
|
||||
<path d="M13.5 10a.5.5 0 0 1 .5.5V12h1.5a.5.5 0 1 1 0 1H14v1.5a.5.5 0 1 1-1 0V13h-1.5a.5.5 0 0 1 0-1H13v-1.5a.5.5 0 0 1 .5-.5z"/>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
<form class="searchbar hidden">
|
||||
<div class="icon">
|
||||
|
||||
149
assets/index.js
149
assets/index.js
@@ -29,6 +29,10 @@ let $uploadersTable;
|
||||
* @type Element
|
||||
*/
|
||||
let $emptyFolder;
|
||||
/**
|
||||
* @type Element
|
||||
*/
|
||||
let $newFolder;
|
||||
|
||||
class Uploader {
|
||||
/**
|
||||
@@ -49,9 +53,8 @@ class Uploader {
|
||||
}
|
||||
|
||||
upload() {
|
||||
const { file, idx, name } = this;
|
||||
const { idx, name } = this;
|
||||
const url = getUrl(name);
|
||||
const encodedUrl = encodedStr(url);
|
||||
const encodedName = encodedStr(name);
|
||||
$uploadersTable.insertAdjacentHTML("beforeend", `
|
||||
<tr id="upload${idx}" class="uploader">
|
||||
@@ -59,15 +62,22 @@ class Uploader {
|
||||
${getSvg()}
|
||||
</td>
|
||||
<td class="path cell-name">
|
||||
<a href="${encodedUrl}">${encodedName}</a>
|
||||
<a href="${url}">${encodedName}</a>
|
||||
</td>
|
||||
<td class="cell-status upload-status" id="uploadStatus${idx}"></td>
|
||||
</tr>`);
|
||||
$uploadersTable.classList.remove("hidden");
|
||||
$emptyFolder.classList.add("hidden");
|
||||
this.$uploadStatus = document.getElementById(`uploadStatus${idx}`);
|
||||
this.lastUptime = Date.now();
|
||||
this.$uploadStatus.innerHTML = '-';
|
||||
Uploader.queues.push(this);
|
||||
Uploader.runQueue();
|
||||
}
|
||||
|
||||
ajax() {
|
||||
Uploader.runings += 1;
|
||||
const url = getUrl(this.name);
|
||||
this.lastUptime = Date.now();
|
||||
const ajax = new XMLHttpRequest();
|
||||
ajax.upload.addEventListener("progress", e => this.progress(e), false);
|
||||
ajax.addEventListener("readystatechange", () => {
|
||||
@@ -82,13 +92,14 @@ class Uploader {
|
||||
ajax.addEventListener("error", () => this.fail(), false);
|
||||
ajax.addEventListener("abort", () => this.fail(), false);
|
||||
ajax.open("PUT", url);
|
||||
ajax.send(file);
|
||||
ajax.send(this.file);
|
||||
}
|
||||
|
||||
|
||||
progress(event) {
|
||||
let now = Date.now();
|
||||
let speed = (event.loaded - this.uploaded) / (now - this.lastUptime) * 1000;
|
||||
let [speedValue, speedUnit] = formatSize(speed);
|
||||
const now = Date.now();
|
||||
const speed = (event.loaded - this.uploaded) / (now - this.lastUptime) * 1000;
|
||||
const [speedValue, speedUnit] = formatSize(speed);
|
||||
const speedText = `${speedValue}${speedUnit.toLowerCase()}/s`;
|
||||
const progress = formatPercent((event.loaded / event.total) * 100);
|
||||
const duration = formatDuration((event.total - event.loaded) / speed)
|
||||
@@ -99,15 +110,34 @@ class Uploader {
|
||||
|
||||
complete() {
|
||||
this.$uploadStatus.innerHTML = `✓`;
|
||||
Uploader.runings -= 1;
|
||||
Uploader.runQueue();
|
||||
}
|
||||
|
||||
fail() {
|
||||
this.$uploadStatus.innerHTML = `✗`;
|
||||
Uploader.runings -= 1;
|
||||
Uploader.runQueue();
|
||||
}
|
||||
}
|
||||
|
||||
Uploader.globalIdx = 0;
|
||||
|
||||
Uploader.runings = 0;
|
||||
|
||||
/**
|
||||
* @type Uploader[]
|
||||
*/
|
||||
Uploader.queues = [];
|
||||
|
||||
|
||||
Uploader.runQueue = () => {
|
||||
if (Uploader.runings > 2) return;
|
||||
let uploader = Uploader.queues.shift();
|
||||
if (!uploader) return;
|
||||
uploader.ajax();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add breadcrumb
|
||||
* @param {string} href
|
||||
@@ -129,16 +159,15 @@ function addBreadcrumb(href, uri_prefix) {
|
||||
if (!path.endsWith("/")) {
|
||||
path += "/";
|
||||
}
|
||||
path += encodeURI(name);
|
||||
path += encodeURIComponent(name);
|
||||
}
|
||||
const encodedPath = encodedStr(path);
|
||||
const encodedName = encodedStr(name);
|
||||
if (i === 0) {
|
||||
$breadcrumb.insertAdjacentHTML("beforeend", `<a href="${encodedPath}"><svg width="16" height="16" viewBox="0 0 16 16"><path d="M6.5 14.5v-3.505c0-.245.25-.495.5-.495h2c.25 0 .5.25.5.5v3.5a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.146-.354L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293L8.354 1.146a.5.5 0 0 0-.708 0l-6 6A.5.5 0 0 0 1.5 7.5v7a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5z"/></svg></a>`);
|
||||
$breadcrumb.insertAdjacentHTML("beforeend", `<a href="${path}"><svg width="16" height="16" viewBox="0 0 16 16"><path d="M6.5 14.5v-3.505c0-.245.25-.495.5-.495h2c.25 0 .5.25.5.5v3.5a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.146-.354L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293L8.354 1.146a.5.5 0 0 0-.708 0l-6 6A.5.5 0 0 0 1.5 7.5v7a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5z"/></svg></a>`);
|
||||
} else if (i === len - 1) {
|
||||
$breadcrumb.insertAdjacentHTML("beforeend", `<b>${encodedName}</b>`);
|
||||
} else {
|
||||
$breadcrumb.insertAdjacentHTML("beforeend", `<a href="${encodedPath}">${encodedName}</a>`);
|
||||
$breadcrumb.insertAdjacentHTML("beforeend", `<a href="${path}">${encodedName}</a>`);
|
||||
}
|
||||
if (i !== len - 1) {
|
||||
$breadcrumb.insertAdjacentHTML("beforeend", `<span class="separator">/</span>`);
|
||||
@@ -154,35 +183,41 @@ function addBreadcrumb(href, uri_prefix) {
|
||||
function addPath(file, index) {
|
||||
const encodedName = encodedStr(file.name);
|
||||
let url = getUrl(file.name)
|
||||
let encodedUrl = encodedStr(url);
|
||||
let actionDelete = "";
|
||||
let actionDownload = "";
|
||||
let actionMove = "";
|
||||
if (file.path_type.endsWith("Dir")) {
|
||||
url += "/";
|
||||
encodedUrl += "/";
|
||||
actionDownload = `
|
||||
<div class="action-btn">
|
||||
<a href="${encodedUrl}?zip" title="Download folder as a .zip file">
|
||||
<a href="${url}?zip" title="Download folder as a .zip file">
|
||||
<svg width="16" height="16" viewBox="0 0 16 16"><path d="M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5z"/><path d="M7.646 11.854a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V1.5a.5.5 0 0 0-1 0v8.793L5.354 8.146a.5.5 0 1 0-.708.708l3 3z"/></svg>
|
||||
</a>
|
||||
</div>`;
|
||||
} else {
|
||||
actionDownload = `
|
||||
<div class="action-btn" >
|
||||
<a href="${encodedUrl}" title="Download file" download>
|
||||
<a href="${url}" title="Download file" download>
|
||||
<svg width="16" height="16" viewBox="0 0 16 16"><path d="M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5z"/><path d="M7.646 11.854a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V1.5a.5.5 0 0 0-1 0v8.793L5.354 8.146a.5.5 0 1 0-.708.708l3 3z"/></svg>
|
||||
</a>
|
||||
</div>`;
|
||||
}
|
||||
if (DATA.allow_delete) {
|
||||
if (DATA.allow_upload) {
|
||||
actionMove = `
|
||||
<div onclick="movePath(${index})" class="action-btn" id="moveBtn${index}" title="Move to new path">
|
||||
<svg width="16" height="16" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M1.5 1.5A.5.5 0 0 0 1 2v4.8a2.5 2.5 0 0 0 2.5 2.5h9.793l-3.347 3.346a.5.5 0 0 0 .708.708l4.2-4.2a.5.5 0 0 0 0-.708l-4-4a.5.5 0 0 0-.708.708L13.293 8.3H3.5A1.5 1.5 0 0 1 2 6.8V2a.5.5 0 0 0-.5-.5z"/></svg>
|
||||
</div>`;
|
||||
}
|
||||
actionDelete = `
|
||||
<div onclick="deletePath(${index})" class="action-btn" id="deleteBtn${index}" title="Delete ${encodedName}">
|
||||
<div onclick="deletePath(${index})" class="action-btn" id="deleteBtn${index}" title="Delete">
|
||||
<svg width="16" height="16" fill="currentColor"viewBox="0 0 16 16"><path d="M6.854 7.146a.5.5 0 1 0-.708.708L7.293 9l-1.147 1.146a.5.5 0 0 0 .708.708L8 9.707l1.146 1.147a.5.5 0 0 0 .708-.708L8.707 9l1.147-1.146a.5.5 0 0 0-.708-.708L8 8.293 6.854 7.146z"/><path d="M14 14V4.5L9.5 0H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2zM9.5 3A1.5 1.5 0 0 0 11 4.5h2V14a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h5.5v2z"/></svg>
|
||||
</div>`;
|
||||
}
|
||||
let actionCell = `
|
||||
<td class="cell-actions">
|
||||
${actionDownload}
|
||||
${actionMove}
|
||||
${actionDelete}
|
||||
</td>`
|
||||
|
||||
@@ -192,7 +227,7 @@ function addPath(file, index) {
|
||||
${getSvg(file.path_type)}
|
||||
</td>
|
||||
<td class="path cell-name">
|
||||
<a href="${encodedUrl}">${encodedName}</a>
|
||||
<a href="${url}">${encodedName}</a>
|
||||
</td>
|
||||
<td class="cell-mtime">${formatMtime(file.mtime)}</td>
|
||||
<td class="cell-size">${formatSize(file.size).join(" ")}</td>
|
||||
@@ -201,7 +236,7 @@ function addPath(file, index) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete pathitem
|
||||
* Delete path
|
||||
* @param {number} index
|
||||
* @returns
|
||||
*/
|
||||
@@ -231,6 +266,46 @@ async function deletePath(index) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Move path
|
||||
* @param {number} index
|
||||
* @returns
|
||||
*/
|
||||
async function movePath(index) {
|
||||
const file = DATA.paths[index];
|
||||
if (!file) return;
|
||||
|
||||
const fileUrl = getUrl(file.name);
|
||||
const fileUrlObj = new URL(fileUrl)
|
||||
|
||||
const prefix = DATA.uri_prefix.slice(0, -1);
|
||||
|
||||
const filePath = decodeURIComponent(fileUrlObj.pathname.slice(prefix.length));
|
||||
|
||||
let newPath = prompt("Enter new path", filePath)
|
||||
if (!newPath) return;
|
||||
if (!newPath.startsWith("/")) newPath = "/" + newPath;
|
||||
if (filePath === newPath) return;
|
||||
const newFileUrl = fileUrlObj.origin + prefix + newPath.split("/").map(encodeURIComponent).join("/");
|
||||
|
||||
try {
|
||||
const res = await fetch(fileUrl, {
|
||||
method: "MOVE",
|
||||
headers: {
|
||||
"Destination": newFileUrl,
|
||||
}
|
||||
});
|
||||
if (res.status >= 200 && res.status < 300) {
|
||||
location.href = newFileUrl.split("/").slice(0, -1).join("/")
|
||||
} else {
|
||||
throw new Error(await res.text())
|
||||
}
|
||||
} catch (err) {
|
||||
alert(`Cannot move \`${filePath}\` to \`${newPath}\`, ${err.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
function dropzone() {
|
||||
["drag", "dragstart", "dragend", "dragover", "dragenter", "dragleave", "drop"].forEach(name => {
|
||||
document.addEventListener(name, e => {
|
||||
@@ -255,6 +330,24 @@ function dropzone() {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a folder
|
||||
* @param {string} name
|
||||
*/
|
||||
async function createFolder(name) {
|
||||
const url = getUrl(name);
|
||||
try {
|
||||
const res = await fetch(url, {
|
||||
method: "MKCOL",
|
||||
});
|
||||
if (res.status >= 200 && res.status < 300) {
|
||||
location.href = url;
|
||||
}
|
||||
} catch (err) {
|
||||
alert(`Cannot create folder \`${name}\`, ${err.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
async function addFileEntries(entries, dirs) {
|
||||
for (const entry of entries) {
|
||||
if (entry.isFile) {
|
||||
@@ -272,7 +365,7 @@ async function addFileEntries(entries, dirs) {
|
||||
function getUrl(name) {
|
||||
let url = location.href.split('?')[0];
|
||||
if (!url.endsWith("/")) url += "/";
|
||||
url += encodeURI(name);
|
||||
url += name.split("/").map(encodeURIComponent).join("/");
|
||||
return url;
|
||||
}
|
||||
|
||||
@@ -314,9 +407,9 @@ function formatSize(size) {
|
||||
|
||||
function formatDuration(seconds) {
|
||||
seconds = Math.ceil(seconds);
|
||||
let h = Math.floor(seconds / 3600);
|
||||
let m = Math.floor((seconds - h * 3600) / 60);
|
||||
let s = seconds - h * 3600 - m * 60
|
||||
const h = Math.floor(seconds / 3600);
|
||||
const m = Math.floor((seconds - h * 3600) / 60);
|
||||
const s = seconds - h * 3600 - m * 60
|
||||
return `${padZero(h, 2)}:${padZero(m, 2)}:${padZero(s, 2)}`;
|
||||
}
|
||||
|
||||
@@ -340,6 +433,7 @@ function ready() {
|
||||
$pathsTableBody = document.querySelector(".paths-table tbody");
|
||||
$uploadersTable = document.querySelector(".uploaders-table");
|
||||
$emptyFolder = document.querySelector(".empty-folder");
|
||||
$newFolder = document.querySelector(".new-folder");
|
||||
|
||||
if (DATA.allow_search) {
|
||||
document.querySelector(".searchbar").classList.remove("hidden");
|
||||
@@ -365,7 +459,14 @@ function ready() {
|
||||
}
|
||||
if (DATA.allow_upload) {
|
||||
dropzone();
|
||||
document.querySelector(".upload-control").classList.remove("hidden");
|
||||
if (DATA.allow_delete) {
|
||||
$newFolder.classList.remove("hidden");
|
||||
$newFolder.addEventListener("click", () => {
|
||||
const name = prompt("Enter name of new folder");
|
||||
if (name) createFolder(name);
|
||||
});
|
||||
}
|
||||
document.querySelector(".upload-file").classList.remove("hidden");
|
||||
document.getElementById("file").addEventListener("change", e => {
|
||||
const files = e.target.files;
|
||||
for (let file of files) {
|
||||
|
||||
41
src/args.rs
41
src/args.rs
@@ -1,4 +1,5 @@
|
||||
use clap::{AppSettings, Arg, ArgMatches, Command};
|
||||
use clap::{value_parser, AppSettings, Arg, ArgMatches, Command};
|
||||
use clap_complete::{generate, Generator, Shell};
|
||||
#[cfg(feature = "tls")]
|
||||
use rustls::{Certificate, PrivateKey};
|
||||
use std::env;
|
||||
@@ -7,11 +8,13 @@ use std::path::{Path, PathBuf};
|
||||
|
||||
use crate::auth::AccessControl;
|
||||
use crate::auth::AuthMethod;
|
||||
use crate::log_http::{LogHttp, DEFAULT_LOG_FORMAT};
|
||||
#[cfg(feature = "tls")]
|
||||
use crate::tls::{load_certs, load_private_key};
|
||||
use crate::utils::encode_uri;
|
||||
use crate::BoxResult;
|
||||
|
||||
fn app() -> Command<'static> {
|
||||
pub fn build_cli() -> Command<'static> {
|
||||
let app = Command::new(env!("CARGO_CRATE_NAME"))
|
||||
.version(env!("CARGO_PKG_VERSION"))
|
||||
.author(env!("CARGO_PKG_AUTHORS"))
|
||||
@@ -48,7 +51,7 @@ fn app() -> Command<'static> {
|
||||
Arg::new("path-prefix")
|
||||
.long("path-prefix")
|
||||
.value_name("path")
|
||||
.help("Specify an path prefix"),
|
||||
.help("Specify a path prefix"),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("hidden")
|
||||
@@ -135,11 +138,23 @@ fn app() -> Command<'static> {
|
||||
.help("Path to the SSL/TLS certificate's private key"),
|
||||
);
|
||||
|
||||
app
|
||||
app.arg(
|
||||
Arg::new("log-format")
|
||||
.long("log-format")
|
||||
.value_name("format")
|
||||
.help("Customize http log format"),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("completions")
|
||||
.long("completions")
|
||||
.value_name("shell")
|
||||
.value_parser(value_parser!(Shell))
|
||||
.help("Print shell completion script for <shell>"),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn matches() -> ArgMatches {
|
||||
app().get_matches()
|
||||
pub fn print_completions<G: Generator>(gen: G, cmd: &mut Command) {
|
||||
generate(gen, cmd, cmd.get_name().to_string(), &mut std::io::stdout());
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@@ -150,7 +165,7 @@ pub struct Args {
|
||||
pub path_is_file: bool,
|
||||
pub path_prefix: String,
|
||||
pub uri_prefix: String,
|
||||
pub hidden: String,
|
||||
pub hidden: Vec<String>,
|
||||
pub auth_method: AuthMethod,
|
||||
pub auth: AccessControl,
|
||||
pub allow_upload: bool,
|
||||
@@ -161,6 +176,7 @@ pub struct Args {
|
||||
pub render_spa: bool,
|
||||
pub render_try_index: bool,
|
||||
pub enable_cors: bool,
|
||||
pub log_http: LogHttp,
|
||||
#[cfg(feature = "tls")]
|
||||
pub tls: Option<(Vec<Certificate>, PrivateKey)>,
|
||||
#[cfg(not(feature = "tls"))]
|
||||
@@ -188,11 +204,11 @@ impl Args {
|
||||
let uri_prefix = if path_prefix.is_empty() {
|
||||
"/".to_owned()
|
||||
} else {
|
||||
format!("/{}/", &path_prefix)
|
||||
format!("/{}/", &encode_uri(&path_prefix))
|
||||
};
|
||||
let hidden: String = matches
|
||||
let hidden: Vec<String> = matches
|
||||
.value_of("hidden")
|
||||
.map(|v| format!(",{},", v))
|
||||
.map(|v| v.split(',').map(|x| x.to_string()).collect())
|
||||
.unwrap_or_default();
|
||||
let enable_cors = matches.is_present("enable-cors");
|
||||
let auth: Vec<&str> = matches
|
||||
@@ -222,6 +238,10 @@ impl Args {
|
||||
};
|
||||
#[cfg(not(feature = "tls"))]
|
||||
let tls = None;
|
||||
let log_http: LogHttp = matches
|
||||
.value_of("log-format")
|
||||
.unwrap_or(DEFAULT_LOG_FORMAT)
|
||||
.parse()?;
|
||||
|
||||
Ok(Args {
|
||||
addrs,
|
||||
@@ -242,6 +262,7 @@ impl Args {
|
||||
render_try_index,
|
||||
render_spa,
|
||||
tls,
|
||||
log_http,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
45
src/auth.rs
45
src/auth.rs
@@ -12,6 +12,7 @@ use crate::utils::encode_uri;
|
||||
use crate::BoxResult;
|
||||
|
||||
const REALM: &str = "DUFS";
|
||||
const DIGEST_AUTH_TIMEOUT: u32 = 86400;
|
||||
|
||||
lazy_static! {
|
||||
static ref NONCESTARTHASH: Context = {
|
||||
@@ -197,6 +198,24 @@ impl AuthMethod {
|
||||
}
|
||||
}
|
||||
}
|
||||
pub fn get_user(&self, authorization: &HeaderValue) -> Option<String> {
|
||||
match self {
|
||||
AuthMethod::Basic => {
|
||||
let value: Vec<u8> =
|
||||
base64::decode(strip_prefix(authorization.as_bytes(), b"Basic ")?).ok()?;
|
||||
let parts: Vec<&str> = std::str::from_utf8(&value).ok()?.split(':').collect();
|
||||
Some(parts[0].to_string())
|
||||
}
|
||||
AuthMethod::Digest => {
|
||||
let digest_value = strip_prefix(authorization.as_bytes(), b"Digest ")?;
|
||||
let digest_vals = to_headermap(digest_value).ok()?;
|
||||
digest_vals
|
||||
.get(b"username".as_ref())
|
||||
.and_then(|b| std::str::from_utf8(*b).ok())
|
||||
.map(|v| v.to_string())
|
||||
}
|
||||
}
|
||||
}
|
||||
pub fn validate(
|
||||
&self,
|
||||
authorization: &HeaderValue,
|
||||
@@ -206,10 +225,9 @@ impl AuthMethod {
|
||||
) -> Option<()> {
|
||||
match self {
|
||||
AuthMethod::Basic => {
|
||||
let value: Vec<u8> =
|
||||
base64::decode(strip_prefix(authorization.as_bytes(), b"Basic ").unwrap())
|
||||
.unwrap();
|
||||
let parts: Vec<&str> = std::str::from_utf8(&value).unwrap().split(':').collect();
|
||||
let basic_value: Vec<u8> =
|
||||
base64::decode(strip_prefix(authorization.as_bytes(), b"Basic ")?).ok()?;
|
||||
let parts: Vec<&str> = std::str::from_utf8(&basic_value).ok()?.split(':').collect();
|
||||
|
||||
if parts[0] != auth_user {
|
||||
return None;
|
||||
@@ -228,13 +246,13 @@ impl AuthMethod {
|
||||
}
|
||||
AuthMethod::Digest => {
|
||||
let digest_value = strip_prefix(authorization.as_bytes(), b"Digest ")?;
|
||||
let user_vals = to_headermap(digest_value).ok()?;
|
||||
let digest_vals = to_headermap(digest_value).ok()?;
|
||||
if let (Some(username), Some(nonce), Some(user_response)) = (
|
||||
user_vals
|
||||
digest_vals
|
||||
.get(b"username".as_ref())
|
||||
.and_then(|b| std::str::from_utf8(*b).ok()),
|
||||
user_vals.get(b"nonce".as_ref()),
|
||||
user_vals.get(b"response".as_ref()),
|
||||
digest_vals.get(b"nonce".as_ref()),
|
||||
digest_vals.get(b"response".as_ref()),
|
||||
) {
|
||||
match validate_nonce(nonce) {
|
||||
Ok(true) => {}
|
||||
@@ -246,12 +264,12 @@ impl AuthMethod {
|
||||
let mut ha = Context::new();
|
||||
ha.consume(method);
|
||||
ha.consume(b":");
|
||||
if let Some(uri) = user_vals.get(b"uri".as_ref()) {
|
||||
if let Some(uri) = digest_vals.get(b"uri".as_ref()) {
|
||||
ha.consume(uri);
|
||||
}
|
||||
let ha = format!("{:x}", ha.compute());
|
||||
let mut correct_response = None;
|
||||
if let Some(qop) = user_vals.get(b"qop".as_ref()) {
|
||||
if let Some(qop) = digest_vals.get(b"qop".as_ref()) {
|
||||
if qop == &b"auth".as_ref() || qop == &b"auth-int".as_ref() {
|
||||
correct_response = Some({
|
||||
let mut c = Context::new();
|
||||
@@ -259,11 +277,11 @@ impl AuthMethod {
|
||||
c.consume(b":");
|
||||
c.consume(nonce);
|
||||
c.consume(b":");
|
||||
if let Some(nc) = user_vals.get(b"nc".as_ref()) {
|
||||
if let Some(nc) = digest_vals.get(b"nc".as_ref()) {
|
||||
c.consume(nc);
|
||||
}
|
||||
c.consume(b":");
|
||||
if let Some(cnonce) = user_vals.get(b"cnonce".as_ref()) {
|
||||
if let Some(cnonce) = digest_vals.get(b"cnonce".as_ref()) {
|
||||
c.consume(cnonce);
|
||||
}
|
||||
c.consume(b":");
|
||||
@@ -317,8 +335,7 @@ fn validate_nonce(nonce: &[u8]) -> Result<bool, ()> {
|
||||
h.consume(secs_nonce.to_be_bytes());
|
||||
let h = format!("{:x}", h.compute());
|
||||
if h[..26] == n[8..34] {
|
||||
return Ok(dur < 300); // from the last 5min
|
||||
//Authentication-Info ?
|
||||
return Ok(dur < DIGEST_AUTH_TIMEOUT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
99
src/log_http.rs
Normal file
99
src/log_http.rs
Normal file
@@ -0,0 +1,99 @@
|
||||
use std::{collections::HashMap, str::FromStr, sync::Arc};
|
||||
|
||||
use crate::{args::Args, server::Request};
|
||||
|
||||
pub const DEFAULT_LOG_FORMAT: &str = r#"$remote_addr "$request" $status"#;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct LogHttp {
|
||||
elems: Vec<LogElement>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
enum LogElement {
|
||||
Variable(String),
|
||||
Header(String),
|
||||
Literal(String),
|
||||
}
|
||||
|
||||
impl LogHttp {
|
||||
pub fn data(&self, req: &Request, args: &Arc<Args>) -> HashMap<String, String> {
|
||||
let mut data = HashMap::default();
|
||||
for elem in self.elems.iter() {
|
||||
match elem {
|
||||
LogElement::Variable(name) => match name.as_str() {
|
||||
"request" => {
|
||||
data.insert(name.to_string(), format!("{} {}", req.method(), req.uri()));
|
||||
}
|
||||
"remote_user" => {
|
||||
if let Some(user) = req
|
||||
.headers()
|
||||
.get("authorization")
|
||||
.and_then(|v| args.auth_method.get_user(v))
|
||||
{
|
||||
data.insert(name.to_string(), user);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
LogElement::Header(name) => {
|
||||
if let Some(value) = req.headers().get(name).and_then(|v| v.to_str().ok()) {
|
||||
data.insert(name.to_string(), value.to_string());
|
||||
}
|
||||
}
|
||||
LogElement::Literal(_) => {}
|
||||
}
|
||||
}
|
||||
data
|
||||
}
|
||||
pub fn log(&self, data: &HashMap<String, String>, err: Option<String>) {
|
||||
if self.elems.is_empty() {
|
||||
return;
|
||||
}
|
||||
let mut output = String::new();
|
||||
for elem in self.elems.iter() {
|
||||
match elem {
|
||||
LogElement::Literal(value) => output.push_str(value.as_str()),
|
||||
LogElement::Header(name) | LogElement::Variable(name) => {
|
||||
output.push_str(data.get(name).map(|v| v.as_str()).unwrap_or("-"))
|
||||
}
|
||||
}
|
||||
}
|
||||
match err {
|
||||
Some(err) => error!("{} {}", output, err),
|
||||
None => info!("{}", output),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for LogHttp {
|
||||
type Err = Box<dyn std::error::Error>;
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
let mut elems = vec![];
|
||||
let mut is_var = false;
|
||||
let mut cache = String::new();
|
||||
for c in format!("{} ", s).chars() {
|
||||
if c == '$' {
|
||||
if !cache.is_empty() {
|
||||
elems.push(LogElement::Literal(cache.to_string()));
|
||||
}
|
||||
cache.clear();
|
||||
is_var = true;
|
||||
} else if is_var && !(c.is_alphanumeric() || c == '_') {
|
||||
if let Some(value) = cache.strip_prefix("$http_") {
|
||||
elems.push(LogElement::Header(value.replace('_', "-").to_string()));
|
||||
} else if let Some(value) = cache.strip_prefix('$') {
|
||||
elems.push(LogElement::Variable(value.to_string()));
|
||||
}
|
||||
cache.clear();
|
||||
is_var = false;
|
||||
}
|
||||
cache.push(c);
|
||||
}
|
||||
let cache = cache.trim();
|
||||
if !cache.is_empty() {
|
||||
elems.push(LogElement::Literal(cache.to_string()));
|
||||
}
|
||||
Ok(Self { elems })
|
||||
}
|
||||
}
|
||||
13
src/main.rs
13
src/main.rs
@@ -1,5 +1,6 @@
|
||||
mod args;
|
||||
mod auth;
|
||||
mod log_http;
|
||||
mod logger;
|
||||
mod server;
|
||||
mod streamer;
|
||||
@@ -10,7 +11,7 @@ mod utils;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
|
||||
use crate::args::{matches, Args};
|
||||
use crate::args::{build_cli, print_completions, Args};
|
||||
use crate::server::{Request, Server};
|
||||
#[cfg(feature = "tls")]
|
||||
use crate::tls::{TlsAcceptor, TlsStream};
|
||||
@@ -19,6 +20,7 @@ use std::net::{IpAddr, SocketAddr, TcpListener as StdTcpListener};
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::Arc;
|
||||
|
||||
use clap_complete::Shell;
|
||||
use futures::future::join_all;
|
||||
use tokio::net::TcpListener;
|
||||
use tokio::task::JoinHandle;
|
||||
@@ -37,7 +39,14 @@ async fn main() {
|
||||
|
||||
async fn run() -> BoxResult<()> {
|
||||
logger::init().map_err(|e| format!("Failed to init logger, {}", e))?;
|
||||
let args = Args::parse(matches())?;
|
||||
let cmd = build_cli();
|
||||
let matches = cmd.get_matches();
|
||||
if let Some(generator) = matches.get_one::<Shell>("completions") {
|
||||
let mut cmd = build_cli();
|
||||
print_completions(*generator, &mut cmd);
|
||||
return Ok(());
|
||||
}
|
||||
let args = Args::parse(matches)?;
|
||||
let args = Arc::new(args);
|
||||
let running = Arc::new(AtomicBool::new(true));
|
||||
let handles = serve(args.clone(), running.clone())?;
|
||||
|
||||
142
src/server.rs
142
src/server.rs
@@ -1,5 +1,5 @@
|
||||
use crate::streamer::Streamer;
|
||||
use crate::utils::{decode_uri, encode_uri, get_file_name, try_get_file_name};
|
||||
use crate::utils::{decode_uri, encode_uri, get_file_name, glob, try_get_file_name};
|
||||
use crate::{Args, BoxResult};
|
||||
use walkdir::WalkDir;
|
||||
use xml::escape::escape_str_pcdata;
|
||||
@@ -9,13 +9,13 @@ use async_zip::Compression;
|
||||
use chrono::{TimeZone, Utc};
|
||||
use futures::TryStreamExt;
|
||||
use headers::{
|
||||
AcceptRanges, AccessControlAllowCredentials, AccessControlAllowHeaders,
|
||||
AccessControlAllowOrigin, Connection, ContentLength, ContentType, ETag, HeaderMap,
|
||||
HeaderMapExt, IfModifiedSince, IfNoneMatch, IfRange, LastModified, Range,
|
||||
AcceptRanges, AccessControlAllowCredentials, AccessControlAllowOrigin, Connection,
|
||||
ContentLength, ContentType, ETag, HeaderMap, HeaderMapExt, IfModifiedSince, IfNoneMatch,
|
||||
IfRange, LastModified, Range,
|
||||
};
|
||||
use hyper::header::{
|
||||
HeaderValue, ACCEPT, AUTHORIZATION, CONTENT_DISPOSITION, CONTENT_LENGTH, CONTENT_RANGE,
|
||||
CONTENT_TYPE, ORIGIN, RANGE, WWW_AUTHENTICATE,
|
||||
HeaderValue, AUTHORIZATION, CONTENT_DISPOSITION, CONTENT_LENGTH, CONTENT_RANGE, CONTENT_TYPE,
|
||||
RANGE, WWW_AUTHENTICATE,
|
||||
};
|
||||
use hyper::{Body, Method, StatusCode, Uri};
|
||||
use serde::Serialize;
|
||||
@@ -45,15 +45,30 @@ const BUF_SIZE: usize = 65536;
|
||||
pub struct Server {
|
||||
args: Arc<Args>,
|
||||
assets_prefix: String,
|
||||
single_file_req_paths: Vec<String>,
|
||||
running: Arc<AtomicBool>,
|
||||
}
|
||||
|
||||
impl Server {
|
||||
pub fn new(args: Arc<Args>, running: Arc<AtomicBool>) -> Self {
|
||||
let assets_prefix = format!("{}__dufs_v{}_", args.uri_prefix, env!("CARGO_PKG_VERSION"));
|
||||
let single_file_req_paths = if args.path_is_file {
|
||||
vec![
|
||||
args.uri_prefix.to_string(),
|
||||
args.uri_prefix[0..args.uri_prefix.len() - 1].to_string(),
|
||||
encode_uri(&format!(
|
||||
"{}{}",
|
||||
&args.uri_prefix,
|
||||
get_file_name(&args.path)
|
||||
)),
|
||||
]
|
||||
} else {
|
||||
vec![]
|
||||
};
|
||||
Self {
|
||||
args,
|
||||
running,
|
||||
single_file_req_paths,
|
||||
assets_prefix,
|
||||
}
|
||||
}
|
||||
@@ -63,16 +78,17 @@ impl Server {
|
||||
req: Request,
|
||||
addr: SocketAddr,
|
||||
) -> Result<Response, hyper::Error> {
|
||||
let method = req.method().clone();
|
||||
let uri = req.uri().clone();
|
||||
let assets_prefix = self.assets_prefix.clone();
|
||||
let enable_cors = self.args.enable_cors;
|
||||
let mut http_log_data = self.args.log_http.data(&req, &self.args);
|
||||
http_log_data.insert("remote_addr".to_string(), addr.ip().to_string());
|
||||
|
||||
let mut res = match self.handle(req).await {
|
||||
let mut res = match self.clone().handle(req).await {
|
||||
Ok(res) => {
|
||||
let status = res.status().as_u16();
|
||||
http_log_data.insert("status".to_string(), res.status().as_u16().to_string());
|
||||
if !uri.path().starts_with(&assets_prefix) {
|
||||
info!(r#"{} "{} {}" - {}"#, addr.ip(), method, uri, status,);
|
||||
self.args.log_http.log(&http_log_data, None);
|
||||
}
|
||||
res
|
||||
}
|
||||
@@ -80,8 +96,10 @@ impl Server {
|
||||
let mut res = Response::default();
|
||||
let status = StatusCode::INTERNAL_SERVER_ERROR;
|
||||
*res.status_mut() = status;
|
||||
let status = status.as_u16();
|
||||
error!(r#"{} "{} {}" - {} {}"#, addr.ip(), method, uri, status, err);
|
||||
http_log_data.insert("status".to_string(), status.as_u16().to_string());
|
||||
self.args
|
||||
.log_http
|
||||
.log(&http_log_data, Some(err.to_string()));
|
||||
res
|
||||
}
|
||||
};
|
||||
@@ -118,8 +136,16 @@ impl Server {
|
||||
let head_only = method == Method::HEAD;
|
||||
|
||||
if self.args.path_is_file {
|
||||
if self
|
||||
.single_file_req_paths
|
||||
.iter()
|
||||
.any(|v| v.as_str() == req_path)
|
||||
{
|
||||
self.handle_send_file(&self.args.path, headers, head_only, &mut res)
|
||||
.await?;
|
||||
} else {
|
||||
status_not_found(&mut res);
|
||||
}
|
||||
return Ok(res);
|
||||
}
|
||||
|
||||
@@ -239,7 +265,7 @@ impl Server {
|
||||
} else if is_miss {
|
||||
status_not_found(&mut res);
|
||||
} else {
|
||||
self.handle_copy(path, headers, &mut res).await?
|
||||
self.handle_copy(path, &req, &mut res).await?
|
||||
}
|
||||
}
|
||||
"MOVE" => {
|
||||
@@ -248,7 +274,7 @@ impl Server {
|
||||
} else if is_miss {
|
||||
status_not_found(&mut res);
|
||||
} else {
|
||||
self.handle_move(path, headers, &mut res).await?
|
||||
self.handle_move(path, &req, &mut res).await?
|
||||
}
|
||||
}
|
||||
"LOCK" => {
|
||||
@@ -343,7 +369,8 @@ impl Server {
|
||||
) -> BoxResult<()> {
|
||||
let mut paths: Vec<PathItem> = vec![];
|
||||
let path_buf = path.to_path_buf();
|
||||
let hidden = self.args.hidden.to_string();
|
||||
let hidden = Arc::new(self.args.hidden.to_vec());
|
||||
let hidden = hidden.clone();
|
||||
let running = self.running.clone();
|
||||
let search = search.to_lowercase();
|
||||
let search_paths = tokio::task::spawn_blocking(move || {
|
||||
@@ -643,16 +670,10 @@ impl Server {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn handle_copy(
|
||||
&self,
|
||||
path: &Path,
|
||||
headers: &HeaderMap<HeaderValue>,
|
||||
res: &mut Response,
|
||||
) -> BoxResult<()> {
|
||||
let dest = match self.extract_dest(headers) {
|
||||
async fn handle_copy(&self, path: &Path, req: &Request, res: &mut Response) -> BoxResult<()> {
|
||||
let dest = match self.extract_dest(req, res) {
|
||||
Some(dest) => dest,
|
||||
None => {
|
||||
*res.status_mut() = StatusCode::BAD_REQUEST;
|
||||
return Ok(());
|
||||
}
|
||||
};
|
||||
@@ -671,16 +692,10 @@ impl Server {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn handle_move(
|
||||
&self,
|
||||
path: &Path,
|
||||
headers: &HeaderMap<HeaderValue>,
|
||||
res: &mut Response,
|
||||
) -> BoxResult<()> {
|
||||
let dest = match self.extract_dest(headers) {
|
||||
async fn handle_move(&self, path: &Path, req: &Request, res: &mut Response) -> BoxResult<()> {
|
||||
let dest = match self.extract_dest(req, res) {
|
||||
Some(dest) => dest,
|
||||
None => {
|
||||
*res.status_mut() = StatusCode::BAD_REQUEST;
|
||||
return Ok(());
|
||||
}
|
||||
};
|
||||
@@ -799,10 +814,43 @@ DATA = {}
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
fn extract_dest(&self, headers: &HeaderMap<HeaderValue>) -> Option<PathBuf> {
|
||||
fn extract_dest(&self, req: &Request, res: &mut Response) -> Option<PathBuf> {
|
||||
let headers = req.headers();
|
||||
let dest_path = match self.extract_destination_header(headers) {
|
||||
Some(dest) => dest,
|
||||
None => {
|
||||
*res.status_mut() = StatusCode::BAD_REQUEST;
|
||||
return None;
|
||||
}
|
||||
};
|
||||
let authorization = headers.get(AUTHORIZATION);
|
||||
let guard_type = self.args.auth.guard(
|
||||
&dest_path,
|
||||
req.method(),
|
||||
authorization,
|
||||
self.args.auth_method.clone(),
|
||||
);
|
||||
if guard_type.is_reject() {
|
||||
*res.status_mut() = StatusCode::FORBIDDEN;
|
||||
*res.body_mut() = Body::from("Forbidden");
|
||||
return None;
|
||||
}
|
||||
|
||||
let dest = match self.extract_path(&dest_path) {
|
||||
Some(dest) => dest,
|
||||
None => {
|
||||
*res.status_mut() = StatusCode::BAD_REQUEST;
|
||||
return None;
|
||||
}
|
||||
};
|
||||
|
||||
Some(dest)
|
||||
}
|
||||
|
||||
fn extract_destination_header(&self, headers: &HeaderMap<HeaderValue>) -> Option<String> {
|
||||
let dest = headers.get("Destination")?.to_str().ok()?;
|
||||
let uri: Uri = dest.parse().ok()?;
|
||||
self.extract_path(uri.path())
|
||||
Some(uri.path().to_string())
|
||||
}
|
||||
|
||||
fn extract_path(&self, path: &str) -> Option<PathBuf> {
|
||||
@@ -987,11 +1035,19 @@ fn add_cors(res: &mut Response) {
|
||||
.typed_insert(AccessControlAllowOrigin::ANY);
|
||||
res.headers_mut()
|
||||
.typed_insert(AccessControlAllowCredentials);
|
||||
|
||||
res.headers_mut().typed_insert(
|
||||
vec![RANGE, CONTENT_TYPE, ACCEPT, ORIGIN, WWW_AUTHENTICATE]
|
||||
.into_iter()
|
||||
.collect::<AccessControlAllowHeaders>(),
|
||||
res.headers_mut().insert(
|
||||
"Access-Control-Allow-Methods",
|
||||
HeaderValue::from_static("GET,HEAD,PUT,OPTIONS,DELETE,PROPFIND,COPY,MOVE"),
|
||||
);
|
||||
res.headers_mut().insert(
|
||||
"Access-Control-Allow-Headers",
|
||||
HeaderValue::from_static("Authorization,Destination,Range"),
|
||||
);
|
||||
res.headers_mut().insert(
|
||||
"Access-Control-Expose-Headers",
|
||||
HeaderValue::from_static(
|
||||
"WWW-Authenticate,Content-Range,Accept-Ranges,Content-Disposition",
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1013,12 +1069,12 @@ fn res_multistatus(res: &mut Response, content: &str) {
|
||||
async fn zip_dir<W: AsyncWrite + Unpin>(
|
||||
writer: &mut W,
|
||||
dir: &Path,
|
||||
hidden: &str,
|
||||
hidden: &[String],
|
||||
running: Arc<AtomicBool>,
|
||||
) -> BoxResult<()> {
|
||||
let mut writer = ZipFileWriter::new(writer);
|
||||
let hidden = Arc::new(hidden.to_string());
|
||||
let hidden = hidden.to_string();
|
||||
let hidden = Arc::new(hidden.to_vec());
|
||||
let hidden = hidden.clone();
|
||||
let dir_path_buf = dir.to_path_buf();
|
||||
let zip_paths = tokio::task::spawn_blocking(move || {
|
||||
let mut it = WalkDir::new(&dir_path_buf).into_iter();
|
||||
@@ -1118,8 +1174,8 @@ fn status_no_content(res: &mut Response) {
|
||||
*res.status_mut() = StatusCode::NO_CONTENT;
|
||||
}
|
||||
|
||||
fn is_hidden(hidden: &str, file_name: &str) -> bool {
|
||||
hidden.contains(&format!(",{},", file_name))
|
||||
fn is_hidden(hidden: &[String], file_name: &str) -> bool {
|
||||
hidden.iter().any(|v| glob(v, file_name))
|
||||
}
|
||||
|
||||
fn set_webdav_headers(res: &mut Response) {
|
||||
|
||||
58
src/utils.rs
58
src/utils.rs
@@ -23,3 +23,61 @@ pub fn try_get_file_name(path: &Path) -> BoxResult<&str> {
|
||||
.and_then(|v| v.to_str())
|
||||
.ok_or_else(|| format!("Failed to get file name of `{}`", path.display()).into())
|
||||
}
|
||||
|
||||
pub fn glob(source: &str, target: &str) -> bool {
|
||||
let ss: Vec<char> = source.chars().collect();
|
||||
let mut iter = target.chars();
|
||||
let mut i = 0;
|
||||
'outer: while i < ss.len() {
|
||||
let s = ss[i];
|
||||
match s {
|
||||
'*' => match ss.get(i + 1) {
|
||||
Some(s_next) => {
|
||||
for t in iter.by_ref() {
|
||||
if t == *s_next {
|
||||
i += 2;
|
||||
continue 'outer;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
None => return true,
|
||||
},
|
||||
'?' => match iter.next() {
|
||||
Some(_) => {
|
||||
i += 1;
|
||||
continue;
|
||||
}
|
||||
None => return false,
|
||||
},
|
||||
_ => match iter.next() {
|
||||
Some(t) => {
|
||||
if s == t {
|
||||
i += 1;
|
||||
continue;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
None => return false,
|
||||
},
|
||||
}
|
||||
}
|
||||
iter.next().is_none()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_glob_key() {
|
||||
assert!(glob("", ""));
|
||||
assert!(glob(".*", ".git"));
|
||||
assert!(glob("abc", "abc"));
|
||||
assert!(glob("a*c", "abc"));
|
||||
assert!(glob("a?c", "abc"));
|
||||
assert!(glob("a*c", "abbc"));
|
||||
assert!(glob("*c", "abc"));
|
||||
assert!(glob("a*", "abc"));
|
||||
assert!(glob("?c", "bc"));
|
||||
assert!(glob("a?", "ab"));
|
||||
assert!(!glob("abc", "adc"));
|
||||
assert!(!glob("abc", "abcd"));
|
||||
assert!(!glob("a?c", "abbc"));
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
//! Run file server with different args
|
||||
|
||||
mod fixtures;
|
||||
mod utils;
|
||||
|
||||
use assert_cmd::prelude::*;
|
||||
use assert_fs::fixture::TempDir;
|
||||
use fixtures::{port, server, tmpdir, wait_for_port, Error, TestServer};
|
||||
use fixtures::{server, Error, TestServer};
|
||||
use rstest::rstest;
|
||||
use std::process::{Command, Stdio};
|
||||
|
||||
#[rstest]
|
||||
fn path_prefix_index(#[with(&["--path-prefix", "xyz"])] server: TestServer) -> Result<(), Error> {
|
||||
@@ -31,22 +30,3 @@ fn path_prefix_propfind(
|
||||
assert!(text.contains("<D:href>/xyz/</D:href>"));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
#[case("index.html")]
|
||||
fn serve_single_file(tmpdir: TempDir, port: u16, #[case] file: &str) -> Result<(), Error> {
|
||||
let mut child = Command::cargo_bin("dufs")?
|
||||
.arg(tmpdir.path().join(file))
|
||||
.arg("-p")
|
||||
.arg(port.to_string())
|
||||
.stdout(Stdio::piped())
|
||||
.spawn()?;
|
||||
|
||||
wait_for_port(port);
|
||||
|
||||
let resp = reqwest::blocking::get(format!("http://localhost:{}/index.html", port))?;
|
||||
assert_eq!(resp.text()?, "This is index.html");
|
||||
|
||||
child.kill()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -95,3 +95,29 @@ fn auth_basic(
|
||||
assert_eq!(resp.status(), 201);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
fn auth_webdav_move(
|
||||
#[with(&["--auth", "/@user:pass@*", "--auth", "/dira@user3:pass3", "-A"])] server: TestServer,
|
||||
) -> Result<(), Error> {
|
||||
let origin_url = format!("{}dira/test.html", server.url());
|
||||
let new_url = format!("{}test2.html", server.url());
|
||||
let resp = fetch!(b"MOVE", &origin_url)
|
||||
.header("Destination", &new_url)
|
||||
.send_with_digest_auth("user3", "pass3")?;
|
||||
assert_eq!(resp.status(), 403);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
fn auth_webdav_copy(
|
||||
#[with(&["--auth", "/@user:pass@*", "--auth", "/dira@user3:pass3", "-A"])] server: TestServer,
|
||||
) -> Result<(), Error> {
|
||||
let origin_url = format!("{}dira/test.html", server.url());
|
||||
let new_url = format!("{}test2.html", server.url());
|
||||
let resp = fetch!(b"COPY", &origin_url)
|
||||
.header("Destination", &new_url)
|
||||
.send_with_digest_auth("user3", "pass3")?;
|
||||
assert_eq!(resp.status(), 403);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
32
tests/cli.rs
Normal file
32
tests/cli.rs
Normal file
@@ -0,0 +1,32 @@
|
||||
//! Run cli with different args, not starting a server
|
||||
|
||||
mod fixtures;
|
||||
|
||||
use assert_cmd::prelude::*;
|
||||
use clap::ValueEnum;
|
||||
use clap_complete::Shell;
|
||||
use fixtures::Error;
|
||||
use std::process::Command;
|
||||
|
||||
#[test]
|
||||
/// Show help and exit.
|
||||
fn help_shows() -> Result<(), Error> {
|
||||
Command::cargo_bin("dufs")?.arg("-h").assert().success();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
/// Print completions and exit.
|
||||
fn print_completions() -> Result<(), Error> {
|
||||
// let shell_enums = EnumValueParser::<Shell>::new();
|
||||
for shell in Shell::value_variants() {
|
||||
Command::cargo_bin("dufs")?
|
||||
.arg("--completions")
|
||||
.arg(shell.to_string())
|
||||
.assert()
|
||||
.success();
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -7,31 +7,27 @@ use rstest::rstest;
|
||||
#[rstest]
|
||||
fn cors(#[with(&["--enable-cors"])] server: TestServer) -> Result<(), Error> {
|
||||
let resp = reqwest::blocking::get(server.url())?;
|
||||
|
||||
assert_eq!(
|
||||
resp.headers().get("access-control-allow-origin").unwrap(),
|
||||
"*"
|
||||
);
|
||||
assert_eq!(
|
||||
resp.headers().get("access-control-allow-headers").unwrap(),
|
||||
"range, content-type, accept, origin, www-authenticate"
|
||||
resp.headers()
|
||||
.get("access-control-allow-credentials")
|
||||
.unwrap(),
|
||||
"true"
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
fn cors_options(#[with(&["--enable-cors"])] server: TestServer) -> Result<(), Error> {
|
||||
let resp = fetch!(b"OPTIONS", server.url()).send()?;
|
||||
|
||||
assert_eq!(
|
||||
resp.headers().get("access-control-allow-origin").unwrap(),
|
||||
"*"
|
||||
resp.headers().get("access-control-allow-methods").unwrap(),
|
||||
"GET,HEAD,PUT,OPTIONS,DELETE,PROPFIND,COPY,MOVE"
|
||||
);
|
||||
assert_eq!(
|
||||
resp.headers().get("access-control-allow-headers").unwrap(),
|
||||
"range, content-type, accept, origin, www-authenticate"
|
||||
"Authorization,Destination,Range"
|
||||
);
|
||||
assert_eq!(
|
||||
resp.headers().get("access-control-expose-headers").unwrap(),
|
||||
"WWW-Authenticate,Content-Range,Accept-Ranges,Content-Disposition"
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
78
tests/log_http.rs
Normal file
78
tests/log_http.rs
Normal file
@@ -0,0 +1,78 @@
|
||||
mod fixtures;
|
||||
mod utils;
|
||||
|
||||
use diqwest::blocking::WithDigestAuth;
|
||||
use fixtures::{port, tmpdir, wait_for_port, Error};
|
||||
|
||||
use assert_cmd::prelude::*;
|
||||
use assert_fs::fixture::TempDir;
|
||||
use rstest::rstest;
|
||||
use std::io::Read;
|
||||
use std::process::{Command, Stdio};
|
||||
|
||||
#[rstest]
|
||||
#[case(&["-a", "/@user:pass", "--log-format", "$remote_user"], false)]
|
||||
#[case(&["-a", "/@user:pass", "--log-format", "$remote_user", "--auth-method", "basic"], true)]
|
||||
fn log_remote_user(
|
||||
tmpdir: TempDir,
|
||||
port: u16,
|
||||
#[case] args: &[&str],
|
||||
#[case] is_basic: bool,
|
||||
) -> Result<(), Error> {
|
||||
let mut child = Command::cargo_bin("dufs")?
|
||||
.arg(tmpdir.path())
|
||||
.arg("-p")
|
||||
.arg(port.to_string())
|
||||
.args(args)
|
||||
.stdout(Stdio::piped())
|
||||
.spawn()?;
|
||||
|
||||
wait_for_port(port);
|
||||
|
||||
let stdout = child.stdout.as_mut().expect("Failed to get stdout");
|
||||
|
||||
let req = fetch!(b"GET", &format!("http://localhost:{}", port));
|
||||
|
||||
let resp = if is_basic {
|
||||
req.basic_auth("user", Some("pass")).send()?
|
||||
} else {
|
||||
req.send_with_digest_auth("user", "pass")?
|
||||
};
|
||||
|
||||
assert_eq!(resp.status(), 200);
|
||||
|
||||
let mut buf = [0; 1000];
|
||||
let buf_len = stdout.read(&mut buf)?;
|
||||
let output = std::str::from_utf8(&buf[0..buf_len])?;
|
||||
|
||||
assert!(output.lines().last().unwrap().ends_with("user"));
|
||||
|
||||
child.kill()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
#[case(&["--log-format", ""])]
|
||||
fn no_log(tmpdir: TempDir, port: u16, #[case] args: &[&str]) -> Result<(), Error> {
|
||||
let mut child = Command::cargo_bin("dufs")?
|
||||
.arg(tmpdir.path())
|
||||
.arg("-p")
|
||||
.arg(port.to_string())
|
||||
.args(args)
|
||||
.stdout(Stdio::piped())
|
||||
.spawn()?;
|
||||
|
||||
wait_for_port(port);
|
||||
|
||||
let stdout = child.stdout.as_mut().expect("Failed to get stdout");
|
||||
|
||||
let resp = fetch!(b"GET", &format!("http://localhost:{}", port)).send()?;
|
||||
assert_eq!(resp.status(), 200);
|
||||
|
||||
let mut buf = [0; 1000];
|
||||
let buf_len = stdout.read(&mut buf)?;
|
||||
let output = std::str::from_utf8(&buf[0..buf_len])?;
|
||||
|
||||
assert_eq!(output.lines().last().unwrap(), "");
|
||||
Ok(())
|
||||
}
|
||||
60
tests/single_file.rs
Normal file
60
tests/single_file.rs
Normal file
@@ -0,0 +1,60 @@
|
||||
//! Run file server with different args
|
||||
|
||||
mod fixtures;
|
||||
mod utils;
|
||||
|
||||
use assert_cmd::prelude::*;
|
||||
use assert_fs::fixture::TempDir;
|
||||
use fixtures::{port, tmpdir, wait_for_port, Error};
|
||||
use rstest::rstest;
|
||||
use std::process::{Command, Stdio};
|
||||
|
||||
#[rstest]
|
||||
#[case("index.html")]
|
||||
fn single_file(tmpdir: TempDir, port: u16, #[case] file: &str) -> Result<(), Error> {
|
||||
let mut child = Command::cargo_bin("dufs")?
|
||||
.arg(tmpdir.path().join(file))
|
||||
.arg("-p")
|
||||
.arg(port.to_string())
|
||||
.stdout(Stdio::piped())
|
||||
.spawn()?;
|
||||
|
||||
wait_for_port(port);
|
||||
|
||||
let resp = reqwest::blocking::get(format!("http://localhost:{}", port))?;
|
||||
assert_eq!(resp.text()?, "This is index.html");
|
||||
let resp = reqwest::blocking::get(format!("http://localhost:{}/", port))?;
|
||||
assert_eq!(resp.text()?, "This is index.html");
|
||||
let resp = reqwest::blocking::get(format!("http://localhost:{}/index.html", port))?;
|
||||
assert_eq!(resp.text()?, "This is index.html");
|
||||
|
||||
child.kill()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
#[case("index.html")]
|
||||
fn path_prefix_single_file(tmpdir: TempDir, port: u16, #[case] file: &str) -> Result<(), Error> {
|
||||
let mut child = Command::cargo_bin("dufs")?
|
||||
.arg(tmpdir.path().join(file))
|
||||
.arg("-p")
|
||||
.arg(port.to_string())
|
||||
.arg("--path-prefix")
|
||||
.arg("xyz")
|
||||
.stdout(Stdio::piped())
|
||||
.spawn()?;
|
||||
|
||||
wait_for_port(port);
|
||||
|
||||
let resp = reqwest::blocking::get(format!("http://localhost:{}/xyz", port))?;
|
||||
assert_eq!(resp.text()?, "This is index.html");
|
||||
let resp = reqwest::blocking::get(format!("http://localhost:{}/xyz/", port))?;
|
||||
assert_eq!(resp.text()?, "This is index.html");
|
||||
let resp = reqwest::blocking::get(format!("http://localhost:{}/xyz/index.html", port))?;
|
||||
assert_eq!(resp.text()?, "This is index.html");
|
||||
let resp = reqwest::blocking::get(format!("http://localhost:{}", port))?;
|
||||
assert_eq!(resp.status(), 404);
|
||||
|
||||
child.kill()?;
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user