mirror of
https://github.com/YunoHost-Apps/shaarli_ynh.git
synced 2024-09-03 20:26:10 +02:00
Add the possibility of a private instance and update the README
This commit is contained in:
parent
6ceb1b5f1b
commit
0d78874af1
3 changed files with 36 additions and 6 deletions
11
README.md
11
README.md
|
@ -17,10 +17,17 @@ Help for dev/testing hightly appreciated :)
|
||||||
* Backup/restore scripts
|
* Backup/restore scripts
|
||||||
* Adding / removing a link
|
* Adding / removing a link
|
||||||
* Upgrade *not tested*
|
* Upgrade *not tested*
|
||||||
|
* Configure Shaarli during installation
|
||||||
|
|
||||||
|
## Installation information
|
||||||
|
|
||||||
|
When doing the installation you will be prompted if you want to have a public site, meaning that you don't have to be a user of this Yunohost instance to access the site.
|
||||||
|
|
||||||
|
You will also be asked if you want to have a private instance, meaning that the authentication will be deactivated and the application will be only available to the owner designed during install.
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
* Configure Shaarli during installation
|
* Integrate the ssowat authentication (currently the authentication is done by Shaarli)
|
||||||
* Test more the package
|
* Test more the package
|
||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
|
@ -40,8 +40,8 @@
|
||||||
"name": "admin",
|
"name": "admin",
|
||||||
"type": "user",
|
"type": "user",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Admin user",
|
"en": "Owner of the Shaarli instance",
|
||||||
"fr": "Administrateur"
|
"fr": "Proprietaire de l'instance Shaarli"
|
||||||
},
|
},
|
||||||
"example": "test"
|
"example": "test"
|
||||||
},
|
},
|
||||||
|
@ -80,6 +80,15 @@
|
||||||
},
|
},
|
||||||
"choices": ["Yes", "No"],
|
"choices": ["Yes", "No"],
|
||||||
"default": "Yes"
|
"default": "Yes"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "privateinstance",
|
||||||
|
"ask": {
|
||||||
|
"en": "Is the instance private?",
|
||||||
|
"fr": "Cette instance est elle privée ?"
|
||||||
|
},
|
||||||
|
"choices": ["Yes", "No"],
|
||||||
|
"default": "No"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,15 +23,22 @@ is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
title=$YNH_APP_ARG_TITLE
|
title=$YNH_APP_ARG_TITLE
|
||||||
privatelinkbydefault=$YNH_APP_ARG_PRIVATELINKBYDEFAULT
|
privatelinkbydefault=$YNH_APP_ARG_PRIVATELINKBYDEFAULT
|
||||||
password=$YNH_APP_ARG_PASSWORD
|
password=$YNH_APP_ARG_PASSWORD
|
||||||
|
privateinstance=$YNH_APP_ARG_PRIVATEINSTANCE
|
||||||
|
|
||||||
# Load common variables and helpers
|
# Load common variables and helpers
|
||||||
source ./_common.sh
|
source ./_common.sh
|
||||||
|
|
||||||
|
# Check that the options are compatible
|
||||||
|
if [ $is_public = "Yes" ]; then
|
||||||
|
if [ $privateinstance = "Yes" ] ; then
|
||||||
|
ynh_die "Incompatible options: the instance cannot be both public and private" 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Check that admin user is an existing account
|
# Check that admin user is an existing account
|
||||||
sudo yunohost user list --json | grep -q "\"username\": \"$admin\""
|
sudo yunohost user list --json | grep -q "\"username\": \"$admin\""
|
||||||
if [[ ! $? -eq 0 ]]; then
|
if [[ ! $? -eq 0 ]]; then
|
||||||
echo "Error : the chosen admin user does not exist"
|
ynh_die "Error : the chosen user does not exist" 1
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
sudo yunohost app setting $app admin -v $admin
|
sudo yunohost app setting $app admin -v $admin
|
||||||
|
|
||||||
|
@ -72,6 +79,10 @@ sudo sed -i "s@YNH_HASH@$password_hash@g" ../conf/config.json.php
|
||||||
sudo sed -i "s@YNH_TIMEZONE@$(cat /etc/timezone)@g" ../conf/config.json.php
|
sudo sed -i "s@YNH_TIMEZONE@$(cat /etc/timezone)@g" ../conf/config.json.php
|
||||||
sudo sed -i "s@YNH_TITLE@$title@g" ../conf/config.json.php
|
sudo sed -i "s@YNH_TITLE@$title@g" ../conf/config.json.php
|
||||||
sudo sed -i "s@YNH_PRIVATE_LINK_BY_DEFAULT@$privatelinkbydefault_php@g" ../conf/config.json.php
|
sudo sed -i "s@YNH_PRIVATE_LINK_BY_DEFAULT@$privatelinkbydefault_php@g" ../conf/config.json.php
|
||||||
|
# turn off authentication on the instance
|
||||||
|
if [ $privateinstance = "Yes" ] ; then
|
||||||
|
sudo sed -i "/open_shaarli/s/false/true/" ../conf/config.json.php
|
||||||
|
fi
|
||||||
|
|
||||||
# Populate the data directory of the shaarli instance
|
# Populate the data directory of the shaarli instance
|
||||||
sudo cp ../conf/config.json.php $final_path/data
|
sudo cp ../conf/config.json.php $final_path/data
|
||||||
|
@ -102,6 +113,9 @@ sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
# Reload Nginx and regenerate SSOwat conf
|
# Reload Nginx and regenerate SSOwat conf
|
||||||
if [ $is_public = "Yes" ]; then
|
if [ $is_public = "Yes" ]; then
|
||||||
sudo yunohost app setting $app unprotected_uris -v "/"
|
sudo yunohost app setting $app unprotected_uris -v "/"
|
||||||
|
elif [ $privateinstance = "Yes" ] ; then
|
||||||
|
# Configure SSOWat to prevent access for other users
|
||||||
|
sudo yunohost app setting $app allowed_users -v "$admin"
|
||||||
fi
|
fi
|
||||||
sudo service nginx reload
|
sudo service nginx reload
|
||||||
sudo yunohost app ssowatconf
|
sudo yunohost app ssowatconf
|
||||||
|
|
Loading…
Add table
Reference in a new issue