From 0159c582e7702309f7cc17e201ee7b5647f34530 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 2 Oct 2021 10:28:48 +0200 Subject: [PATCH] Testing (#12) * Update rights --- .../ISSUE_TEMPLATE.md | 8 +-- .github/PULL_REQUEST_TEMPLATE.md | 16 +++++ README.md | 65 ++++++----------- README_fr.md | 67 +++++------------- conf/app.src | 1 - doc/DESCRIPTION.md | 2 + doc/DESCRIPTION_fr.md | 2 + doc/DISCLAIMER.md | 0 {sources => doc/screenshots}/laverna.png | Bin manifest.json | 16 +++-- pull_request_template.md | 16 ----- scripts/change_url | 3 - scripts/install | 19 +++-- scripts/remove | 10 +++ scripts/restore | 27 +++---- scripts/upgrade | 39 +++++----- 16 files changed, 129 insertions(+), 162 deletions(-) rename issue_template.md => .github/ISSUE_TEMPLATE.md (91%) mode change 100644 => 100755 create mode 100755 .github/PULL_REQUEST_TEMPLATE.md create mode 100755 doc/DESCRIPTION.md create mode 100755 doc/DESCRIPTION_fr.md create mode 100755 doc/DISCLAIMER.md rename {sources => doc/screenshots}/laverna.png (100%) delete mode 100644 pull_request_template.md diff --git a/issue_template.md b/.github/ISSUE_TEMPLATE.md old mode 100644 new mode 100755 similarity index 91% rename from issue_template.md rename to .github/ISSUE_TEMPLATE.md index 05d8968..2729a6b --- a/issue_template.md +++ b/.github/ISSUE_TEMPLATE.md @@ -6,11 +6,11 @@ about: When creating a bug report, please use the following template to provide **How to post a meaningful bug report** 1. *Read this whole template first.* -2. *Make sure you are on the right place:* +2. *Determine if you are on the right place:* - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!* - *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.* - - *In doubt, ask here and we will figure it out together.* -3. *Delete these italic comments as you write over them below, and remove this guide.* + - *When in doubt, post here and we will figure it out together.* +3. *Delete the italic comments as you write over them below, and remove this guide.* --- ### Describe the bug @@ -31,7 +31,7 @@ about: When creating a bug report, please use the following template to provide - *If you performed a command from the CLI, the command itself is enough. For example:* ```sh - sudo yunohost app install laverna + sudo yunohost app install the_app ``` - *If you used the webadmin, please perform the equivalent command from the CLI first.* - *If the error occurs in your browser, explain what you did:* diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100755 index 0000000..ef70e18 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,16 @@ +## Problem + +- *Description of why you made this PR* + +## Solution + +- *And how do you fix that problem* + +## PR Status + +- [ ] Code finished and ready to be reviewed/tested +- [ ] The fix/enhancement were manually tested (if applicable) + +## Automatic tests + +Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization) diff --git a/README.md b/README.md index 71254c7..211a74f 100644 --- a/README.md +++ b/README.md @@ -1,66 +1,39 @@ -# Laverna for YunoHost + -> :warning: Laverna is no longer maintained upstream. You should use [Encryptic](https://github.com/YunoHost-Apps/encryptic_ynh) instead. +# Laverna for YunoHost [![Integration level](https://dash.yunohost.org/integration/laverna.svg)](https://dash.yunohost.org/appci/app/laverna) ![](https://ci-apps.yunohost.org/ci/badges/laverna.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/laverna.maintain.svg) [![Install Laverna with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=laverna) *[Lire ce readme en français.](./README_fr.md)* -> *This package allows you to install Laverna quickly and simply on a YunoHost server. +> *This package allows you to install Laverna quickly and simply on a YunoHost server. If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* ## Overview + Laverna is an anonymous system, encrypted and without registration required, it is accessible via a web browser (without software installation). The data is private because it is stored by default on your machine (InnoDB and localstorage), it is a setting in the settings that will allow you to synchronize it via the cloud on your various devices. -**Shipped version:** 0.7.51 + +**Shipped version:** 0.7.51~ynh5 + +**Demo:** https://laverna.cc/app/ ## Screenshots -![](sources/laverna.png) +![](./doc/screenshots/laverna.png) -## Demo +## Documentation and resources -* [Official demo](https://laverna.cc/app/) - -## Configuration - -How to configure this app: From an admin panel, a plain file with SSH, or any other way. - -## Documentation - - * Official documentation:https://github.com/Laverna/laverna/wiki - * YunoHost documentation: If specific documentation is needed, feel free to contribute. - -## YunoHost specific features - -#### Multi-user support - - * Are LDAP and HTTP auth supported? **No** - * Can the app be used by multiple users? **Yes** - -#### Supported architectures - -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/laverna.svg)](https://ci-apps.yunohost.org/ci/apps/laverna/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/laverna.svg)](https://ci-apps-arm.yunohost.org/ci/apps/laverna/) - -## Limitations - -* Any known limitations. - -## Additional information - -* Other info you would like to add about this app. - -## Links - - * Report a bug: https://github.com/YunoHost-Apps/laverna_ynh/issues - * App website: https://laverna.cc/index.html - * Upstream app repository: https://github.com/Laverna/laverna - * YunoHost website: https://yunohost.org/ - ---- +* Official app website: https://laverna.cc/index.html +* Official admin documentation: https://github.com/Laverna/laverna/wiki +* Upstream app code repository: https://github.com/Laverna/laverna +* YunoHost documentation for this app: https://yunohost.org/app_laverna +* Report a bug: https://github.com/YunoHost-Apps/laverna_ynh/issues ## Developer info @@ -72,3 +45,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/laverna_ynh/tree/test or sudo yunohost app upgrade laverna -u https://github.com/YunoHost-Apps/laverna_ynh/tree/testing --debug ``` + +**More info regarding app packaging:** https://yunohost.org/packaging_apps \ No newline at end of file diff --git a/README_fr.md b/README_fr.md index 78963e8..9217f09 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,66 +1,35 @@ # Laverna pour YunoHost -> :warning: Laverna n'est plus maintenue upstream. Vous devriez utiliser [Encryptic](https://github.com/YunoHost-Apps/encryptic_ynh). - -[![Integration level](https://dash.yunohost.org/integration/laverna.svg)](https://dash.yunohost.org/appci/app/laverna) ![](https://ci-apps.yunohost.org/ci/badges/laverna.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/laverna.maintain.svg) +[![Niveau d'intégration](https://dash.yunohost.org/integration/laverna.svg)](https://dash.yunohost.org/appci/app/laverna) ![](https://ci-apps.yunohost.org/ci/badges/laverna.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/laverna.maintain.svg) [![Installer Laverna avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=laverna) -*[Read this readme in english.](./README.md)* +*[Read this readme in english.](./README.md)* +*[Lire ce readme en français.](./README_fr.md)* -> *Ce package vous permet d'installer Laverna rapidement et simplement sur un serveur YunoHost. -Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.* +> *Ce package vous permet d'installer Laverna rapidement et simplement sur un serveur YunoHost. +Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* ## Vue d'ensemble + Laverna est un système anonyme, crypté et sans inscription requise, il est accessible via un navigateur web (sans installation de logiciel). Les données sont privées, car stockées par défaut sur votre machine (InnoDB et localstorage), c’est un réglage dans les paramètres qui vous permettra de les synchroniser via le cloud sur vos différents périphériques. -**Version incluse :** 0.7.51 + +**Version incluse :** 0.7.51~ynh5 + +**Démo :** https://laverna.cc/app/ ## Captures d'écran -![](sources/laverna.png) +![](./doc/screenshots/laverna.png) -## Démo +## Documentations et ressources -* [Démo officielle](https://laverna.cc/app/) - -## Configuration - -Comment configurer cette application : via le panneau d'administration, un fichier brut en SSH ou tout autre moyen. - -## Documentation - - * Documentation officielle : https://github.com/Laverna/laverna/wiki - * Documentation YunoHost : Si une documentation spécifique est nécessaire, n'hésitez pas à contribuer. - -## Caractéristiques spécifiques YunoHost - -#### Support multi-utilisateur - -* L'authentification LDAP et HTTP est-elle prise en charge ? **Non** -* L'application peut-elle être utilisée par plusieurs utilisateurs ? **Oui** - -#### Architectures supportées - -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/laverna.svg)](https://ci-apps.yunohost.org/ci/apps/laverna/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/laverna.svg)](https://ci-apps-arm.yunohost.org/ci/apps/laverna/) - -## Limitations - -* Limitations connues. - -## Informations additionnelles - -* Autres informations que vous souhaitez ajouter sur cette application. - -## Liens - - * Signaler un bug : https://github.com/YunoHost-Apps/laverna_ynh/issues - * Site de l'application : https://laverna.cc/index.html - * Dépôt de l'application principale : https://github.com/Laverna/laverna - * Site web YunoHost : https://yunohost.org/ - ---- +* Site officiel de l'app : https://laverna.cc/index.html +* Documentation officielle de l'admin : https://github.com/Laverna/laverna/wiki +* Dépôt de code officiel de l'app : https://github.com/Laverna/laverna +* Documentation YunoHost pour cette app : https://yunohost.org/app_laverna +* Signaler un bug : https://github.com/YunoHost-Apps/laverna_ynh/issues ## Informations pour les développeurs @@ -72,3 +41,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/laverna_ynh/tree/test ou sudo yunohost app upgrade laverna -u https://github.com/YunoHost-Apps/laverna_ynh/tree/testing --debug ``` + +**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps \ No newline at end of file diff --git a/conf/app.src b/conf/app.src index 91e022b..a40613d 100644 --- a/conf/app.src +++ b/conf/app.src @@ -3,4 +3,3 @@ SOURCE_SUM=226224a141eeefefcf446e8ba4bda3f9ea7be6e96cd1992b185d44d5ef58e7d3 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md new file mode 100755 index 0000000..3cf3f02 --- /dev/null +++ b/doc/DESCRIPTION.md @@ -0,0 +1,2 @@ +Laverna is an anonymous system, encrypted and without registration required, it is accessible via a web browser (without software installation). +The data is private because it is stored by default on your machine (InnoDB and localstorage), it is a setting in the settings that will allow you to synchronize it via the cloud on your various devices. diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md new file mode 100755 index 0000000..58ec2e6 --- /dev/null +++ b/doc/DESCRIPTION_fr.md @@ -0,0 +1,2 @@ +Laverna est un système anonyme, crypté et sans inscription requise, il est accessible via un navigateur web (sans installation de logiciel). +Les données sont privées, car stockées par défaut sur votre machine (InnoDB et localstorage), c’est un réglage dans les paramètres qui vous permettra de les synchroniser via le cloud sur vos différents périphériques. diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md new file mode 100755 index 0000000..e69de29 diff --git a/sources/laverna.png b/doc/screenshots/laverna.png similarity index 100% rename from sources/laverna.png rename to doc/screenshots/laverna.png diff --git a/manifest.json b/manifest.json index 7d3e5dc..715eef6 100644 --- a/manifest.json +++ b/manifest.json @@ -3,18 +3,25 @@ "id": "laverna", "packaging_format": 1, "description": { - "en": "Taking note application with Markdown editor and encryption support.", - "fr": "Application de Prise de note avec éditeur Markdown et chiffrement." + "en": "Taking note application with Markdown editor and encryption support", + "fr": "Application de Prise de note avec éditeur Markdown et chiffrement" }, "version": "0.7.51~ynh5", "url": "https://laverna.cc/index.html", + "upstream": { + "license": "MPL-2.0", + "website": "https://laverna.cc/index.html", + "demo": "https://laverna.cc/app/", + "admindoc": "https://github.com/Laverna/laverna/wiki", + "code": "https://github.com/Laverna/laverna" + }, "license": "MPL-2.0", "maintainer": { "name": "", "email": "" }, "requirements": { - "yunohost": ">> 4.1.7" + "yunohost": ">> 4.2.4" }, "multi_instance": true, "services": [ @@ -24,8 +31,7 @@ "install" : [ { "name": "domain", - "type": "domain", - "example": "example.com" + "type": "domain" }, { "name": "path", diff --git a/pull_request_template.md b/pull_request_template.md deleted file mode 100644 index 6c28fc5..0000000 --- a/pull_request_template.md +++ /dev/null @@ -1,16 +0,0 @@ -## Problem -- *Description of why you made this PR* - -## Solution -- *And how do you fix that problem* - -## PR Status -- [ ] Code finished. -- [ ] Tested with Package_check. -- [ ] Fix or enhancement tested. -- [ ] Upgrade from last version tested. -- [ ] Can be reviewed and tested. - -## Package_check results ---- -* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"* diff --git a/scripts/change_url b/scripts/change_url index bab3080..a2cc3a7 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -8,9 +8,6 @@ source /usr/share/yunohost/helpers -# Stop script if errors -ynh_abort_if_errors - #================================================= # RETRIEVE ARGUMENTS #================================================= diff --git a/scripts/install b/scripts/install index f5c7588..b917edf 100755 --- a/scripts/install +++ b/scripts/install @@ -43,6 +43,14 @@ ynh_script_progression --message="Storing installation settings..." --weight=1 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..." --weight=1 + +# Create a system user +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -52,6 +60,10 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" + #================================================= # NGINX CONFIGURATION #================================================= @@ -60,13 +72,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2 # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -# Set permissions to app files -chown -R root: $final_path - #================================================= # SETUP SSOWAT #================================================= diff --git a/scripts/remove b/scripts/remove index 3d7218c..8517773 100755 --- a/scripts/remove +++ b/scripts/remove @@ -36,6 +36,16 @@ ynh_script_progression --message="Removing NGINX web server configuration..." -- # Remove the dedicated NGINX config ynh_remove_nginx_config +#================================================= +# GENERIC FINALIZATION +#================================================= +# REMOVE DEDICATED USER +#================================================= +ynh_script_progression --message="Removing the dedicated system user..." --weight=1 + +# Delete a system user +ynh_system_user_delete --username=$app + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index bb31e73..77fa1dd 100755 --- a/scripts/restore +++ b/scripts/restore @@ -31,8 +31,6 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= ynh_script_progression --message="Validating restoration parameters..." --weight=1 -ynh_webpath_available --domain=$domain --path_url=$path_url \ - || ynh_die --message="Path not available: ${domain}${path_url}" test ! -d $final_path \ || ynh_die --message="There is already a directory: $final_path " @@ -44,6 +42,14 @@ test ! -d $final_path \ 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..." --weight=1 + +# Create the dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -51,20 +57,9 @@ ynh_script_progression --message="Restoring Laverna main directory..." --weight= ynh_restore_file --origin_path="$final_path" -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 - -# Create the dedicated user (if not existing) -ynh_system_user_create --username=$app - -#================================================= -# RESTORE USER RIGHTS -#================================================= - -# Restore permissions on app files -chown -R root: $final_path +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index d7ebcfa..8b9fc00 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -25,6 +25,20 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) upgrade_type=$(ynh_check_app_version_changed) +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up Laverna before upgrading..." --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 #================================================= @@ -44,18 +58,12 @@ if ynh_legacy_permissions_exists; then fi #================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +# CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Backing up Laverna before upgrading..." --weight=3 +ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 -# 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 +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -69,6 +77,10 @@ then ynh_setup_source --dest_dir="$final_path" fi +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" + #================================================= # NGINX CONFIGURATION #================================================= @@ -77,13 +89,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -# Set permissions on app files -chown -R root: $final_path - #================================================= # RELOAD NGINX #=================================================