SabreDAV / CalDAV - not showing appointments
recently started my first MM project- to make it short; it’s working like a charm (even on first try).
I’m running a private Nextcloud installation (for those who don’t know it; it’s a private cloud solution that’s utilizing Sabre/DAV as CalDAV-server).
I want to show appointments of a specific (user-)calendar and found this MM-thread. Reading through the comments, I came up with the following URL for config.js (please note that I’m using a calendar that I made public):
If I open that URL in a browser (even if I’m not logged in -> public calendar), I get a well-formed .ICS-file.
As this didn’t work I also tried the “private” URL and provided user/pass (= app-token in that specific case) in the config.js!
Unfortunately both approaches lead to the same result; I can see the calendar module, but it seems it’s stuck in an endless-loop trying to fetch the calendar entris.
SSH-ing in + [pm2 logs] doesn’t show an error, but an output that a new calendar-fetcher for the specific given URL has been created.
Many thanks in advance for your time!
I implemented a workaround for this, which I wanted to share (just in case someone else faces the same problems).
I tried almost everything to get this thing running with the link (the direct link to the calendar didn’t work, but if I put the .ics file to a readable directory everything is fine).
The interesting thing is; even if I CURL’ that Nextcloud/Owncloud link, it shows me a well-formed calendar structure (so I can safely say that it hasn’t to do anything with user/pass combination, nor the fact that I’m using TFA (that’s why Nextcloud/Owncloud is providing app-PINs).
So, to get that thing working (as mentioned earlier by using a workaround), you need 2 things; a shell-script and a cronjob.
- A shell-script downloads the .ics given by the export-URL of Nextcloud/Owncloud and stores it in a directory which has to be accessible by your MM distribution.
The timestamp variable inherits the current UNIX timestamp in order to only retrieve calendar entries that are (right now or) in the future to keep the file-size small and MM’s calendar-fetcher performant. Please note that –http-user is defined without [ " ] and –http-password is defined with [ " ] - that’s no typo! If you’re using self-signed certificates, ensure that you’re using –no-check-certificate in order to avoid issues with certificate validation by WGET module.
- SSH’ in and type cd /usr/local/bin
- create a new shell-script with your desired editor by nano YOUR_SHELLSCRIPT_NAME.sh
- save that file after putting below code into it
- make it executable with chmod +x YOUR_SHELLSCRIPT_NAME.sh
- if you like, give it a first try
#!/bin/bash timestamp=$(date +%s) wget --no-check-certificate --output-document="YOUR_READABLE_DIRECTORY/YOUR_DESIRED_FILENAME.ics" --auth-no-challenge --http-user=YOUR_NEXTCLOUD_USER --http-password="YOUR_APP_PIN" "https://YOUR_NEXTCLOUD_IP/remote.php/dav/calendars/YOUR_NEXTCLOUD_USER/YOUR_NEXTCLOUDCALENDAR_NAME?export&start=$timestamp&componentType=VEVENT"
- I decided to run that shell-script every 30 minutes so my MM calendar display is updated twice per hour.
To do so, type crontab -e, add the following at the bottom and save;
# NEXTCLOUD Calendar Export 0,30 * * * * /usr/local/bin/YOUR_SHELLSCRIPT_NAME.sh
Of course you can use any cron you like!