Skip to content

Commit 14b8d0f

Browse files
kkoyungjohannesjo
authored andcommitted
feat: webdav integration
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.
1 parent 6960971 commit 14b8d0f

File tree

5 files changed

+93
-0
lines changed

5 files changed

+93
-0
lines changed

Diff for: Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ ENV PORT=80
3434
# copy artifact build from the 'build environment'
3535
COPY --from=build /app/dist/browser /usr/share/nginx/html
3636

37+
# copy nginx config
38+
COPY ./nginx/default.conf.template /etc/nginx/templates/default.conf.template
39+
3740
# expose port: defaults to 80
3841
EXPOSE $PORT
3942

Diff for: README.md

+34
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,40 @@ Packaging the app is done via [electron-builder](https://github.com/electron-use
311311
docker run -d -p 80:80 johannesjo/super-productivity:latest
312312
```
313313

314+
Now you can access the web app from your browser at `http://localhost`.
315+
316+
This container only serves the web app, and the user data is stored in the browser. Therefore, it does not have any persistent storage.
317+
318+
### Integrate with WebDAV backend server
319+
320+
You can integrate the container with a WebDAV server container to provides WebDAV service with base url `http://localhost/webdav`.
321+
322+
**Download pre-configured files**
323+
324+
Download the pre-configured `docker-compose.yaml` and `webdav.yaml` from this repository to a local directory, say `sp/`.
325+
326+
```bash
327+
# Alternatively, you can get them by cloning this repository
328+
git clone https://github.com/johannesjo/super-productivity.git
329+
mkdir -p sp
330+
cp super-productivity/docker-compose.yaml sp/
331+
cp super-productivity/webdav.yaml sp/
332+
cd sp
333+
```
334+
335+
**Setup user accounts**
336+
337+
Edit `webdav.yaml` to configure username and password. Remember to allocate separate directories to different user (within `/data`) to avoid mixing up user data.
338+
339+
**Start the services**
340+
341+
```bash
342+
docker compose pull
343+
docker compose up -d
344+
```
345+
346+
Additionally to accessing the web app from your browser at `http://localhost`, you can set up WebDAV synchronization with base url `http://localhost/webdav/`.
347+
314348
## Custom themes (desktop only)
315349

316350
In addition to color coding your projects and tags and to the dark and light theme you can also load completely custom css to restyle everything. To load a custom theme you simply need put them into a new file named `styles.css` directly in the [user data folder](#user-data-folder).

Diff for: docker-compose.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
services:
2+
sp:
3+
image: johannesjo/super-productivity:latest
4+
ports:
5+
- 80:80
6+
environment:
7+
- WEBDAV_BACKEND=http://webdav # Optional
8+
9+
# Optional: WebDAV backend server
10+
# (used with the WEBDAV_BACKEND environment variable)
11+
webdav:
12+
image: hacdias/webdav:latest
13+
ports:
14+
- 81:80
15+
volumes:
16+
- ./webdav.yaml:/config.yml:ro
17+
- ./data:/data

Diff for: nginx/default.conf.template

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
server {
2+
listen 80;
3+
server_name localhost;
4+
5+
# serve super-productivity as static files at the path /
6+
location / {
7+
root /usr/share/nginx/html;
8+
index index.html index.htm;
9+
}
10+
11+
# forward requests starting with "/webdav/" to $WEBDAV_BACKEND
12+
# note: the prefix "/webdav" is removed during forwarding
13+
location = /webdav {
14+
return 302 /webdav/;
15+
}
16+
location /webdav/ {
17+
proxy_pass $WEBDAV_BACKEND/;
18+
# note: the trailing slash here matters!
19+
}
20+
21+
# redirect server error pages to the static page /50x.html
22+
error_page 500 502 503 504 /50x.html;
23+
location = /50x.html {
24+
root /usr/share/nginx/html;
25+
}
26+
}

Diff for: webdav.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
address: 0.0.0.0
2+
port: 80
3+
4+
prefix: /
5+
permissions: CRUD
6+
7+
users:
8+
- username: alice
9+
password: alicepassword
10+
directory: /data/alice
11+
- username: bob
12+
password: bobpassword
13+
directory: /data/bob

0 commit comments

Comments
 (0)