1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/opensondage_ynh.git synced 2024-09-03 19:46:28 +02:00

Merge pull request #79 from YunoHost-Apps/testing

Testing
This commit is contained in:
Alexandre Aubin 2021-12-02 03:11:03 +01:00 committed by GitHub
commit fa51b6dbcf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 159 additions and 89 deletions

View file

@ -15,9 +15,9 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
## Overview ## Overview
Service for planning an appointment or making a decision quickly and easily OpenSondage is an online service for planning an appointment or making a decision quickly and easily. No registration is required.
**Shipped version:** 1.1.16~ynh1 **Shipped version:** 1.1.17~ynh1
**Demo:** https://framadate.org/ **Demo:** https://framadate.org/
@ -39,7 +39,6 @@ Service for planning an appointment or making a decision quickly and easily
## Documentation and resources ## Documentation and resources
* Official app website: https://framadate.org/ * Official app website: https://framadate.org/
* Official user documentation: https://yunohost.org/#/app_opensondage
* Official admin documentation: https://framagit.org/framasoft/framadate/framadate/wikis/home * Official admin documentation: https://framagit.org/framasoft/framadate/framadate/wikis/home
* Upstream app code repository: https://git.framasoft.org/framasoft/framadate * Upstream app code repository: https://git.framasoft.org/framasoft/framadate
* YunoHost documentation for this app: https://yunohost.org/app_opensondage * YunoHost documentation for this app: https://yunohost.org/app_opensondage

View file

@ -11,9 +11,9 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
## Vue d'ensemble ## Vue d'ensemble
Service pour planifier un rendez-vous ou prendre une décision rapidement et facilement OpenSondage est un service en ligne permettant de planifier un rendez-vous ou prendre des décisions rapidement et simplement. Aucune inscription préalable nest nécessaire.
**Version incluse :** 1.1.16~ynh1 **Version incluse :** 1.1.17~ynh1
**Démo :** https://framadate.org/ **Démo :** https://framadate.org/
@ -35,7 +35,6 @@ Service pour planifier un rendez-vous ou prendre une décision rapidement et fac
## Documentations et ressources ## Documentations et ressources
* Site officiel de l'app : https://framadate.org/ * Site officiel de l'app : https://framadate.org/
* Documentation officielle utilisateur : https://yunohost.org/#/app_opensondage
* Documentation officielle de l'admin : https://framagit.org/framasoft/framadate/framadate/wikis/home * Documentation officielle de l'admin : https://framagit.org/framasoft/framadate/framadate/wikis/home
* Dépôt de code officiel de l'app : https://git.framasoft.org/framasoft/framadate * Dépôt de code officiel de l'app : https://git.framasoft.org/framasoft/framadate
* Documentation YunoHost pour cette app : https://yunohost.org/app_opensondage * Documentation YunoHost pour cette app : https://yunohost.org/app_opensondage

View file

@ -13,11 +13,11 @@
setup_private=1 setup_private=1
setup_public=1 setup_public=1
upgrade=1 upgrade=1
upgrade=1 from_commit=02f2cd7e656ebae74643e969746b23d8912c7798 upgrade=1 from_commit=61398d8e49d4de8e7425c4ccd8098d5a4c55994b
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
change_url=1 change_url=1
;;; Upgrade options ;;; Upgrade options
; commit=02f2cd7e656ebae74643e969746b23d8912c7798 ; commit=61398d8e49d4de8e7425c4ccd8098d5a4c55994b
name=Merge pull request #70 from YunoHost-Apps/testing name=Merge pull request #77 from YunoHost-Apps/testing
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr_FR&is_public=1& manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&

View file

@ -1,6 +1,6 @@
SOURCE_URL=https://framagit.org/framasoft/framadate/framadate/-/archive/1.1.16/framadate-1.1.16.tar.gz SOURCE_URL=https://framagit.org/framasoft/framadate/framadate/-/archive/1.1.17/framadate-1.1.17.tar.gz
SOURCE_SUM=89da42a915c912a91ae1ba44fd32a61ec8fa5f59c517ee3f5d74335ddee77c7d SOURCE_SUM=a9b086a7274886d0d13c1c3ed8d6caa848d798315bd6006c6883a37387c390b0
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=opensondage-1-1-16.tar.gz SOURCE_FILENAME=opensondage.tar.gz

View file

