diff --git a/conf/config.php b/conf/config.php index 021f150..7f954de 100644 --- a/conf/config.php +++ b/conf/config.php @@ -1,4 +1,5 @@ 'production', 'salt' => 'yunosalt', @@ -18,4 +19,5 @@ return array ( 'allow_anonymous_refresh' => false, 'unsafe_autologin_enabled' => false, 'api_enabled' => true, + 'extensions_enabled' => array(), ); \ No newline at end of file diff --git a/hooks/post_app_addaccess b/hooks/post_app_addaccess index 2b0ff50..06478ef 100755 --- a/hooks/post_app_addaccess +++ b/hooks/post_app_addaccess @@ -16,7 +16,8 @@ then echo "Detected wallabag" wallabagPath=$(sudo yunohost app setting wallabag path) wallabagUrl=$domain$wallabagPath - sharingWallabag="array('type' => 'wallabag','name' => 'Wallabag','url' => 'https://$wallabagUrl',)," + sharingWallabag="'sharing' => \n\tarray( \n\t\t0 => \n\t\tarray(\n\t\t\t'type' => 'wallabag',\n\t\t\t'name' => 'Wallabag',\n\t\t\t'url' => 'https://$wallabagUrl',\n\t\t)," + sharingEnable=1 fi for myuser in $(echo "$new_users" | sed "s/,/ /g") @@ -30,14 +31,14 @@ then mysql -u $db_user -p$db_pwd $db_user < /tmp/$myuser-install.sql #remove temp sql sudo rm /tmp/$myuser-install.sql + #copy default conf - sudo mkdir $app_path/data/$myuser/ - sudo cp $app_path/data/user.php.dist $app_path/data/users/$myuser/config.php - #change username - sudo sed -i "s/YnoUser/$myuser/g" $app_path/data/users/$myuser/config.php - #add wallabag sharing - sudo sed -i "s@sharingArrayYnh@$sharingWallabag@g" $app_path/data/users/$myuser/config.php - touch $app_path/data/users/$myuser/log.txt - chown www-data: $app_path/data/users/$myuser -R + sudo cp -r $app_path/data/users/_ $app_path/data/users/$myuser/ + sudo mv $app_path/data/users/$myuser/config.default.php $app_path/data/users/$myuser/config.php + #add wallabag sharing + if [[ $sharingEnable -eq 1 ]]; then + sudo sed -i "s@'sharing'\ =>\ array\ (@$sharingWallabag@g" $app_path/data/users/$myuser/config.php + fi + sudo chown -R www-data: $app_path/data/users/$myuser/ done fi \ No newline at end of file diff --git a/hooks/post_user_create b/hooks/post_user_create index 77116ef..a5f2de7 100755 --- a/hooks/post_user_create +++ b/hooks/post_user_create @@ -12,7 +12,8 @@ if [[ $(sudo yunohost app list -f wallabag | /bin/grep -q "installed: True") -eq echo "Detected wallabag" $wallabagPath=$(sudo yunohost app setting wallabag path) $wallabagUrl=$domain$wallabagPath - $sharingWallabag="array('type' => 'wallabag','name' => 'Wallabag','url' => 'https://$wallabagUrl',)," + $sharingWallabag="'sharing' => \n\tarray( \n\t\t0 => \n\t\tarray(\n\t\t\t'type' => 'wallabag',\n\t\t\t'name' => 'Wallabag',\n\t\t\t'url' => 'https://$wallabagUrl',\n\t\t)," + $sharingEnable=1 fi @@ -25,12 +26,10 @@ mysql -u $db_user -p$db_pwd $db_user < /tmp/$myuser-install.sql #remove temp sql sudo rm /tmp/$myuser-install.sql #copy default conf -#copy default conf -sudo mkdir $app_path/data/users/$myuser/ -sudo cp $app_path/data/user.php.dist $app_path/data/users/$myuser/config.php -#change username -sudo sed -i "s/YnoUser/$myuser/g" $app_path/data/users/$myuser/config.php +sudo cp -r $app_path/data/users/_ $app_path/data/users/$myuser/ +sudo mv $app_path/data/users/$myuser/config.default.php $app_path/data/users/$myuser/config.php #add wallabag sharing -sudo sed -i "s/sharingArrayYnh/$sharingWallabag/g" $app_path/data/users/$myuser/config.php -sudo touch $app_path/data/users/users/$myuser/log.txt +if [[ $sharingEnable -eq 1 ]]; then + sudo sed -i "s@'sharing'\ =>\ array\ (@$sharingWallabag@g" $app_path/data/users/$myuser/config.php +fi sudo chown -R www-data: $app_path/data/users/$myuser/ \ No newline at end of file