diff --git a/README.md b/README.md index 6f3f14d..d4347b7 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,8 @@ It shall NOT be edited by hand. # ChtickyNotes for YunoHost -[![Integration level](https://dash.yunohost.org/integration/chtickynotes.svg)](https://dash.yunohost.org/appci/app/chtickynotes) ![Working status](https://ci-apps.yunohost.org/ci/badges/chtickynotes.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/chtickynotes.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/chtickynotes.svg)](https://dash.yunohost.org/appci/app/chtickynotes) ![Working status](https://ci-apps.yunohost.org/ci/badges/chtickynotes.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/chtickynotes.maintain.svg) + [![Install ChtickyNotes with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=chtickynotes) *[Lire ce readme en français.](./README_fr.md)* @@ -17,7 +18,8 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in ChtickyNotes is a "simple post-it" based on [Post It All!](https://github.com/txusko/PostItAll). -##Features: +## Features + - notes movable and resizable - edit note by just typing on it (or CTRL-V to paste chunks of HTML) - menu on each note to change its color, and so on @@ -39,7 +41,6 @@ ChtickyNotes is a "simple post-it" based on [Post It All!](https://github.com/tx ## Documentation and resources * Upstream app code repository: -* YunoHost documentation for this app: * Report a bug: ## Developer info diff --git a/README_fr.md b/README_fr.md index e6eb145..835c48b 100644 --- a/README_fr.md +++ b/README_fr.md @@ -5,7 +5,8 @@ It shall NOT be edited by hand. # ChtickyNotes pour YunoHost -[![Niveau d’intégration](https://dash.yunohost.org/integration/chtickynotes.svg)](https://dash.yunohost.org/appci/app/chtickynotes) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/chtickynotes.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/chtickynotes.maintain.svg) +[![Niveau d’intégration](https://dash.yunohost.org/integration/chtickynotes.svg)](https://dash.yunohost.org/appci/app/chtickynotes) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/chtickynotes.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/chtickynotes.maintain.svg) + [![Installer ChtickyNotes avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=chtickynotes) *[Read this readme in english.](./README.md)* @@ -17,7 +18,8 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po ChtickyNotes est une application "post-it" basé sur [Post It All!](Https://github.com/txusko/PostItAll). -## Caractéristiques : +## Caractéristiques + - notes mobiles et redimensionnables - ?iter la note en tapant simplement dessus (ou CTRL-V pour coller du code HTML) - menu sur chaque note pour changer sa couleur... @@ -39,7 +41,6 @@ ChtickyNotes est une application "post-it" basé sur [Post It All!](Https://gith ## Documentations et ressources * Dépôt de code officiel de l’app : -* Documentation YunoHost pour cette app : * Signaler un bug : ## Informations pour les développeurs diff --git a/check_process b/check_process deleted file mode 100644 index 8c9a6b0..0000000 --- a/check_process +++ /dev/null @@ -1,21 +0,0 @@ -;; Test complet - ; Manifest - domain="domain.tld" - path="/path" - is_public=1 - ; Checks - pkg_linter=1 - setup_sub_dir=1 - setup_root=1 - setup_nourl=0 - setup_private=1 - setup_public=1 - upgrade=1 - # 1.0~ynh3 - upgrade=1 from_commit=5ea5611d28a8330a7d9127371d60f28083b0a0fb - backup_restore=1 - multi_instance=0 - change_url=1 -;;; Options -Email= -Notification=none diff --git a/conf/nginx.conf b/conf/nginx.conf index c64c145..4976597 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -2,7 +2,7 @@ location __PATH__/ { # Path to source - alias __FINALPATH__/ ; + alias __INSTALL_DIR__/ ; index index.html index.php; diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md index d683fc4..9080420 100644 --- a/doc/DESCRIPTION.md +++ b/doc/DESCRIPTION.md @@ -1,6 +1,7 @@ ChtickyNotes is a "simple post-it" based on [Post It All!](https://github.com/txusko/PostItAll). -##Features: +## Features + - notes movable and resizable - edit note by just typing on it (or CTRL-V to paste chunks of HTML) - menu on each note to change its color, and so on diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md index a69a94e..504dba7 100644 --- a/doc/DESCRIPTION_fr.md +++ b/doc/DESCRIPTION_fr.md @@ -1,6 +1,7 @@ ChtickyNotes est une application "post-it" basé sur [Post It All!](Https://github.com/txusko/PostItAll). -## Caractéristiques : +## Caractéristiques + - notes mobiles et redimensionnables - ?iter la note en tapant simplement dessus (ou CTRL-V pour coller du code HTML) - menu sur chaque note pour changer sa couleur... diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md deleted file mode 100644 index e69de29..0000000 diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md deleted file mode 100644 index e69de29..0000000 diff --git a/manifest.json b/manifest.json deleted file mode 100644 index fb4cb4d..0000000 --- a/manifest.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name": "ChtickyNotes", - "id": "chtickynotes", - "packaging_format": 1, - "description": { - "en": "Generic sticky notes for all purpose", - "fr": "Post-its génériques à tout faire" - }, - "version": "1.0~ynh5", - "url": "https://github.com/YunoHost-Apps/chtickynotes_ynh/", - "upstream": { - "license": "MIT", - "code": "https://github.com/YunoHost-Apps/chtickynotes_ynh/" - }, - "developer": { - "name": "chtixof" - }, - "license": "MIT", - "maintainer": { - "name": "", - "email": "" - }, - "requirements": { - "yunohost": ">= 11.0.9" - }, - "multi_instance": false, - "services": [ - "nginx" - ], - "arguments": { - "install": [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "path", - "type": "path", - "example": "/chtickynotes", - "default": "/chtickynotes" - }, - { - "name": "is_public", - "type": "boolean", - "default": true - } - ] - } -} diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..92868e1 --- /dev/null +++ b/manifest.toml @@ -0,0 +1,52 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json + +packaging_format = 2 + +id = "chtickynotes" +name = "ChtickyNotes" +description.en = "Generic sticky notes for all purpose" +description.fr = "Post-its génériques à tout faire" + +version = "1.0~ynh5" + +maintainers = [] + +[upstream] +license = "MIT" +code = "https://github.com/YunoHost-Apps/chtickynotes_ynh/" + +[integration] +yunohost = ">= 11.0.9" +architectures = "all" +multi_instance = false +ldap = false # TODO: +sso = false # TODO: +disk = "10M" +ram.build = "50M" +ram.runtime = "10M" + +[install] + [install.domain] + type = "domain" + + [install.path] + type = "path" + default = "/chtickynotes" + + [install.init_main_permission] + type = "group" + default = "visitors" + +[resources] + [resources.system_user] + + [resources.install_dir] + + [resources.permissions] + main.url = "/" + + [resources.apt] + packages = [ + "php7.4", + "php7.4-fpm", + ] diff --git a/scripts/backup b/scripts/backup index 9b12047..18f83fe 100644 --- a/scripts/backup +++ b/scripts/backup @@ -10,27 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { - true -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_print_info --message="Loading installation settings..." - -app=$YNH_APP_INSTANCE_NAME - -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -domain=$(ynh_app_setting_get --app=$app --key=domain) -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= @@ -40,7 +19,7 @@ ynh_print_info --message="Declaring files to be backed up..." # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$final_path" +ynh_backup --src_path="$install_dir" #================================================= # BACKUP THE NGINX CONFIGURATION diff --git a/scripts/change_url b/scripts/change_url index 03f6a72..d50c1a8 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,60 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -old_domain=$YNH_APP_OLD_DOMAIN -old_path=$YNH_APP_OLD_PATH - -new_domain=$YNH_APP_NEW_DOMAIN -new_path=$YNH_APP_NEW_PATH - -app=$YNH_APP_INSTANCE_NAME - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." - -# Needed for helper "ynh_add_nginx_config" -final_path=$(ynh_app_setting_get --app=$app --key=final_path) - -#================================================= -# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." - -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - ynh_clean_check_starting - # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. - ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" - - # Restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# CHECK WHICH PARTS SHOULD BE CHANGED -#================================================= - -change_domain=0 -if [ "$old_domain" != "$new_domain" ] -then - change_domain=1 -fi - -change_path=0 -if [ "$old_path" != "$new_path" ] -then - change_path=1 -fi - #================================================= # STANDARD MODIFICATIONS #================================================= @@ -70,36 +16,7 @@ fi #================================================= ynh_script_progression --message="Updating NGINX web server configuration..." --weight=3 -nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf - -# Change the path in the NGINX config file -if [ $change_path -eq 1 ] -then - # Make a backup of the original NGINX config file if modified - ynh_backup_if_checksum_is_different --file="$nginx_conf_path" - # Set global variables for NGINX helper - domain="$old_domain" - path_url="$new_path" - # Create a dedicated NGINX config - ynh_add_nginx_config -fi - -# Change the domain for NGINX -if [ $change_domain -eq 1 ] -then - # Delete file checksum for the old conf file location - ynh_delete_file_checksum --file="$nginx_conf_path" - mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf - # Store file checksum for the new config file location - ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" -fi - -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=2 - -ynh_systemd_action --service_name=nginx --action=reload +ynh_change_url_nginx_config #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index d6fedca..12a7ee8 100644 --- a/scripts/install +++ b/scripts/install @@ -9,73 +9,22 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { - true -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# RETRIEVE ARGUMENTS FROM THE MANIFEST -#================================================= - -domain=$YNH_APP_ARG_DOMAIN -path_url=$YNH_APP_ARG_PATH -is_public=$YNH_APP_ARG_IS_PUBLIC - -app=$YNH_APP_INSTANCE_NAME - -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -ynh_script_progression --message="Validating installation parameters..." - -final_path=/var/www/$app -test ! -e "$final_path" || ynh_die --message="This path already contains a folder" - -# Register (book) web path -ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url - -#================================================= -# STORE SETTINGS FROM MANIFEST -#================================================= -ynh_script_progression --message="Storing installation settings..." - -ynh_app_setting_set --app=$app --key=domain --value=$domain -ynh_app_setting_set --app=$app --key=path --value=$path_url - -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." - -# Create a system user -ynh_system_user_create --username=$app --home_dir="$final_path" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=7 -ynh_app_setting_set --app=$app --key=final_path --value=$final_path +cp -a ../sources/* "$install_dir" -mkdir -p $final_path -cp -a ../sources/* $final_path - -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R "$app:www-data" "$install_dir" #================================================= # NGINX CONFIGURATION #================================================= ynh_script_progression --message="Configuring NGINX web server..." --weight=2 -# Create a dedicated NGINX config ynh_add_nginx_config #================================================= @@ -83,29 +32,8 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Configuring PHP-FPM..." -# Create a dedicated PHP-FPM config ynh_add_fpm_config --usage=low --footprint=low -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Configuring permissions..." - -# Make app public if necessary -if [ $is_public -eq 1 ] -then - # Everyone can access the app. - # The "main" permission is automatically created before the install script. - ynh_permission_update --permission="main" --add="visitors" -fi - -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." - -ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index 2e53c5c..f144c9c 100644 --- a/scripts/remove +++ b/scripts/remove @@ -9,32 +9,11 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." - -app=$YNH_APP_INSTANCE_NAME - -domain=$(ynh_app_setting_get --app=$app --key=domain) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) - -#================================================= -# STANDARD REMOVE -#================================================= -# REMOVE APP MAIN DIR -#================================================= -ynh_script_progression --message="Removing app main directory..." --weight=2 - -# Remove the app directory securely -ynh_secure_remove --file="$final_path" - #================================================= # REMOVE NGINX CONFIGURATION #================================================= ynh_script_progression --message="Removing NGINX web server configuration..." -# Remove the dedicated NGINX config ynh_remove_nginx_config #================================================= @@ -42,20 +21,8 @@ ynh_remove_nginx_config #================================================= ynh_script_progression --message="Removing PHP-FPM configuration..." -# Remove the dedicated PHP-FPM config ynh_remove_fpm_config - -#================================================= -# GENERIC FINALIZATION -#================================================= -# REMOVE DEDICATED USER -#================================================= -ynh_script_progression --message="Removing the dedicated system user..." - -# Delete a system user -ynh_system_user_delete --username=$app - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index cf9919e..f3e1b37 100644 --- a/scripts/restore +++ b/scripts/restore @@ -10,36 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { - true -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." - -app=$YNH_APP_INSTANCE_NAME - -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) - -#================================================= -# CHECK IF THE APP CAN BE RESTORED -#================================================= -ynh_script_progression --message="Validating restoration parameters..." --weight=2 - -test ! -d $final_path \ - || ynh_die --message="There is already a directory: $final_path " - #================================================= # STANDARD RESTORATION STEPS #================================================= @@ -49,24 +19,16 @@ ynh_script_progression --message="Restoring the NGINX web server configuration.. ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -ynh_script_progression --message="Recreating the dedicated system user..." - -# Create the dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir="$final_path" - #================================================= # RESTORE THE APP MAIN DIR #================================================= ynh_script_progression --message="Restoring the app main directory..." --weight=2 -ynh_restore_file --origin_path="$final_path" +ynh_restore_file --origin_path="$install_dir" -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R "$app:www-data" "$install_dir" #================================================= # RESTORE THE PHP-FPM CONFIGURATION @@ -82,8 +44,8 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." -ynh_systemd_action --service_name=php$phpversion-fpm --action=reload -ynh_systemd_action --service_name=nginx --action=reload +ynh_systemd_action --service_name="php$phpversion-fpm" --action=reload +ynh_systemd_action --service_name="nginx" --action=reload #================================================= # END OF SCRIPT diff --git a/scripts/upgrade b/scripts/upgrade index 3704dd8..2f33032 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,83 +9,22 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." - -app=$YNH_APP_INSTANCE_NAME - -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) - -#================================================= -# CHECK VERSION -#================================================= - -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)..." - -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - ynh_clean_check_starting - # Restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# STANDARD UPGRADE STEPS -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=2 - -# If final_path doesn't exist, create it -if [ -z "$final_path" ]; then - final_path=/var/www/$app - ynh_app_setting_set --app=$app --key=final_path --value=$final_path -fi - -# Cleaning legacy permissions -if ynh_legacy_permissions_exists; then - ynh_legacy_permissions_delete_all - - ynh_app_setting_delete --app=$app --key=is_public -fi - -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir="$final_path" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Upgrading source files..." -cp -a ../sources/* $final_path +cp -a ../sources/* "$install_dir" -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R "$app:www-data" "$install_dir" #================================================= # NGINX CONFIGURATION #================================================= ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2 -# Create a dedicated NGINX config ynh_add_nginx_config #================================================= @@ -93,16 +32,8 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Upgrading PHP-FPM configuration..." -# Create a dedicated PHP-FPM config ynh_add_fpm_config --usage=low --footprint=low -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." - -ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..73a7fdf --- /dev/null +++ b/tests.toml @@ -0,0 +1,7 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json + +test_format = 1.0 + +[default] + + test_upgrade_from.5ea5611d28a8330a7d9127371d60f28083b0a0fb.name = "old version"