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

Use caldav as task provider #626

Closed
janLo opened this issue Oct 28, 2020 · 19 comments
Closed

Use caldav as task provider #626

janLo opened this issue Oct 28, 2020 · 19 comments
Assignees

Comments

@janLo
Copy link
Contributor

janLo commented Oct 28, 2020

Problem Statement

I use Nextcloud deck and tasks to organize my tasks. I would like to use this data as source for tasks in super-productivity ad this would allow me to use it without having to duplicate the tasks here.

❔ Possible Solution

Both data (Deck and Tasks) is available via CalDAV from nextcloud. Similar to the Jira- and Gitlab-provider this could be used as a source for tasks. Caldav is a open protocol on top of webdav. Nextcloud tiself maintains a JS library for Caldav: https://github.com/nextcloud/cdav-library

⤴️ Describe alternatives you've considered

The only alternative I can think of is to dump the tasks regularly in a format the super-productivity can import and use that but it would be cumbersome.

➕ Additional context

I would like to provide an initial implementation myself but cannot promise on any timeframe. If someone else wants to have a look into this I'm happy with that.

@johannesjo
Copy link
Owner

This would be a great addition! As you say a good starting point would be to look at the existing issue provider implementations. It probably also makes sense to limit each project to a single issue provider, but that's a topic for another issue.

@github-actions
Copy link

This issue has not received any updates in 90 days. Please comment, if this still relevant!

@github-actions github-actions bot added the Stale label Jan 31, 2021
@sunjam
Copy link

sunjam commented Jan 31, 2021 via email

@github-actions github-actions bot removed the Stale label Feb 1, 2021
@aracnus
Copy link

aracnus commented Feb 1, 2021

Is this still be considering? I would love this feature.

@janLo
Copy link
Contributor Author

janLo commented Feb 1, 2021

I still plan to look into it - just have trouble to find the time atm.

@janLo
Copy link
Contributor Author

janLo commented Feb 7, 2021

Time is still on the short side here (lockdown-childcare-bla) but I've at least started some efforts (not much to see yet though): https://github.com/janLo/super-productivity/tree/caldav-support

I managed so far to get all tasks somehow from my caldav server (nextcloud) and print them in the console. Not very helpful but a start. In the process I made a terrible discovery: NC does not set any CORS-Headers on the Caldav endpoints. So it can only work if you use it via the electron app. What would be the right way to sort this out? Opening an issue in NC? Limit functionality to desktop apps?

I'll try to get a rough prototype running in the next weeks. Help on the CORS-front is very much appreciated.

btw: @johannesjo do you have any documentation how these translation files are maintained? Are they generated or written by hand?

@sunjam
Copy link

sunjam commented Feb 8, 2021 via email

@cwerner1
Copy link
Contributor

cwerner1 commented Feb 9, 2021

A workaround for the Nextcloud CORS issue:
The NC app webapppassword allows to set the CORS header for Nextcloud

https://apps.nextcloud.com/apps/webapppassword

@johannesjo
Copy link
Owner

@janLo we definitely and unfortunately would need some way of whitelisting app.super-productivity.com for the mobile app. Maybe we can also ask the nextcloud devs for help about this?

@janLo
Copy link
Contributor Author

janLo commented Feb 9, 2021

A workaround for the Nextcloud CORS issue:
The NC app webapppassword allows to set the CORS header for Nextcloud

https://apps.nextcloud.com/apps/webapppassword

This does not seem to be enough. I tried this and then got a illegal header or somethng similar - it seems that custom headers need to be whitelisted as well?

@johannesjo Does cors also apply to the mobile app? Is this not just an electron app packed in an APK?

@johannesjo
Copy link
Owner

@janLo yes it does. The mobile app basically runs as a web app (electron is desktop only). Another approach would be to try to disable web security for the android app, but this still wouldn't work with the web app by itself (which is currently the only way to use it on iOS).

@janLo
Copy link
Contributor Author

janLo commented Feb 9, 2021

Thats a shame. It seems that the NC developers have "forgotten" the issue: nextcloud/server#3131

Thare are several workarounds (the app mentioned above - although it might need some change for Caldav, another app and a Nginx-config). I think the only way so far is to try to detect the cases when it will not work and point the user to this issue until they have a proper solution.

@janLo
Copy link
Contributor Author

janLo commented Feb 10, 2021

There is a working version in the PR above to test.

@johannesjo
Copy link
Owner

Any volunteers for testing this!?

@janLo
Copy link
Contributor Author

janLo commented Feb 17, 2021

@sunjam, @aracnus I consider this now as finished from my side. If you want to test it I can provide an AppImage build if you tell me your platform.

@sunjam
Copy link

sunjam commented Feb 17, 2021 via email

@janLo
Copy link
Contributor Author

janLo commented Feb 17, 2021

@sunjam this is a x86_64 linux AppImage Build.

@sunjam
Copy link

sunjam commented Feb 20, 2021

Apologies for delay as I ran into setup trouble on an Ubuntu desktop. I'm seeing a notification that there is a problem with my caldav. I generated a one-time password for access since it seems CORS is not needed in this case.

https://cloud.example.com/remote.php/dav/calendars/user/
is my base url. Taken from Calendar app.

Unsure on name of caldav resource. I tried adding by name:
Deck: Nextcloud Testing! is displayed in nc.

There is also a "private link" available, which I tried using
https://cloud.example.com/remote.php/dav/calendars/user/app-generated--deck--board-44/

Tried using app-generated--deck--board-44/ as the calendar name.

Haven't gotten it to work yet. Still a little unclear on how to to verify my settings are working properly. I'll try to figure out where logs are stored for the application. Thanks!

@janLo
Copy link
Contributor Author

janLo commented Feb 21, 2021

@sunjam I hope I can give some clarifications:

CORS seems to be an Issue regardless if you're using the one-time-password or your default one. There was discussion to add CORS-Support for app-passwords but as far as I know there was no change made. So you need this WebAppPassword app if you run into CORS issues.

If you're using the desktop-app, then CORS is never an issue, regardless of what credentials you use.

If you get the base url from the calendar app you have to use the copy-primary-address option and not the copy-ios/macos-address one. Your base address looks like you've used the ios/macos button. You need the other one for the cdav library. Simply delete everything after /dav.

The resource-name can be either the display-name or the name of the calendar itself. For a deck-calendar it would be either app-generated--deck--board-3 (without any /) or just the name as shown in the calendar-app.

This is btw the code quite simple that resolves calendars from resource-names: https://github.com/johannesjo/super-productivity/blob/master/src/app/features/issue/providers/caldav/caldav-client.service.ts#L171

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

No branches or pull requests

5 participants