diff --git a/README.md b/README.md index 0464119..caf3108 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Plainpad is a self hosted, open source note taking application that is very easy to setup on your server. Your data will never leave your server and you will be able to access them from any device connected to the internet. With Plainpad you can allow multiple users to access the application without being able to see each other's notes. The notes are being encrypted and stored safely in the database. -**Shipped version:** 1.0.0~ynh1 +**Shipped version:** 1.0.0~ynh2 **Demo:** https://alextselegidis.com/try/plainpad/#/login diff --git a/README_fr.md b/README_fr.md index bd5d59f..60a9e69 100644 --- a/README_fr.md +++ b/README_fr.md @@ -11,10 +11,10 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour ## Vue d'ensemble -Plainpad is a self hosted, open source note taking application that is very easy to setup on your server. Your data will never leave your server and you will be able to access them from any device connected to the internet. -With Plainpad you can allow multiple users to access the application without being able to see each other's notes. The notes are being encrypted and stored safely in the database. +Plainpad est une application de prise de notes open source auto-hébergée qui est très facile à configurer sur votre serveur. Vos données ne quitteront jamais votre serveur et vous pourrez y accéder depuis n'importe quel appareil connecté à Internet. +Avec Plainpad, vous pouvez autoriser plusieurs utilisateurs à accéder à l'application sans pouvoir voir les notes des autres. Les notes sont cryptées et stockées en toute sécurité dans la base de données. -**Version incluse :** 1.0.0~ynh1 +**Version incluse :** 1.0.0~ynh2 **Démo :** https://alextselegidis.com/try/plainpad/#/login diff --git a/conf/.env.example b/conf/.env.example index 967b49a..c9abc48 100644 --- a/conf/.env.example +++ b/conf/.env.example @@ -44,7 +44,7 @@ DB_PORT=3306 DB_DATABASE=__DB_NAME__ # The database username for the connection. -DB_USERNAME=__DB_NAME__ +DB_USERNAME=__DB_USER__ # The database password for the connection. DB_PASSWORD=__DB_PWD__ diff --git a/conf/nginx.conf b/conf/nginx.conf index 2cad38f..554831e 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -4,14 +4,9 @@ location __PATH__/ { # Path to source alias __FINALPATH__/public/; - # Force usage of https - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } - index index.php index.html; - #client_max_body_size 50M; + client_max_body_size 50M; try_files $uri $uri/ __PATH__/__PATH__/index.php?$query_string; @@ -25,7 +20,4 @@ location __PATH__/ { fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $request_filename; } - - # Include SSOWAT user panel. - include conf.d/yunohost_panel.conf.inc; } diff --git a/doc/.gitkeep b/doc/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md new file mode 100644 index 0000000..820d2ac --- /dev/null +++ b/doc/DESCRIPTION_fr.md @@ -0,0 +1,2 @@ +Plainpad est une application de prise de notes open source auto-hébergée qui est très facile à configurer sur votre serveur. Vos données ne quitteront jamais votre serveur et vous pourrez y accéder depuis n'importe quel appareil connecté à Internet. +Avec Plainpad, vous pouvez autoriser plusieurs utilisateurs à accéder à l'application sans pouvoir voir les notes des autres. Les notes sont cryptées et stockées en toute sécurité dans la base de données. \ No newline at end of file diff --git a/doc/screenshots/.gitkeep b/doc/screenshots/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/manifest.json b/manifest.json index 548840e..4e8371e 100644 --- a/manifest.json +++ b/manifest.json @@ -3,10 +3,10 @@ "id": "plainpad", "packaging_format": 1, "description": { - "en": "Self hosted, note taking application", - "fr": "Application de prise de notes auto-hébergée" + "en": "Note taking application", + "fr": "Prise de notes auto-hébergée" }, - "version": "1.0.0~ynh1", + "version": "1.0.0~ynh2", "url": "https://alextselegidis.com/get/plainpad", "upstream": { "license": "AGPL-3.0-only", @@ -21,12 +21,12 @@ "email": "" }, "requirements": { - "yunohost": ">= 4.2.4" + "yunohost": ">= 4.3.0" }, "multi_instance": true, "services": [ "nginx", - "php7.3-fpm", + "php8.0-fpm", "mysql" ], "arguments": { @@ -44,6 +44,10 @@ { "name": "is_public", "type": "boolean", + "help": { + "en": "If enabled, Plainpad will be accessible by people who do not have an account. This can be changed later via the webadmin.", + "fr": "Si cette case est cochée, Plainpad sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." + }, "default": true } ] diff --git a/scripts/_common.sh b/scripts/_common.sh index 1de7be1..e9f1973 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,9 +4,9 @@ # COMMON VARIABLES #================================================= -YNH_PHP_VERSION="7.3" +YNH_PHP_VERSION="8.0" -extra_php_dependencies="php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-fileinfo php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-mysql" +pkg_dependencies="php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-fileinfo php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-mysql" #================================================= # PERSONAL HELPERS diff --git a/scripts/install b/scripts/install index 9f30d05..e79d3a5 100755 --- a/scripts/install +++ b/scripts/install @@ -28,6 +28,7 @@ domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH is_public=$YNH_APP_ARG_IS_PUBLIC key=$(ynh_string_random --length=32) +phpversion=$YNH_PHP_VERSION app=$YNH_APP_INSTANCE_NAME @@ -51,6 +52,13 @@ ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=key --value=$key +#================================================= +# INSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Installing dependencies..." --weight=1 + +ynh_install_app_dependencies $pkg_dependencies + #================================================= # CREATE DEDICATED USER #================================================= @@ -96,8 +104,7 @@ ynh_add_nginx_config ynh_script_progression --message="Configuring PHP-FPM..." --weight=1 # Create a dedicated PHP-FPM config -ynh_add_fpm_config --package="$extra_php_dependencies" -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +ynh_add_fpm_config #================================================= # ADD A CONFIGURATION @@ -115,7 +122,7 @@ chown $app:$app "$final_path/.env" ynh_script_progression --message="Migrating database..." --weight=1 pushd "$final_path" - php$phpversion artisan migrate:fresh --seed + php$phpversion artisan migrate:fresh -n --seed popd #================================================= @@ -138,6 +145,7 @@ if [ $is_public -eq 1 ] then ynh_permission_update --permission="main" --add="visitors" fi + ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true" #================================================= diff --git a/scripts/remove b/scripts/remove index 78df768..f75dd97 100755 --- a/scripts/remove +++ b/scripts/remove @@ -53,6 +53,14 @@ ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1 # Remove the dedicated PHP-FPM config ynh_remove_fpm_config +#================================================= +# REMOVE DEPENDENCIES +#================================================= +ynh_script_progression --message="Removing dependencies..." --weight=1 + +# Remove metapackage and its dependencies +ynh_remove_app_dependencies + #================================================= # REMOVE LOGROTATE CONFIGURATION #================================================= diff --git a/scripts/restore b/scripts/restore index 8678542..d4985d9 100755 --- a/scripts/restore +++ b/scripts/restore @@ -40,8 +40,7 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= ynh_script_progression --message="Validating restoration parameters..." --weight=1 -test ! -d $final_path \ - || ynh_die --message="There is already a directory: $final_path " +test ! -d $final_path || ynh_die --message="There is already a directory: $final_path " #================================================= # STANDARD RESTORATION STEPS @@ -71,6 +70,14 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" +#================================================= +# REINSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Reinstalling dependencies..." --weight=1 + +# Define and install dependencies +ynh_install_app_dependencies $pkg_dependencies + #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= @@ -78,6 +85,9 @@ ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weig ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +# Recreate a dedicated PHP-FPM config +ynh_add_fpm_config + #================================================= # RESTORE THE MYSQL DATABASE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 397edbb..8f77dbb 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,6 +20,7 @@ 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) db_name=$(ynh_app_setting_get --app=$app --key=db_name) +phpversion=$YNH_PHP_VERSION #================================================= # CHECK VERSION @@ -41,6 +42,23 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors +#================================================= +# ENSURE DOWNWARD COMPATIBILITY +#================================================= +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 + +# 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 a permission if needed +if ! ynh_permission_exists --permission="api"; then + ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true" +fi + #================================================= # CREATE DEDICATED USER #================================================= @@ -73,13 +91,20 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated 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 #================================================= ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 # Create a dedicated PHP-FPM config -ynh_add_fpm_config --package="$extra_php_dependencies" +ynh_add_fpm_config #================================================= # GENERIC FINALIZATION