From f420fe6e6d9e2d8bed8d747208d6c75b12647e46 Mon Sep 17 00:00:00 2001 From: Kayou Date: Tue, 5 Mar 2019 00:47:16 +0100 Subject: [PATCH] Add nextcloud support, and remove sed -i --- conf/carddav.config.inc.php | 90 ++++++++++++++++++++++--------------- scripts/install | 3 +- scripts/upgrade | 3 +- 3 files changed, 58 insertions(+), 38 deletions(-) diff --git a/conf/carddav.config.inc.php b/conf/carddav.config.inc.php index 75bd9a4..13c4509 100644 --- a/conf/carddav.config.inc.php +++ b/conf/carddav.config.inc.php @@ -1,41 +1,59 @@ 'Baïkal', -// 'username' => '%u', -// 'password' => '%p', -// 'url' => '{baikal_url}/card.php/addressbooks/%u/', -// -// // optional attributes -// 'active' => true, -// 'readonly' => false, -// 'refresh_time' => '00:05:00', -// -// 'fixed' => array('username', 'password'), -// 'hide' => false, -//); -//// END: baikal +/* PRESET FOR: baikal +$prefs['Baïkal'] = array( + // required attributes + 'name' => 'Baïkal', + 'username' => '%u', + 'password' => '%p', + 'url' => '{baikal_url}/card.php/addressbooks/%u/', -//// PRESET FOR: owncloud -//$prefs['ownCloud'] = array( -// // required attributes -// 'name' => 'ownCloud', -// 'username' => '%u', -// 'password' => '%p', -// 'url' => '{owncloud_url}/remote.php/dav/addressbooks/users/%u/default/', -// -// // optional attributes -// 'active' => true, -// 'readonly' => false, -// 'refresh_time' => '00:05:00', -// -// 'fixed' => array('username', 'password'), -// 'hide' => false, -//); -//// END: owncloud + // optional attributes + 'active' => true, + 'readonly' => false, + 'refresh_time' => '00:05:00', + + 'fixed' => array('username', 'password'), + 'hide' => false, +); +END: baikal */ + +/* PRESET FOR: owncloud +$prefs['ownCloud'] = array( + // required attributes + 'name' => 'ownCloud', + 'username' => '%u', + 'password' => '%p', + 'url' => '{owncloud_url}/remote.php/dav/addressbooks/users/%u/default/', + + // optional attributes + 'active' => true, + 'readonly' => false, + 'refresh_time' => '00:05:00', + + 'fixed' => array('username', 'password'), + 'hide' => false, +); +END: owncloud */ + +/* PRESET FOR: nextcloud +$prefs['NextCloud'] = array( + // required attributes + 'name' => 'nextCloud', + 'username' => '%u', + 'password' => '%p', + 'url' => '{nextcloud_url}/remote.php/dav/addressbooks/users/%u/contacts/', + + // optional attributes + 'active' => true, + 'readonly' => false, + 'refresh_time' => '00:05:00', + + 'fixed' => array('username', 'password'), + 'hide' => false, +); +END: nextcloud */ diff --git a/scripts/install b/scripts/install index 87df807..8cf810d 100644 --- a/scripts/install +++ b/scripts/install @@ -176,7 +176,8 @@ then carddav_path=$(ynh_app_setting_get $carddav_app_id path) carddav_url="https://${carddav_domain}${carddav_path%/}" ynh_replace_string "{${carddav_app}_url}" "$carddav_url" "$carddav_tmp_config" - sed -i "/\/\/\/\/ PRESET FOR: $carddav_app/,/\/\/\/\/ END: $carddav_app/s/^\/\///" "$carddav_tmp_config" + ynh_replace_string "/* PRESET FOR: $carddav_app" "" "$carddav_tmp_config" + ynh_replace_string "END: $carddav_app */" "" "$carddav_tmp_config" fi done diff --git a/scripts/upgrade b/scripts/upgrade index 61b6dca..d1eb374 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -202,7 +202,8 @@ then carddav_path=$(ynh_app_setting_get $carddav_app_id path) carddav_url="https://${carddav_domain}${carddav_path%/}" ynh_replace_string "{${carddav_app}_url}" "$carddav_url" "$carddav_tmp_config" - sed -i "/\/\/\/\/ PRESET FOR: $carddav_app/,/\/\/\/\/ END: $carddav_app/s/^\/\///" "$carddav_tmp_config" + ynh_replace_string "\/\* PRESET FOR: $carddav_app" "" "$carddav_tmp_config" + ynh_replace_string "END: $carddav_app \*\/" "" "$carddav_tmp_config" fi done