Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,16 @@ This utility is a fancy wrapper around `syncevolution` and `cron` and it creates
# How To Use

Configure server URLs, credentials, and naming preferences.
We assume that you can use non-sytandard NextCloud setup (different network port and 2FA enabled) so you need to provide:
- a real NC user (```USERNAME```)
- a Device credentials (```NCLOGIN```) (see https://docs.nextcloud.com/server/latest/user_manual/id/session_management.html)
- a network port that NC is accepting connections on (```NCPORT```) that defaults to 443

In case of a standard setup (default port and no 2FA enabled) ```USERNAME``` and ```NCLOGIN``` should be the same and ```PASSWORD``` is your NC user pass.

cp config-nextcloud-template.txt config-personal.txt
vim config-personal.txt
In order to login using your Device(App) password (thus not exposing your real NC user and pass and bypass oAuth) in current NC version (starting from NC 19) if a Device password is generated you are presented with a pair of login/password. Enter generated login in ```NCLOGIN``` and password in ```PASSWORD``` into your ```config-personal.txt```.

Executing `setup-dav-sync.sh --contacts config-personal.txt` or `setup-dav-sync.sh --calendar config-personal.txt` will read your configurations, connect to the specified carddav/caldav server, synchronize data and setup a cron job to keep this device in sync with the server.

Expand Down
6 changes: 4 additions & 2 deletions configs-template-nextcloud.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
declare -g USERNAME=''
declare -g NCLOGIN=''
declare -g NCPORT='443'
declare -g PASSWORD=''
DOMAIN='domain.tld'

###################################################################################################################################

declare -g CAL_URL="https://$DOMAIN/remote.php/dav/calendar/$USERNAME" # base URL shared between all calendars
declare -g CAL_URL="https://$DOMAIN:$NCPORT/remote.php/dav/calendar/$USERNAME" # base URL shared between all calendars

declare -ga CAL_NAMES CALENDAR_SERVER_CONFIG_NAMES CALENDAR_NAMES CALENDAR_VISUAL_NAMES

Expand All @@ -20,7 +22,7 @@ CALENDAR_VISUAL_NAMES[1]="${CAL_NAMES[1]} - nextcloud" # can NOT include th

###################################################################################################################################

declare -g CARD_URL="https://$DOMAIN/remote.php/dav/addressbooks/users/$USERNAME/contacts" # Currently Nextcloud has a single contact group for each user so this is the full URL
declare -g CARD_URL="https://$DOMAIN:$NCPORT/remote.php/dav/addressbooks/users/$USERNAME/contacts" # Currently Nextcloud has a single contact group for each user so this is the full URL

declare -ga CARD_NAMES CONTACTS_SERVER_CONFIG_NAMES CONTACTS_NAMES CONTACTS_VISUAL_NAMES

Expand Down
8 changes: 4 additions & 4 deletions setup-dav-sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,9 @@ function contacts {
database="$contacts_visual_names"

#Create Peer
#if (( ${#USERNAME} != 0 )) || (( ${#PASSWORD} != 0 )); then
#if (( ${#NCLOGIN} != 0 )) || (( ${#PASSWORD} != 0 )); then
if (( ${#PASSWORD} != 0 )); then
syncevolution --configure --template webdav username="$USERNAME" \
syncevolution --configure --template webdav username="$NCLOGIN" \
password="$PASSWORD" syncURL="$url" \
keyring=no "target-config@$contacts_server_config_names"
else
Expand Down Expand Up @@ -270,9 +270,9 @@ function calendar {
database="$calendar_visual_names"

#Create Peer
#if (( ${#USERNAME} != 0 )) || (( ${#PASSWORD} != 0 )); then
#if (( ${#NCLOGIN} != 0 )) || (( ${#PASSWORD} != 0 )); then
if (( ${#PASSWORD} != 0 )); then
syncevolution --configure --template webdav username="$USERNAME" \
syncevolution --configure --template webdav username="$NCLOGIN" \
password="$PASSWORD" syncURL="$url" keyring=no \
"target-config@$calendar_server_config_names"
else
Expand Down