1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/yourls_ynh.git synced 2024-09-03 20:35:59 +02:00

better auth, full-automatic install

This commit is contained in:
Julien Malik 2014-07-01 20:51:36 +02:00
parent e273af422e
commit cf95b9c05f
4 changed files with 44 additions and 2 deletions

View file

@ -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";}');

View file

@ -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' );

View file

@ -0,0 +1,21 @@
<?php
/*
Plugin Name: YunoHost Auth plugin
Plugin URI: http://yourls.org/
Description: Authentification plugin for YunoHost
Version: 0.1
Author: ju
Author URI: http://github.com/julienmalik
*/
// No direct call
if( !defined( 'YOURLS_ABSPATH' ) ) die();
yourls_add_filter( 'shunt_is_valid_user', 'yunohost_auth_is_valid_user' );
function yunohost_auth_is_valid_user( $value ) {
return $_SERVER['PHP_AUTH_USER'] == YOURLS_YUNOHOST_AUTH_ADMIN;
}
/* And that's it. Activate the plugin and notice how the page title changes */

View file

@ -36,6 +36,8 @@ sudo mkdir -p $final_path
sudo cp -a ../sources/* $final_path
sudo cp ../conf/index.php $final_path/
sudo cp -r ../conf/yunohost_auth $final_path/user/plugins
# Change variable in yourls configuration
sudo cp ../conf/config.php $final_path/user/config.php
@ -62,4 +64,18 @@ sudo chmod 600 $nginxconf
# Reload Nginx and regenerate SSOwat conf
sudo service nginx reload
sudo yunohost app setting yourls unprotected_uris -v "/"
sudo yunohost app ssowatconf
# Start Yourls install (database table creation)
curl -kL -X POST https://$domain$path/admin/install.php --data "install=dummy" > /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