forked from Krautspace/webseite-krautspace
add nextcloud public calendar export
This commit is contained in:
parent
01fcc976ba
commit
8e9e6d37fc
4 changed files with 27 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
events.json
|
5
bin/calendar-events-exporter.sh
Executable file
5
bin/calendar-events-exporter.sh
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
curl -sH "Accept: application/calendar+json" "https://cloud.kraut.space/remote.php/dav/public-calendars/2EkPGt3PF6WwYsA3?export&expand=1&start=$(date -d "" +%s)&end=$(date -d "next month" +%s)" \
|
||||||
|
| jq -r '.[2] | map({_type: .[0]} + (.[1] | map({key: .[0], value: .[3]}) | from_entries))' \
|
||||||
|
> ./events.json
|
12
etc/systemd/calendar-events-exporter.service
Normal file
12
etc/systemd/calendar-events-exporter.service
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Dumps calendar events from nextcloud into usable json
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart=/usr/bin/bash /var/www/kraut.space/bin/calendar-events-exporter.sh
|
||||||
|
|
||||||
|
User=www-data
|
||||||
|
Group=www-data
|
||||||
|
|
||||||
|
WorkingDirectory=/var/www/kraut.space
|
9
etc/systemd/calendar-events-exporter.timer
Normal file
9
etc/systemd/calendar-events-exporter.timer
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
[Unit]
|
||||||
|
Description=timer for automatic refresh of calendar export
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
# execute at the second minute of every hour, and repeat every 5 minutes
|
||||||
|
OnCalendar=*:2/5
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
Loading…
Reference in a new issue