1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ampache_ynh.git synced 2024-09-03 18:15:55 +02:00

Merge pull request #11 from stevenroose/master

Several improvements
This commit is contained in:
abeudin 2015-08-30 08:52:16 +02:00
commit cd3c01888a
5 changed files with 99 additions and 20 deletions

View file

@ -1,6 +1,6 @@
INSERT INTO user(id,username,fullname,access) VALUES("", "yunoadmin", "yunoadmin", "100"); INSERT INTO user(id,username,fullname,access) VALUES("", "yunoadmin", "yunoadmin", "100");
UPDATE `user_preference` SET `value` = 'fr_FR' WHERE `preference` = 31 ; UPDATE `user_preference` SET `value` = 'en_US' WHERE `preference` = 31 ;
SET @lastid = LAST_INSERT_ID(); SET @lastid = LAST_INSERT_ID();
@ -14,7 +14,7 @@ INSERT INTO `user_preference` (`user`, `preference`, `value`) VALUES
(@lastid, 25, '80'), (@lastid, 25, '80'),
(@lastid, 41, 'mpd'), (@lastid, 41, 'mpd'),
(@lastid, 29, 'web_player'), (@lastid, 29, 'web_player'),
(@lastid, 31, 'fr_FR'), (@lastid, 31, 'en_US'),
(@lastid, 32, 'm3u'), (@lastid, 32, 'm3u'),
(@lastid, 33, 'reborn'), (@lastid, 33, 'reborn'),
(@lastid, 34, '27'), (@lastid, 34, '27'),

View file

@ -62,7 +62,7 @@ database_password = "yunopass"
; Cryptographic secret ; Cryptographic secret
; This MUST BE changed with your own secret key. Ampache-specific, just pick any random string you want. ; This MUST BE changed with your own secret key. Ampache-specific, just pick any random string you want.
secret_key = "abcdefghijklmnoprqstuvwyz0123456" secret_key = "RANDOMKEYTOCHANGE"
; Length that a session will last expressed in seconds. Default is ; Length that a session will last expressed in seconds. Default is
; one hour. ; one hour.
@ -102,7 +102,7 @@ session_cookiesecure = 0
; If auto_create isn't enabled the user must exist locally. ; If auto_create isn't enabled the user must exist locally.
; DEFAULT: mysql ; DEFAULT: mysql
; VALUES: mysql,ldap,http,pam,external,openid ; VALUES: mysql,ldap,http,pam,external,openid
auth_methods = "http,mysql" auth_methods = "ldap"
; External authentication ; External authentication
; This sets the helper used for external authentication. It should conform to ; This sets the helper used for external authentication. It should conform to
@ -120,7 +120,7 @@ auth_methods = "http,mysql"
; Logout redirection target ; Logout redirection target
; Defaults to our own login.php, but we can override it here if, for instance, ; Defaults to our own login.php, but we can override it here if, for instance,
; we want to redirect to an SSO provider instead. ; we want to redirect to an SSO provider instead.
logout_redirect = "https://DOMAINTOCHANGE/yunohost/sso/?action=logout" ; logout_redirect = "https://DOMAINTOCHANGE/yunohost/sso/?action=logout"
;##################### ;#####################
; Program Settings # ; Program Settings #
@ -216,7 +216,7 @@ require_localnet_session = "true"
; still need to enabled downloading for the specific user you ; still need to enabled downloading for the specific user you
; want to be able to use this function ; want to be able to use this function
; DEFAULT: false ; DEFAULT: false
;allow_zip_download = "false" allow_zip_download = "true"
Allow Zip Types Allow Zip Types
; This setting allows/disallows zip download of specific object types ; This setting allows/disallows zip download of specific object types
@ -224,7 +224,7 @@ Allow Zip Types
; Otherwise, only the given object list can be zipped. ; Otherwise, only the given object list can be zipped.
; POSSIBLE VALUES: artist, album, playlist, search, tmp_playlist ; POSSIBLE VALUES: artist, album, playlist, search, tmp_playlist
; DEFAULT: none ; DEFAULT: none
;allow_zip_types = "album" allow_zip_types = "artist,album,playlist"
; File Zip Comment ; File Zip Comment
; This is an optional configuration option that adds a comment ; This is an optional configuration option that adds a comment
@ -275,16 +275,16 @@ getid3_tag_order = "id3v2,id3v1,vorbiscomment,quicktime,matroska,ape,asf,avi,mpe
; This determines if file metadata should be write back to files ; This determines if file metadata should be write back to files
; as id3 metadata when updated. ; as id3 metadata when updated.
; DEFAULT: false ; DEFAULT: false
;write_id3 = "false" write_id3 = "true"
; This determines if album art should be write back to files ; This determines if album art should be write back to files
; as id3 metadata when updated. ; as id3 metadata when updated.
; DEFAULT: false ; DEFAULT: false
;write_id3_art = "false" write_id3_art = "true"
; This determines if catalog manager users can delete medias from disk. ; This determines if catalog manager users can delete medias from disk.
; DEFAULT: false ; DEFAULT: false
;delete_from_disk = "false" delete_from_disk = "true"
; This determines the order in which metadata sources are used (and in the ; This determines the order in which metadata sources are used (and in the
; case of plugins, checked) ; case of plugins, checked)
@ -613,13 +613,13 @@ show_footer_statistics = "true"
; For OpenLDAP use "uid" ; For OpenLDAP use "uid"
; For Microsoft Active Directory (MAD) use "sAMAccountName" ; For Microsoft Active Directory (MAD) use "sAMAccountName"
; DEFAULT: null ; DEFAULT: null
;ldap_filter = "(sAMAccountName=%v)" ldap_filter = "(uid=%v)"
; LDAP objectclass (required) ; LDAP objectclass (required)
; OpanLDAP objectclass = "*" ; OpanLDAP objectclass = "*"
; MAD objectclass = "organizationalPerson" ; MAD objectclass = "organizationalPerson"
; DEFAULT null ; DEFAULT null
ldap_objectclass = "posixAccount" ldap_objectclass = "mailAccount"
; Initial credentials to bind with for searching (optional) ; Initial credentials to bind with for searching (optional)
; DEFAULT: null ; DEFAULT: null
@ -632,7 +632,7 @@ ldap_objectclass = "posixAccount"
; This is the search dn used to find users (required) ; This is the search dn used to find users (required)
; DEFAULT: null ; DEFAULT: null
ldap_search_dn = "dc=yunohost,dc=org" ldap_search_dn = "ou=users,dc=yunohost,dc=org"
; This is the address of your ldap server (required) ; This is the address of your ldap server (required)
; DEFAULT: null ; DEFAULT: null
@ -670,7 +670,7 @@ auto_create = "true"
; sign up for an account on your server. ; sign up for an account on your server.
; REMEMBER: don't forget to set the mail from address further down in the config. ; REMEMBER: don't forget to set the mail from address further down in the config.
; DEFAULT: false ; DEFAULT: false
;allow_public_registration = "false" allow_public_registration = "false"
; Require Captcha Text on Image confirmation ; Require Captcha Text on Image confirmation
; Turning this on requires the user to correctly ; Turning this on requires the user to correctly
@ -984,4 +984,3 @@ force_ssl = "true"
; so that the ordering is sane. ; so that the ordering is sane.
; DEFAULT: auto ; DEFAULT: auto
;mb_detect_order = "ASCII,UTF-8,EUC-JP,ISO-2022-JP,SJIS,JIS" ;mb_detect_order = "ASCII,UTF-8,EUC-JP,ISO-2022-JP,SJIS,JIS"

