diff --git a/README.md b/README.md index c1f7a24..8934eae 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/configs-template-nextcloud.txt b/configs-template-nextcloud.txt index 069fefa..0343596 100644 --- a/configs-template-nextcloud.txt +++ b/configs-template-nextcloud.txt @@ -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 @@ -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 diff --git a/setup-dav-sync.sh b/setup-dav-sync.sh index 461d3be..31531bd 100755 --- a/setup-dav-sync.sh +++ b/setup-dav-sync.sh @@ -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 @@ -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