Set up vdirsyncer to sync with Nextcloud (onion). Make Khal sync with vdirsyncer.
Closed this issue · 4 comments
https://github.com/pimutils/vdirsyncer
Syncs the directories.
Then Khal syncs with the vsyncer directory locally.
Explanations and example configs:
https://www.dj-bauer.de/terminal-calendar-with-khal-en.html
https://www.dioptricdesign.com/2020/03/01/khal-a-tui-calendar-procrastination-in-python/
Follow:
https://gideonwolfe.com/posts/sysadmin/nextcloud/nextcloudworkflow/
Note for self.
For those reading this, a working configuration for self-signed certificates was found and is included below. untitaker suggested a method, and this documentation shows another under "Custom Root CA;s).
I used self-signed certificates for https for a self-hosted Nextcloud server over tor. So to connect to that (locally), I had to add the Root CA I used for that https to vdirsyncer. That can be done as follows:
[general]
status_path = "~/.config/vdirsyncer/status/"
[pair my_contacts]
a = "my_contacts_local"
b = "my_contacts_remote"
collections = ["from a", "from b"]
conflict_resolution = "b wins"
[storage my_contacts_local]
type = "filesystem"
path = "~/Documents/Contacts/"
fileext = ".vcf"
[storage my_contacts_remote]
type = "carddav"
verify = "/home/name/git/Hiveminds/Collabora-Online/ca.pem"
# We can simplify this URL here as well. In theory it shouldn't matter.
url = "https://localhost"
username = "your_username
password = "your_password"
[pair my_calendar]
a = "my_calendar_local"
b = "my_calendar_remote"
collections = ["from a", "from b"]
conflict_resolution = "b wins"
[storage my_calendar_local]
type = "filesystem"
path = "~/Documents/Calendar/"
fileext = ".ics"
[storage my_calendar_remote]
type = "caldav"
verify = "/home/name/git/Hiveminds/Collabora-Online/ca.pem"
# We can simplify this URL here as well. In theory it shouldn't matter.
url = "https://localhost"
username = "your_username"
password = "your_password"
Note that the extension of the Root CA should be .pem
and not .crt
. Next one can initiate the sync with:
vdirsyncer discover my_calendar
And that creates multiple collections, one per calendar that you have in your Nextcloud server.
- TODO: prompt with yes for each calendar.
Then for Khal either run:
sudo apt install khal -y
khal configure
And answer the prompts.
Or (better, cause default method does not find vdirsyncer
directories) copy:
[calendars]
[[my_calendar_local]]
path = ~/Documents/Calendar/*
type = discover
[[my_contacts_local]]
path = ~/Documents/Contacts/*
type = discover
[locale]
timeformat = %H:%M
dateformat = %Y-%m-%d
longdateformat = %Y-%m-%d
datetimeformat = %Y-%m-%d %H:%M
longdatetimeformat = %Y-%m-%d %H:%M
[default]
highlight_event_days = True
show_all_days = True
[view]
frame = color
theme = dark
[highlight_days]
color = ''
default_color = yellow
method = foreground
multiple = ''
into:
~/.config/khal/config
Then run, for example:
khal calendar
to use it.
one can replace:
https://localhost
with:
https://some_onion.onion
in the ~/.config/vdirsyncer/config
file, and run:
torify vdirsyncer discover my_contacts
torify vdirsyncer discover my_calendar
torify vdirsyncer sync
To run vdirsyncer it over tor! Khal usage stays the same, because that works with the local folders of vdirsyncer.
Done.