View file

@ -17,11 +17,31 @@ location PATHTOCHANGE {
fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param SCRIPT_FILENAME $request_filename;
} }
location ^~ /bin/ {
deny all;
return 403;
}
location ^~ /config/ {
deny all;
return 403;
}
rewrite ^PATHTOCHANGE/play/ssid/(\w+)/type/(\w+)/oid/([0-9]+)/uid/([0-9]+)/name/(.*)$ PATHTOCHANGE/play/index.php?ssid=$1&type=$2&oid=$3&uid=$4&name=$5 last; rewrite ^PATHTOCHANGE/play/ssid/(\w+)/type/(\w+)/oid/([0-9]+)/uid/([0-9]+)/name/(.*)$ PATHTOCHANGE/play/index.php?ssid=$1&type=$2&oid=$3&uid=$4&name=$5 last;
rewrite ^PATHTOCHANGE/play/ssid/(\w+)/type/(\w+)/oid/([0-9]+)/uid/([0-9]+)/client/(.*)/noscrobble/([0-1])/name/(.*)$ PATHTOCHANGE/play/index.php?ssid=$1&type=$2&oid=$3&uid=$4&client=$5&noscrobble=$6&name=$7 last;
#enable subsonic api
if ( !-d $request_filename ) { if ( !-d $request_filename ) {
rewrite ^PATHTOCHANGE/rest/(.*)\.view$ PATHTOCHANGE/rest/index.php?action=$1 last; rewrite ^PATHTOCHANGE/rest/(.*)\.view$ PATHTOCHANGE/rest/index.php?action=$1 last;
rewrite ^PATHTOCHANGE/rest/fake/(.+)$ PATHTOCHANGE/play/$1 last;
} }
location /rest {
limit_except GET POST {
deny all;
}
}
# Include SSOWAT user panel. # Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc; # include conf.d/yunohost_panel.conf.inc;
} }

View file

@ -44,10 +44,12 @@ sudo sed -i "s/yunouser/$db_user/g" $final_path/config/ampache.cfg.php
sudo sed -i "s/yunopass/$db_pwd/g" $final_path/config/ampache.cfg.php sudo sed -i "s/yunopass/$db_pwd/g" $final_path/config/ampache.cfg.php
sudo sed -i "s/yunobase/$db_user/g" $final_path/config/ampache.cfg.php sudo sed -i "s/yunobase/$db_user/g" $final_path/config/ampache.cfg.php
sudo sed -i "s/yunoadmin/$admin_ampache/g" /tmp/admin.sql sudo sed -i "s/yunoadmin/$admin_ampache/g" /tmp/admin.sql
sed -i "s@PATHTOCHANGE@$path@g" $final_path/config/ampache.cfg.php sudo sed -i "s@PATHTOCHANGE@${path%/}@g" $final_path/config/ampache.cfg.php
sed -i "s@DOMAINTOCHANGE@$domain@g" $final_path/config/ampache.cfg.php sudo sed -i "s@DOMAINTOCHANGE@$domain@g" $final_path/config/ampache.cfg.php
random_key=db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p')
sudo sed -i "s@RANDOMKEYTOCHANGE@$random_key@g" $final_path/config/ampache.cfg.php
# Set permissions to roundcube directory # Set permissions to ampache directory
sudo chown -R www-data: $final_path sudo chown -R www-data: $final_path
# Modify Nginx configuration file and copy it to Nginx conf directory # Modify Nginx configuration file and copy it to Nginx conf directory
@ -61,10 +63,13 @@ sudo service nginx reload
sudo yunohost app setting ampache skipped_uris -v "/" sudo yunohost app setting ampache skipped_uris -v "/"
sudo yunohost app ssowatconf sudo yunohost app ssowatconf
# Install dependency
sudo apt-get install ffmpeg -y
# Ampache installation # Ampache installation
echo "127.0.0.1 $domain #yunoampache" | sudo tee -a /etc/hosts echo "127.0.0.1 $domain #yunoampache" | sudo tee -a /etc/hosts
sleep 1 sleep 1
curl -kL -X POST http://$domain$path/update.php?action=update > /dev/null 2>&1 curl -kL -X POST http://$domain${path%/}/update.php?action=update > /dev/null 2>&1
sleep 5 sleep 5
[ "$debianversionname" == "wheezy" ] && \ [ "$debianversionname" == "wheezy" ] && \
sudo sed -i 's/;transcode_cmd = "ffmpeg"/transcode_cmd = "ffmpeg"/g' /var/www/ampache/config/ampache.cfg.php && \ sudo sed -i 's/;transcode_cmd = "ffmpeg"/transcode_cmd = "ffmpeg"/g' /var/www/ampache/config/ampache.cfg.php && \

55
scripts/upgrade Normal file
View file

@ -0,0 +1,55 @@
#!/bin/bash
debianversionname=$(lsb_release -a | grep Codename | awk -F' ' '{print $2}')
# Retrieve arguments
domain=$(sudo yunohost app setting ampache domain)
path=$(sudo yunohost app setting ampache path)
db_user=ampache
db_pwd=$(sudo yunohost app setting ampache mysqlpwd)
admin_ampache=$(sudo yunohost app setting ampache admin)
# first make a copy of the db
# mysqldump -u $db_user -p$db_pwd --add-drop-table --allow-keywords ampache > $final_path/ampache-db-backup.sql
# Copy files to the right place
final_path=/var/www/ampache
sudo cp -a ../sources/* $final_path
sudo cp ../conf/ampache.cfg.php $final_path/config/ampache.cfg.php
# Change variables in Ampache configuration
sudo sed -i "s/yunouser/$db_user/g" $final_path/config/ampache.cfg.php
sudo sed -i "s/yunopass/$db_pwd/g" $final_path/config/ampache.cfg.php
sudo sed -i "s/yunobase/$db_user/g" $final_path/config/ampache.cfg.php
sudo sed -i "s@PATHTOCHANGE@${path%/}@g" $final_path/config/ampache.cfg.php
sudo sed -i "s@DOMAINTOCHANGE@$domain@g" $final_path/config/ampache.cfg.php
# Set permissions to roundcube directory
sudo chown -R www-data: $final_path
# Modify Nginx configuration file and copy it to Nginx conf directory
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf*
sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf*
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/ampache.conf
# Reload Nginx and regenerate SSOwat conf
sudo service nginx reload
sudo yunohost app setting ampache skipped_uris -v "/"
sudo yunohost app ssowatconf
# Ampache installation
echo "127.0.0.1 $domain #yunoampache" | sudo tee -a /etc/hosts
sleep 1
curl -kL -X POST http://$domain${path%/}/update.php?action=update > /dev/null 2>&1
sleep 5
[ "$debianversionname" == "wheezy" ] && \
sudo sed -i 's/;transcode_cmd = "ffmpeg"/transcode_cmd = "ffmpeg"/g' /var/www/ampache/config/ampache.cfg.php && \
sudo sed -i 's/^transcode_cmd = "avconv"/;transcode_cmd = "avconv"/g' /var/www/ampache/config/ampache.cfg.php
sudo yunohost app setting ampache skipped_uris -d
sudo yunohost app setting ampache skipped_uris -v "/rest"
sudo yunohost app ssowatconf
sudo sed '/yunoampache/d' /etc/hosts > /tmp/hosts.tmp
sudo cp /tmp/hosts.tmp /etc/hosts ; sudo rm -f /tmp/hosts.tmp