@ -4,11 +4,6 @@ location __PATH__/ {
# Path to source # Path to source
alias __FINALPATH__/; alias __FINALPATH__/;
# Force usage of https
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
rewrite "^__PATH__/([a-zA-Z0-9-]+)$" "__PATH__/studs.php?poll=$1"; 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-]+)/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"; rewrite "^__PATH__/([a-zA-Z0-9-]+)/vote/([a-zA-Z0-9]{16})$" "__PATH__/studs.php?poll=$1&vote=$2";

1
doc/DESCRIPTION.md Normal file
View file

@ -0,0 +1 @@
OpenSondage is an online service for planning an appointment or making a decision quickly and easily. No registration is required.

1
doc/DESCRIPTION_fr.md Normal file
View file

@ -0,0 +1 @@
OpenSondage est un service en ligne permettant de planifier un rendez-vous ou prendre des décisions rapidement et simplement. Aucune inscription préalable nest nécessaire.

33
hooks/post_app_addaccess Normal file
View file

@ -0,0 +1,33 @@
#!/bin/bash
# Source app helpers
source /usr/share/yunohost/helpers
app=$1
added_users=$2
permission=$3
added_groups=$4
if [ "$app" == __APP__ ]; then
if [ "$permission" = "create poll" ]; then # The fake permission "create poll" is modifed.
if [ "$added_groups" = "visitors" ]; then # As is it a fake permission we can only grant/remove the "visitors" group.
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
if [ "$path_url" == "/" ]; then
# If the path is /, clear it to prevent any error with the regex.
path_url=""
fi
# Modify the domain to be used in a regex
domain_regex=$(echo "$domain" | sed 's@-@.@g')
ynh_app_setting_set --app=$app --key=unprotected_regex --value="$domain_regex$path_url/create_poll.php?.*$","$domain_regex$path_url/adminstuds.php?.*"
# Sync the is_public variable according to the permission
ynh_app_setting_set --app=$app --key=is_public --value=1
yunohost app ssowatconf
else
ynh_print_warn --message="This app doesn't support this authorisation, you can only add or remove visitors group."
fi
fi
fi

View file

@ -0,0 +1,26 @@
#!/bin/bash
# Source app helpers
source /usr/share/yunohost/helpers
app=$1
removed_users=$2
permission=$3
removed_groups=$4
if [ "$app" == __APP__ ]; then
if [ "$permission" = "create poll" ]; then # The fake permission "create poll" is modifed.
if [ "$removed_groups" = "visitors" ]; then # As is it a fake permission we can only grant/remove the "visitors" group.
# We remove the regex, no more protection is needed.
ynh_app_setting_delete --app=$app --key=unprotected_regex
# Sync the is_public variable according to the permission
ynh_app_setting_set --app=$app --key=is_public --value=0
yunohost app ssowatconf
else
ynh_print_warn --message="This app doesn't support this authorisation, you can only add or remove visitors group."
fi
fi
fi

View file

