diff options
-rw-r--r-- | Cargo.lock | 86 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | src/webdav_fs.rs | 43 |
3 files changed, 107 insertions, 24 deletions
@@ -963,12 +963,14 @@ checksum = "04d2cd9c18b9f454ed67da600630b021a8a80bf33f8c95896ab33aaf1c26b728" [[package]] name = "dav-server" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23a9e373ca09a43ad20c0b7805fcb4b489713f049a3ee2750ed61efa72f9cde9" +checksum = "1325ec68fa2627b069d06d5096d6109da5ebf46d45099e01e2dc59a4bcc4641e" dependencies = [ "actix-web", "bytes", + "derivative", + "dyn-clone", "futures-channel", "futures-util", "headers", @@ -985,6 +987,7 @@ dependencies = [ "percent-encoding", "pin-project", "pin-utils", + "reflink-copy", "regex", "time", "tokio", @@ -1004,6 +1007,17 @@ dependencies = [ ] [[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] name = "derive_arbitrary" version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1107,6 +1121,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" [[package]] +name = "dyn-clone" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c7a8fb8a9fbf66c1f703fe16184d10ca0ee9d23be5b4436400408ba54a95005" + +[[package]] name = "encoding_rs" version = "0.8.35" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2080,9 +2100,9 @@ checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" [[package]] name = "lru" -version = "0.12.5" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" +checksum = "9f8cc7106155f10bdf99a6f379688f543ad6596a415375b36a59a054ceda1198" dependencies = [ "hashbrown 0.15.2", ] @@ -2778,6 +2798,18 @@ dependencies = [ ] [[package]] +name = "reflink-copy" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c81d000a2c524133cc00d2f92f019d399e57906c3b7119271a2495354fe895" +dependencies = [ + "cfg-if", + "libc", + "rustix", + "windows", +] + +[[package]] name = "regex" version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3954,6 +3986,28 @@ dependencies = [ ] [[package]] +name = "windows" +version = "0.61.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5ee8f3d025738cb02bad7868bbb5f8a6327501e870bf51f1b455b0a2454a419" +dependencies = [ + "windows-collections", + "windows-core", + "windows-future", + "windows-link", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" +dependencies = [ + "windows-core", +] + +[[package]] name = "windows-core" version = "0.61.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3967,6 +4021,16 @@ dependencies = [ ] [[package]] +name = "windows-future" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a1d6bbefcb7b60acd19828e1bc965da6fcf18a7e39490c5f8be71e54a19ba32" +dependencies = [ + "windows-core", + "windows-link", +] + +[[package]] name = "windows-implement" version = "0.60.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3995,6 +4059,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" [[package]] +name = "windows-numerics" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" +dependencies = [ + "windows-core", + "windows-link", +] + +[[package]] name = "windows-registry" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -4237,9 +4311,9 @@ dependencies = [ [[package]] name = "xmltree" -version = "0.10.3" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7d8a75eaf6557bb84a65ace8609883db44a29951042ada9b393151532e41fcb" +checksum = "b619f8c85654798007fb10afa5125590b43b088c225a25fc2fec100a9fad0fc6" dependencies = [ "xml-rs", ] @@ -33,7 +33,7 @@ clap_complete = "4" clap_mangen = "0.2" colored = "3" comrak = { version = "0.38", default-features = false } -dav-server = { version = "0.7", features = ["actix-compat"] } +dav-server = { version = "0.8", features = ["actix-compat"] } fast_qr = { version = "0.13", features = ["svg"] } futures = "0.3" grass = { version = "0.13", features = ["macro"], default-features = false } diff --git a/src/webdav_fs.rs b/src/webdav_fs.rs index c00d9fc..70e9818 100644 --- a/src/webdav_fs.rs +++ b/src/webdav_fs.rs @@ -1,7 +1,15 @@ //! Helper types and functions to allow configuring hidden files visibility //! for WebDAV handlers -use dav_server::{davpath::DavPath, fs::*, localfs::LocalFs}; +use dav_server::{ + davpath::DavPath, + fs::{ + DavDirEntry, DavFile, DavFileSystem, DavMetaData, FsError as DavFsError, + FsFuture as DavFsFuture, FsStream as DavFsStream, OpenOptions as DavOpenOptions, + ReadDirMeta as DavReadDirMeta, + }, + localfs::LocalFs, +}; use futures::{StreamExt, TryFutureExt, future::ready}; use std::path::{Component, Path}; @@ -34,50 +42,51 @@ impl DavFileSystem for RestrictedFs { fn open<'a>( &'a self, path: &'a DavPath, - options: OpenOptions, - ) -> FsFuture<'a, Box<dyn DavFile>> { + options: DavOpenOptions, + ) -> DavFsFuture<'a, Box<dyn DavFile>> { if !path_has_hidden_components(path) || self.show_hidden { self.local.open(path, options) } else { - Box::pin(ready(Err(FsError::NotFound))) + Box::pin(ready(Err(DavFsError::NotFound))) } } fn read_dir<'a>( &'a self, path: &'a DavPath, - meta: ReadDirMeta, - ) -> FsFuture<'a, FsStream<Box<dyn DavDirEntry>>> { + meta: DavReadDirMeta, + ) -> DavFsFuture<'a, DavFsStream<Box<dyn DavDirEntry>>> { if self.show_hidden { self.local.read_dir(path, meta) } else if !path_has_hidden_components(path) { Box::pin(self.local.read_dir(path, meta).map_ok(|stream| { - let dyn_stream: FsStream<Box<dyn DavDirEntry>> = Box::pin(stream.filter(|entry| { - ready(match entry { - Ok(e) => !e.name().starts_with(b"."), - _ => false, - }) - })); + let dyn_stream: DavFsStream<Box<dyn DavDirEntry>> = + Box::pin(stream.filter(|entry| { + ready(match entry { + Ok(e) => !e.name().starts_with(b"."), + _ => false, + }) + })); dyn_stream })) } else { - Box::pin(ready(Err(FsError::NotFound))) + Box::pin(ready(Err(DavFsError::NotFound))) } } - fn metadata<'a>(&'a self, path: &'a DavPath) -> FsFuture<'a, Box<dyn DavMetaData>> { + fn metadata<'a>(&'a self, path: &'a DavPath) -> DavFsFuture<'a, Box<dyn DavMetaData>> { if !path_has_hidden_components(path) || self.show_hidden { self.local.metadata(path) } else { - Box::pin(ready(Err(FsError::NotFound))) + Box::pin(ready(Err(DavFsError::NotFound))) } } - fn symlink_metadata<'a>(&'a self, path: &'a DavPath) -> FsFuture<'a, Box<dyn DavMetaData>> { + fn symlink_metadata<'a>(&'a self, path: &'a DavPath) -> DavFsFuture<'a, Box<dyn DavMetaData>> { if !path_has_hidden_components(path) || self.show_hidden { self.local.symlink_metadata(path) } else { - Box::pin(ready(Err(FsError::NotFound))) + Box::pin(ready(Err(DavFsError::NotFound))) } } } |