diff --git a/conf/nginx.conf b/conf/nginx.conf index c9e580f..56d6c10 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,30 +1,39 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { - # Path to source - alias __FINALPATH__/; + # Path to source + alias __FINALPATH__/; - # Force usage of https - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } + # Force usage of https + if ($scheme = http) { + rewrite ^ https://$server_name$request_uri? permanent; + } - index index.php; - try_files $uri $uri/ /index.php; - location ~ [^/]\.php(/|$) { - fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; - include fastcgi_params; - fastcgi_param REMOTE_USER $remote_user; - fastcgi_param PATH_INFO $fastcgi_path_info; - fastcgi_param SCRIPT_FILENAME $request_filename; - fastcgi_param HTTPS on; - } + rewrite "^__PATH__/([a-zA-Z0-9-]+)$" "__PATH__/studs.php?poll=$1"; + rewrite "^__PATH__/([a-zA-Z0-9-]+)/action/([a-zA-Z_-]+)/(.+)$" "__PATH__/studs.php?poll=$1&$2=$3"; + rewrite "^__PATH__/([a-zA-Z0-9-]+)/vote/([a-zA-Z0-9]{16})$" "__PATH__/studs.php?poll=$1&vote=$2"; - # Include SSOWAT user panel. - include conf.d/yunohost_panel.conf.inc; + # Admin requires the private poll ID, 24-char long + rewrite "^__PATH__/([a-zA-Z0-9-]{24})/admin$" "__PATH__/adminstuds.php?poll=$1"; + rewrite "^__PATH__/([a-zA-Z0-9-]{24})/admin/vote/([a-zA-Z0-9]{16})$" "__PATH__/adminstuds.php?poll=$1&vote=$2"; + rewrite "^__PATH__/([a-zA-Z0-9-]{24})/admin/action/([a-zA-Z_-]+)(/(.+))?$" "__PATH__/adminstuds.php?poll=$1&$2=$4"; + + index index.php; + try_files $uri $uri/ /index.php; + location ~ [^/]\.php(/|$) { + fastcgi_split_path_info ^(.+?\.php)(/.*)$; + fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; + include fastcgi_params; + fastcgi_param REMOTE_USER $remote_user; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param SCRIPT_FILENAME $request_filename; + fastcgi_param HTTPS on; + } + + # Include SSOWAT user panel. + include conf.d/yunohost_panel.conf.inc; } location ~ ^__PATH__/(data|config|\.ht|db_structure\.xml|README) { - deny all; + deny all; } diff --git a/scripts/upgrade b/scripts/upgrade index c320bb3..d8f3d6b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -92,13 +92,6 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors -#================================================= -# CHECK THE PATH -#================================================= - -# Normalize the URL path syntax -path_url=$(ynh_normalize_url_path --path_url=$path_url) - #================================================= # STANDARD UPGRADE STEPS #=================================================