checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
[[package]]
-name = "duf"
+name = "dufs"
version = "0.18.0"
dependencies = [
"assert_cmd",
[package]
-name = "duf"
+name = "dufs"
version = "0.18.0"
edition = "2021"
authors = ["sigoden <sigoden@gmail.com>"]
-description = "Duf is a simple file server."
+description = "Dufs is a simple file server."
license = "MIT OR Apache-2.0"
-homepage = "https://github.com/sigoden/duf"
-repository = "https://github.com/sigoden/duf"
+homepage = "https://github.com/sigoden/dufs"
+repository = "https://github.com/sigoden/dufs"
categories = ["command-line-utilities", "web-programming::http-server"]
keywords = ["static", "file", "server", "webdav", "cli"]
RUN cargo build --target x86_64-unknown-linux-musl --release
FROM scratch
-COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/duf /bin/
-ENTRYPOINT ["/bin/duf"]
\ No newline at end of file
+COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/dufs /bin/
+ENTRYPOINT ["/bin/dufs"]
\ No newline at end of file
-# Duf
+# Dufs (Old Name: Duf)
-[](https://github.com/sigoden/duf/actions/workflows/ci.yaml)
-[](https://crates.io/crates/duf)
+[](https://github.com/sigoden/dufs/actions/workflows/ci.yaml)
+[](https://crates.io/crates/dufs)
-Duf is a simple file server. Support static serve, search, upload, webdav...
+Dufs is a simple file server. Support static serve, search, upload, webdav...
-
+
## Features
### With cargo
```
-cargo install duf
+cargo install dufs
```
### With docker
```
-docker run -v `pwd`:/data -p 5000:5000 --rm -it sigoden/duf /data
+docker run -v `pwd`:/data -p 5000:5000 --rm -it sigoden/dufs /data
```
### Binaries on macOS, Linux, Windows
-Download from [Github Releases](https://github.com/sigoden/duf/releases), unzip and add duf to your $PATH.
+Download from [Github Releases](https://github.com/sigoden/dufs/releases), unzip and add dufs to your $PATH.
## CLI
```
-Duf is a simple file server. - https://github.com/sigoden/duf
+Dufs is a simple file server. - https://github.com/sigoden/dufs
USAGE:
- duf [OPTIONS] [--] [path]
+ dufs [OPTIONS] [--] [path]
ARGS:
<path> Path to a root directory for serving files [default: .]
Serve current working directory, no upload/delete
```
-duf
+dufs
```
Allow upload/delete
```
-duf -A
+dufs -A
```
Listen on a specific port
```
-duf -p 80
+dufs -p 80
```
For a single page application (SPA)
```
-duf --render-spa
+dufs --render-spa
```
Use https
```
-duf --tls-cert my.crt --tls-key my.key
+dufs --tls-cert my.crt --tls-key my.key
```
## API
</summary>
```
-duf -a <path>@<readwrite>[@<readonly>]
+dufs -a <path>@<readwrite>[@<readonly>]
```
- `<path>`: Path to protected
For example:
```
-duf -a /@admin:pass@* -a /ui@designer:pass1 -A
+dufs -a /@admin:pass@* -a /ui@designer:pass1 -A
```
- All files/folders are public to access/download.
- Account `admin:pass` can upload/delete/download any files/folders.
## License
-Copyright (c) 2022 duf-developers.
+Copyright (c) 2022 dufs-developers.
-duf is made available under the terms of either the MIT License or the Apache License 2.0, at your option.
+dufs is made available under the terms of either the MIT License or the Apache License 2.0, at your option.
See the LICENSE-APACHE and LICENSE-MIT files for license details.
\ No newline at end of file
use crate::utils::encode_uri;
use crate::BoxResult;
-const REALM: &str = "DUF";
+const REALM: &str = "DUFS";
lazy_static! {
static ref NONCESTARTHASH: Context = {
"__SLOT__",
&format!(
r#"
-<title>Index of {} - Duf</title>
+<title>Index of {} - Dufs</title>
<style>{}</style>
<script>
const DATA =
#[rstest]
#[case("index.html")]
fn serve_single_file(tmpdir: TempDir, port: u16, #[case] file: &str) -> Result<(), Error> {
- let mut child = Command::cargo_bin("duf")?
+ let mut child = Command::cargo_bin("dufs")?
.env("RUST_LOG", "false")
.arg(tmpdir.path().join(file))
.arg("-p")
#[rstest]
#[case(&["-b", "20.205.243.166"])]
fn bind_fails(tmpdir: TempDir, port: u16, #[case] args: &[&str]) -> Result<(), Error> {
- Command::cargo_bin("duf")?
+ Command::cargo_bin("dufs")?
.env("RUST_LOG", "false")
.arg(tmpdir.path())
.arg("-p")
#[case(&[] as &[&str])]
#[case(&["--path-prefix", "/prefix"])]
fn validate_printed_urls(tmpdir: TempDir, port: u16, #[case] args: &[&str]) -> Result<(), Error> {
- let mut child = Command::cargo_bin("duf")?
+ let mut child = Command::cargo_bin("dufs")?
.env("RUST_LOG", "false")
.arg(tmpdir.path())
.arg("-p")
free_local_port().expect("Couldn't find a free local port")
}
-/// Run duf as a server; Start with a temporary directory, a free port and some
+/// Run dufs as a server; Start with a temporary directory, a free port and some
/// optional arguments then wait for a while for the server setup to complete.
#[fixture]
#[allow(dead_code)]
{
let port = port();
let tmpdir = tmpdir();
- let child = Command::cargo_bin("duf")
+ let child = Command::cargo_bin("dufs")
.expect("Couldn't find test binary")
.env("RUST_LOG", "false")
.arg(tmpdir.path())
{
let port = port();
let tmpdir = tmpdir();
- let child = Command::cargo_bin("duf")
+ let child = Command::cargo_bin("dufs")
.expect("Couldn't find test binary")
.env("RUST_LOG", "false")
.arg(tmpdir.path())
/// Wrong path for cert throws error.
#[rstest]
fn wrong_path_cert() -> Result<(), Error> {
- Command::cargo_bin("duf")?
+ Command::cargo_bin("dufs")?
.args(&["--tls-cert", "wrong", "--tls-key", "tests/data/key.pem"])
.assert()
.failure()
/// Wrong paths for key throws errors.
#[rstest]
fn wrong_path_key() -> Result<(), Error> {
- Command::cargo_bin("duf")?
+ Command::cargo_bin("dufs")?
.args(&["--tls-cert", "tests/data/cert.pem", "--tls-key", "wrong"])
.assert()
.failure()