@ -7,14 +7,13 @@
"fr": "Service pour planifier un rendez-vous ou prendre une décision rapidement et facilement", "fr": "Service pour planifier un rendez-vous ou prendre une décision rapidement et facilement",
"de": "Service zur schnellen und einfachen Planung eines Termins oder zur Entscheidungsfindung" "de": "Service zur schnellen und einfachen Planung eines Termins oder zur Entscheidungsfindung"
}, },
"version": "1.1.16~ynh1", "version": "1.1.17~ynh1",
"url": "https://git.framasoft.org/framasoft/framadate", "url": "https://git.framasoft.org/framasoft/framadate",
"upstream": { "upstream": {
"license": "CECILL-B", "license": "CECILL-B",
"website": "https://framadate.org/", "website": "https://framadate.org/",
"demo": "https://framadate.org/", "demo": "https://framadate.org/",
"admindoc": "https://framagit.org/framasoft/framadate/framadate/wikis/home", "admindoc": "https://framagit.org/framasoft/framadate/framadate/wikis/home",
"userdoc": "https://yunohost.org/#/app_opensondage",
"code": "https://git.framasoft.org/framasoft/framadate" "code": "https://git.framasoft.org/framasoft/framadate"
}, },
"license": "CECILL-B", "license": "CECILL-B",
@ -27,7 +26,7 @@
"email": "ljf+opensondage_ynh@grimaud.me" "email": "ljf+opensondage_ynh@grimaud.me"
}], }],
"requirements": { "requirements": {
"yunohost": ">= 4.2.0" "yunohost": ">= 4.3.0"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
@ -39,8 +38,7 @@
"install" : [ "install" : [
{ {
"name": "domain", "name": "domain",
"type": "domain", "type": "domain"
"example": "domain.org"
}, },
{ {
"name": "path", "name": "path",
@ -50,8 +48,7 @@
}, },
{ {
"name": "admin", "name": "admin",
"type": "user", "type": "user"
"example": "johndoe"
}, },
{ {
"name": "language", "name": "language",

View file

@ -6,8 +6,8 @@
# dependencies used by the app # dependencies used by the app
YNH_PHP_VERSION="7.3" YNH_PHP_VERSION="7.3"
YNH_COMPOSER_VERSION=2.1.1 YNH_COMPOSER_VERSION="2.1.1"
extra_php_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-cli" pkg_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-cli"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS

View file

@ -98,16 +98,13 @@ ynh_script_progression --message="Upgrading SSOwat configuration..."
# Make app public if necessary # Make app public if necessary
if [ $is_public -eq 1 ] if [ $is_public -eq 1 ]
then then
ynh_app_setting_delete --app=$app --key=protected_regex
# Keep /admin private
if [ "$path_url" == "/" ]; then if [ "$path_url" == "/" ]; then
# If the path is /, clear it to prevent any error with the regex. # If the path is /, clear it to prevent any error with the regex.
path_url="" path_url=""
fi fi
# Modify the domain to be used in a regex # Modify the domain to be used in a regex
domain_regex=$(echo "$new_domain" | sed 's@-@.@g') domain_regex=$(echo "$new_domain" | sed 's@-@.@g')
ynh_app_setting_set --app=$app --key=protected_regex --value="$domain_regex$path_url/admin/" ynh_app_setting_set --app=$app --key=unprotected_regex --value="$domain_regex$path_url/create_poll.php?.*$","$domain_regex$path_url/adminstuds.php?.*"
fi fi
#================================================= #=================================================

View file

@ -26,6 +26,7 @@ language=$YNH_APP_ARG_LANGUAGE
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
email=$(ynh_user_get_info --username=$admin --key=mail) email=$(ynh_user_get_info --username=$admin --key=mail)
timezone="$(cat /etc/timezone)" timezone="$(cat /etc/timezone)"
phpversion=$YNH_PHP_VERSION
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -50,6 +51,14 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=language --value=$language ynh_app_setting_set --app=$app --key=language --value=$language
ynh_app_setting_set --app=$app --key=email --value=$email ynh_app_setting_set --app=$app --key=email --value=$email
ynh_app_setting_set --app=$app --key=phpversion --value=$phpversion
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
@ -96,8 +105,7 @@ ynh_add_nginx_config
ynh_script_progression --message="Configuring PHP-FPM..." --weight=2 ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
# Create a dedicated PHP-FPM config # Create a dedicated PHP-FPM config
ynh_add_fpm_config --package="$extra_php_dependencies" ynh_add_fpm_config
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
# SPECIFIC SETUP # SPECIFIC SETUP
@ -108,6 +116,16 @@ ynh_script_progression --message="Configuring $app..." --weight=2
ynh_add_config --template="../conf/config.php" --destination="$final_path/app/inc/config.php" ynh_add_config --template="../conf/config.php" --destination="$final_path/app/inc/config.php"
chmod 400 "$final_path/app/inc/config.php"
chown $app:$app "$final_path/app/inc/config.php"
#=================================================
# SETUP HOOKS FILE
#=================================================
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_app_addaccess"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_app_removeaccess"
#================================================= #=================================================
# REPLACE LOGO IMAGE (DEFAULT IS FRAMADATE) # REPLACE LOGO IMAGE (DEFAULT IS FRAMADATE)
#================================================= #=================================================
@ -147,16 +165,10 @@ ynh_script_progression --message="Configuring permissions..." --weight=1
if [ $is_public -eq 1 ] if [ $is_public -eq 1 ]
then then
ynh_permission_update --permission="main" --add="visitors" ynh_permission_update --permission="main" --add="visitors"
fi
# Keep /admin private # Only the admin can access the admin panel of the app (if the app has an admin panel)
if [ "$path_url" == "/" ]; then ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin
# If the path is /, clear it to prevent any error with the regex.
path_url=""
fi
# Modify the domain to be used in a regex
domain_regex=$(echo "$domain" | sed 's@-@.@g')
ynh_app_setting_set --app=$app --key=protected_regex --value="$domain_regex$path_url/admin/"
fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX

View file

@ -28,6 +28,14 @@ ynh_script_progression --message="Removing the MySQL database..." --weight=5
# Remove a database if it exists, along with the associated user # Remove a database if it exists, along with the associated user
ynh_mysql_remove_db --db_user=$db_name --db_name=$db_name ynh_mysql_remove_db --db_user=$db_name --db_name=$db_name
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
#================================================= #=================================================

View file

@ -35,10 +35,7 @@ timezone="$(cat /etc/timezone)"
#================================================ #================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1 ynh_script_progression --message="Validating restoration parameters..." --weight=1
ynh_webpath_available --domain=$domain --path_url=$path_url \ test ! -d $final_path || ynh_die --message="There is already a directory: $final_path "
|| ynh_die --message="Path not available: ${domain}${path_url}"
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
@ -82,7 +79,13 @@ ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weig
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_add_fpm_config --package="$extra_php_dependencies" #=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# RESTORE THE MYSQL DATABASE # RESTORE THE MYSQL DATABASE

View file

@ -19,7 +19,6 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path) path_url=$(ynh_app_setting_get --app=$app --key=path)
admin=$(ynh_app_setting_get --app=$app --key=admin) admin=$(ynh_app_setting_get --app=$app --key=admin)
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
language=$(ynh_app_setting_get --app=$app --key=language) language=$(ynh_app_setting_get --app=$app --key=language)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
@ -35,17 +34,25 @@ timezone="$(cat /etc/timezone)"
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=3
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
if [ -z "$is_public" ]; then
is_public=$(ynh_app_setting_get --app=$app --key=public_site)
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
ynh_app_setting_delete --app=$app --key=public_site
fi
# If db_name doesn't exist, create it # If db_name doesn't exist, create it
if [ -z "$db_name" ]; then if [ -z "$db_name" ]; then
db_name=$(ynh_sanitize_dbid --db_name=$app) db_name=$(ynh_sanitize_dbid --db_name=$app)
@ -75,19 +82,17 @@ if [ -z "$path_url" ]; then
ynh_app_setting_delete --app=$app --key=path_url ynh_app_setting_delete --app=$app --key=path_url
fi fi
#================================================= # Cleaning legacy permissions
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP if ynh_legacy_permissions_exists; then
#================================================= ynh_legacy_permissions_delete_all
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=3
# Backup the current version of the app ynh_app_setting_delete --app=$app --key=is_public
ynh_backup_before_upgrade fi
ynh_clean_setup () {
# restore it if the upgrade fails if ! ynh_permission_exists --permission="admin"; then
ynh_restore_upgradebackup # Create the required permissions
} ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin
# Exit if an error occurs during the execution of the script fi
ynh_abort_if_errors
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
@ -123,13 +128,20 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# PHP-FPM CONFIGURATION # PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=3 ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=3
# Create a dedicated PHP-FPM config # Create a dedicated PHP-FPM config
ynh_add_fpm_config --package="$extra_php_dependencies" ynh_add_fpm_config
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
@ -146,6 +158,13 @@ then
chown $app:$app "$final_path/app/inc/config.php" chown $app:$app "$final_path/app/inc/config.php"
fi fi
#=================================================
# SETUP HOOKS FILE
#=================================================
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_app_addaccess"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_app_removeaccess"
#================================================= #=================================================
# REPLACE LOGO IMAGE (DEFAULT IS FRAMADATE) # REPLACE LOGO IMAGE (DEFAULT IS FRAMADATE)
#================================================= #=================================================
@ -180,26 +199,6 @@ fi
chown -R $app: "$final_path/"{tpl_c,admin/stdout.log} chown -R $app: "$final_path/"{tpl_c,admin/stdout.log}
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Upgrading SSOwat configuration..." --weight=1
# Make app public if necessary
if [ $is_public -eq 1 ]
then
ynh_app_setting_set --app=$app --key=skipped_uris --value="/"
# Keep /admin private
if [ "$path_url" == "/" ]; then
# If the path is /, clear it to prevent any error with the regex.
path_url=""
fi
# Modify the domain to be used in a regex
domain_regex=$(echo "$domain" | sed 's@-@.@g')
ynh_app_setting_set --app=$app --key=protected_regex --value="$domain_regex$path_url/admin/"
fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================