Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add WebDAV server (ie "mount" on Windows) #4754

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ducalex
Copy link
Contributor

@ducalex ducalex commented Apr 6, 2024

What does this PR change? What problem does it solve?

It allows browsing repositories on operating systems where Fuse isn't available.

This PR should work on all OSes and adds no external dependencies (though I suppose x/net/webdav is "external", but it's part of golang). It does no write operation on the repository so it should be safe and I encourage you to try it! But you shouldn't blindly trust the data that it gives you. Performance might also be an issue on large repositories with overly eager clients (like Windows Explorer).

Whilst I'd be happy to see this PR through (fix my reckless path handling, lack of concurrency locks, performance issues, and add documentation and tests), I do no believe it will be accepted as is.

Realistically, internal/fuse needs to be abstracted into a VFS that could be shared by Fuse, WebDAV, HTML, etc. It does everything needed already (paths templating, snapshots tree building in a performant manner, file reading, it handles concurrency, etc) but it directly depends on anacrolix/fuse which isn't present in Windows builds. I do not think it would be very hard to refactor, but I feel unqualified since it's deep in the internals of restic and would touch a lot of files.

Special thanks to @wrouesnel, although I wasn't able to use his code in the end (^ that refactoring would be needed first), his attempt is what motivated to work on this.

demo.mp4

Was the change previously discussed in an issue or on the forum?

#485
#60

Checklist

  • I have read the contribution guidelines.
  • I have enabled maintainer edits.
  • I have added tests for all code changes.
  • I have added documentation for relevant changes (in the manual).
  • There's a new file in changelog/unreleased/ that describes the changes for our users (see template).
  • I have run gofmt on the code in all commits.
  • All commit messages are formatted in the same style as the other commits in the repo.
  • I'm done! This pull request is ready for review.

@fd0
Copy link
Member

fd0 commented Apr 11, 2024

Hey, thanks a lot for getting this started! I've (slowly) also started working on a WebDAV server implementation, and I think we can join forces here in getting the work done and the PR merged. :)

I did not have that much time for restic the last couple of years, but I'd like to get more involved again!

I've identified the same challenges:

  1. Refactoring the low-level fuse code (the virtual FS) into something we can use for fuse, webdav and also a web server (Implemented a web server to browse a repository (snapshots, files) #4276). I have already started on this. In the process, we will need to a lot of tests (which the fuse code currently does not have).
  2. Build some kind of generic access control for the WebDAV server as well as a (future) web server (like Implemented a web server to browse a repository (snapshots, files) #4276). I'm thinking about having a way to specify the username and password and require it via HTTP auth, if none is specified then a random one is generated and used. It can then be passed to the Explorer (or gio-mount on Linux) and will be handled transparently to the user. Something like that.

I'll get the code that I already have cleaned up and will push it somewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants