diff --git a/conf/nginx.conf b/conf/nginx.conf index fe41442..1e34e7b 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -16,11 +16,26 @@ location PATHTOCHANGE { fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $request_filename; } + + location ^~ /bin/ { + 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]+)/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 ) { 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 conf.d/yunohost_panel.conf.inc; diff --git a/scripts/install b/scripts/install index 401c768..0b423b8 100644 --- a/scripts/install +++ b/scripts/install @@ -7,6 +7,9 @@ admin_ampache=$3 debianversionname=$(lsb_release -a | grep Codename | awk -F' ' '{print $2}') +# Remove trailing "/" for next commands +path=${path%/} + # Check domain/path availability sudo yunohost app checkurl $domain$path -a ampache if [[ ! $? -eq 0 ]]; then @@ -49,7 +52,7 @@ 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') 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 # Modify Nginx configuration file and copy it to Nginx conf directory