From cf95b9c05ff74ede0d4956101466d8136e33fb54 Mon Sep 17 00:00:00 2001 From: Julien Malik Date: Tue, 1 Jul 2014 20:51:36 +0200 Subject: [PATCH 1/2] better auth, full-automatic install --- conf/activate_plugins.sql | 3 +++ conf/config.php | 4 +++- conf/yunohost_auth/plugin.php | 21 +++++++++++++++++++++ scripts/install | 18 +++++++++++++++++- 4 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 conf/activate_plugins.sql create mode 100644 conf/yunohost_auth/plugin.php diff --git a/conf/activate_plugins.sql b/conf/activate_plugins.sql new file mode 100644 index 0000000..19ea0da --- /dev/null +++ b/conf/activate_plugins.sql @@ -0,0 +1,3 @@ +INSERT INTO `yourls_options` ( `option_name`, `option_value`) VALUES +('active_plugins', 'a:1:{i:0;s:24:"yunohost_auth/plugin.php";}'); + diff --git a/conf/config.php b/conf/config.php index f1e8f35..a360aef 100644 --- a/conf/config.php +++ b/conf/config.php @@ -57,7 +57,7 @@ define( 'YOURLS_COOKIEKEY', 'modify this text with something random' ); ** YOURLS will auto encrypt plain text passwords in this file ** Read http://yourls.org/userpassword for more information */ $yourls_user_passwords = array( - 'yourlsuser' => 'yourlspass' // You can have one or more 'login'=>'password' lines + // 'yourlsuser' => 'yourlspass' // You can have one or more 'login'=>'password' lines ); /** Debug mode to output some internal information @@ -88,3 +88,5 @@ $yourls_reserved_URL = array( ** Personal settings would go after here. */ +define( 'YOURLS_YUNOHOST_AUTH_ADMIN', 'yourlsuser' ); + diff --git a/conf/yunohost_auth/plugin.php b/conf/yunohost_auth/plugin.php new file mode 100644 index 0000000..e684c9d --- /dev/null +++ b/conf/yunohost_auth/plugin.php @@ -0,0 +1,21 @@ + /dev/null 2>&1 + +# Activate auth plugin +mysql -u $db_user -p$db_pwd $db_user < ../conf/activate_plugins.sql + +#sudo yunohost app setting yourls skipped_uris -d +#sudo yunohost app setting yourls unprotected_uris -v "/admin" + +sudo service nginx reload +sudo yunohost app ssowatconf + From 90e74a1314d7dbda509a5f0ae8e0268f091f462f Mon Sep 17 00:00:00 2001 From: Julien Malik Date: Tue, 1 Jul 2014 20:56:36 +0200 Subject: [PATCH 2/2] no need for upload_password anymore --- conf/config.php | 1 - manifest.json | 14 +++----------- scripts/install | 3 --- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/conf/config.php b/conf/config.php index a360aef..e01ce43 100644 --- a/conf/config.php +++ b/conf/config.php @@ -57,7 +57,6 @@ define( 'YOURLS_COOKIEKEY', 'modify this text with something random' ); ** YOURLS will auto encrypt plain text passwords in this file ** Read http://yourls.org/userpassword for more information */ $yourls_user_passwords = array( - // 'yourlsuser' => 'yourlspass' // You can have one or more 'login'=>'password' lines ); /** Debug mode to output some internal information diff --git a/manifest.json b/manifest.json index e6e93b6..576af17 100644 --- a/manifest.json +++ b/manifest.json @@ -2,8 +2,8 @@ "name": "Yourls", "id": "yourls", "description": { - "en": "a URL shortening service", - "fr": "un service de raccourcisseur d'url" + "en": "An URL shortening service", + "fr": "Un service de raccourcisseur d'url" }, "developer": { "name": "courgette", @@ -34,17 +34,9 @@ "name": "admin", "ask": { "en": "Choose the Yourls administrator (must be an existing YunoHost user)", - "fr": "Administrateur du site (doit être un utilisateur Yunohost existant)" + "fr": "Administrateur du site Yourls (doit être un utilisateur Yunohost existant)" }, "example": "yoda" - }, - { - "name": "upload_password", - "ask": { - "en": "Set the password granting upload permissions (leave empty to allow anybody to upload)", - "fr": "Choisissez le password pour autoriser l'upload (laissez vide pour autorisé tout le monde)" - }, - "example": "supersecretpassword" } ] diff --git a/scripts/install b/scripts/install index 74e0010..ec14b90 100644 --- a/scripts/install +++ b/scripts/install @@ -4,7 +4,6 @@ domain=$1 path=$2 admin_user=$3 -upload_password=$4 # Check domain/path availability sudo yunohost app checkurl $domain$path -a yourls @@ -46,10 +45,8 @@ sudo sed -i "s/yunopass/$db_pwd/g" $final_path/user/config.php sudo sed -i "s/yunobase/$db_user/g" $final_path/user/config.php sudo sed -i "s/yunodomain/$domain/g" $final_path/user/config.php sudo sed -i "s/yourlsuser/$admin_user/g" $final_path/user/config.php -sudo sed -i "s/yourlspass/$upload_password/g" $final_path/user/config.php sudo sed -i "s/_yourlspath$path/g" $final_path/user/config.php - # Set permissions sudo chown -R www-data: $final_path