Skip to content

Commit

Permalink
refactor: move webdavfs from rustic_core to rustic-rs (#1363)
Browse files Browse the repository at this point in the history
Signed-off-by: simonsan <[email protected]>
Co-authored-by: simonsan <[email protected]>
  • Loading branch information
aawsome and simonsan authored Nov 23, 2024
1 parent c3e2557 commit 3d13f2e
Show file tree
Hide file tree
Showing 4 changed files with 374 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@ jemallocator = ["dep:jemallocator-global"]
# Commands
self-update = ["dep:self_update", "dep:semver"]
tui = ["dep:ratatui", "dep:crossterm", "dep:tui-textarea"]
webdav = ["dep:dav-server", "dep:warp", "dep:tokio", "rustic_core/webdav"]
webdav = [
"dep:dav-server",
"dep:warp",
"dep:tokio",
"rustic_core/webdav",
"dep:bytes",
"dep:futures",
]
mount = ["dep:fuse_mt"]

[[bin]]
Expand Down Expand Up @@ -87,6 +94,7 @@ semver = { version = "1", optional = true }
simplelog = "0.12"

# commands
bytes = { version = "1.8.0", optional = true }
bytesize = "1"
cached = "0.53.1"
clap = { version = "4", features = ["derive", "env", "wrap_help"] }
Expand All @@ -98,6 +106,7 @@ derive_more = { version = "1", features = ["debug"] }
dialoguer = "0.11.0"
directories = "5"
fuse_mt = { version = "0.6", optional = true }
futures = { version = "0.3.31", optional = true }
gethostname = "0.5"
globset = "0.4.15"
human-panic = "2"
Expand Down
6 changes: 5 additions & 1 deletion src/commands/webdav.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ use dav_server::{warp::dav_handler, DavHandler};
use serde::{Deserialize, Serialize};

use rustic_core::vfs::{FilePolicy, IdenticalSnapshot, Latest, Vfs};
use webdavfs::WebDavFS;

mod webdavfs;

#[derive(Clone, Command, Default, Debug, clap::Parser, Serialize, Deserialize, Merge)]
#[serde(default, rename_all = "kebab-case", deny_unknown_fields)]
Expand Down Expand Up @@ -132,8 +135,9 @@ impl WebDavCmd {
|s| s.parse(),
)?;

let webdavfs = WebDavFS::new(repo, vfs, file_access);
let dav_server = DavHandler::builder()
.filesystem(vfs.into_webdav_fs(repo, file_access))
.filesystem(Box::new(webdavfs))
.build_handler();

tokio::runtime::Builder::new_current_thread()
Expand Down
Loading

0 comments on commit 3d13f2e

Please sign in to comment.