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

feat: webdav integration #3534

Merged
merged 3 commits into from
Oct 9, 2024

Conversation

kkoyung
Copy link
Contributor

@kkoyung kkoyung commented Oct 1, 2024

I saw @johannesjo mentioned in a comment that he is interested in bundling a webdav server to the super-productivity docker container. So... I made a prototype of it.

Description

This patch provides an optional way to integrate an external WebDAV server so that the super-productivity container can serve as a WebDAV server with base url http://localhost/webdav/ . It includes the following changes:

Replace the default nginx config file
Besides serving the web app, the new nginx config file also forwards all the requests with paths starting with "/webdav/" to a backend WebDAV server specified by the environment variable WEBDAV_BACKEND. Note that during forwarding, the path prefix "/webdav" will be removed.

Use hacdias/webdav as default WebDAV backend server The docker-compose.yaml provides an example setup to use the docker image hacdias/webdav as the WebDAV backend server. An example for the configuration of the WebDAV server is also provided in webdav.yaml.

Issues Resolved

#2309 #3513

Check List

  • New functionality includes testing.
  • New functionality has been documented in the README if applicable.

Remark

The docker-compose.yaml simply points to the docker image "johannesjo/super-productivity:latest" on Docker Hub, which does not contain this patch. You need to change it to the locally built image during testing.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Hello there kkoyung! 👋

Thank you and congrats 🎉 for opening your first PR on this project! ✨ 💖

We will try to review it soon!

This patch provides an optional way to integrate an external WebDAV server so that the super-productivity container can serve as a WebDAV server with base url http://localhost/webdav/ . It includes the following changes:

**Replace the default nginx config file**
Besides serving the web app, the new nginx config file also forwards all the requests with paths starting with "/webdav/" to a backend WebDAV server specified by the environment variable WEBDAV_BACKEND. Note that during forwarding, the path prefix "/webdav" will be removed.

**Use hacdias/webdav as default WebDAV backend server**
The docker-compose.yaml provides an example setup to use the docker image [hacdias/webdav](https://github.com/hacdias/webdav) as the WebDAV backend server. An example for the configuration of the WebDAV server is also provided in webdav.yaml.
By default, nginx refuses to start if the upstream host is not found.
Since the webdav upstream server is optional here, we want nginx to
start even if the webdav upstream server is missing. The trick here is
to put the upstream url in a variable first so that nginx will not check
whether the upstream host exists on start and start anyway.
@kkoyung kkoyung changed the title feat:webdav-integration feat: webdav integration Oct 4, 2024
@kkoyung
Copy link
Contributor Author

kkoyung commented Oct 4, 2024

Side note: The default value of "Sync Folder Path" of webdav sync is super-productivity, and it is appended to the base url to form the destination of webdav sync (correct me if I'm wrong). However, new users might not have the directory super-productivity/ on their webdav server, and receive http error 409 on their first synchronization. It's the result of directly submitting PUT request at super-productivity/MAIN.json while the directory super-productivity/ does not exist. New users have to manual create the directory super-productivity through their webdav client before synchronizing. I think super-productivity should first fire a MKCOL request to create the target directory before synchronizing if it does not exist. This can improve the user experience.

@johannesjo
Copy link
Owner

Thank you very much for this! This is a really great addition! :)

@johannesjo johannesjo merged commit f0b5a43 into johannesjo:master Oct 9, 2024
5 checks passed
@kkoyung kkoyung deleted the feat/webdav-integration branch October 10, 2024 15:20
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.

2 participants