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

Implement a native WebDAV plugin #647

Merged
merged 18 commits into from
May 6, 2024
Merged

Conversation

grote
Copy link
Collaborator

@grote grote commented Apr 16, 2024

This MR does the following:

  • Refactor Seedvault’s storage and UI code to allow for different (non-SAF) storage plugins
    • don't allow changing storage while file or app backup is running
  • Implement new WebDAV storage plugin
  • UI for adding WebDAV credentials and URL

Closes #317

@grote grote requested a review from stevesoltys April 16, 2024 20:47
@grote grote force-pushed the webdav branch 2 times, most recently from f5dc246 to e92c9c9 Compare April 22, 2024 15:16
grote added 13 commits April 25, 2024 09:51
We use the same root folder for app and files backup. App backup usually creates the root folder, but if only storage backup is used, it will be missing and needs to be created.
This is especially useful for WebDAV storage where the user can supply whatever URL and before proceeding, we need to know whether that URL and the provided credentials are actually working.
Mostly renaming for clarity.
in preparation for generalization
and allow changing them dynamically. So far plugins were injected into the dependency graph and couldn't be changed at runtime, only their config could. Now we have the infrastructure in place to really allow for more than one plugin.
including ViewModel and StoragePluginManager logic
this is important, so we don't allow more than one backup running at the same time and not swapping out the storage while one is running.

Previously, we had some bare bones tracking, but nothing precise.
@stevesoltys
Copy link
Member

Feel free to merge whenever. LGTM.


fun getConfig(): WebDavConfig {
assumeFalse(System.getenv("NEXTCLOUD_URL").isNullOrEmpty())
return WebDavConfig(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option could be something like WireMock if we didn't want to actually depend on an external service for tests.

But this is probably easier and likely provides better coverage anyways..

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I had considered mocking the HTTP interactions, but this gets us to low-level DAV and XML details, I didn't want to get into. That is why we are using a DAV library after all. I also thought about some built-in WebDAV capable webserver only used for tests, but couldn't find anything sane and easy, so I went with testing against a real server.

@grote grote merged commit d0cf168 into seedvault-app:android14 May 6, 2024
3 checks passed
@grote grote deleted the webdav branch May 6, 2024 16:41
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.

Implement a generic WebDAV backend
2 participants