diff --git a/issue_template.md b/.github/ISSUE_TEMPLATE.md similarity index 57% rename from issue_template.md rename to .github/ISSUE_TEMPLATE.md index 5b839b9..2729a6b 100644 --- a/issue_template.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,6 +1,6 @@ --- name: Bug report -about: Create a report to help us debug, it would be nice to fill the template as much as you can to help us, help you and help us all. +about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently. --- @@ -8,15 +8,17 @@ about: Create a report to help us debug, it would be nice to fill the template a 1. *Read this whole template first.* 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 Lufi itself. Refer to its documentation or repository for help.* - - *If you have a doubt, post here, we will figure it out together.* + - *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.* + - *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** +### Describe the bug + *A clear and concise description of what the bug is.* -**Versions** +### Context + - Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...* - YunoHost version: x.x.x - I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...* @@ -25,11 +27,11 @@ about: Create a report to help us debug, it would be nice to fill the template a - Using, or trying to install package version/branch: - If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`* -**To Reproduce** -*Steps to reproduce the behavior.* +### Steps to reproduce + - *If you performed a command from the CLI, the command itself is enough. For example:* ```sh - sudo yunohost app install lufi + 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:* @@ -38,9 +40,16 @@ about: Create a report to help us debug, it would be nice to fill the template a 3. *Scroll down to '...'* 4. *See error* -**Expected behavior** +### Expected behavior + *A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.* -**Logs** -*After a failed command, YunoHost makes the log available to you, but also to others, thanks to `yunohost log display [log name] --share`. The actual command, with the correct log name, is displayed at the end of the failed attempt in the CLI. Execute it and copy here the share link it outputs.* +### Logs + +*When an operation fails, YunoHost provides a simple way to share the logs.* +- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.* +- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.* + +*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)* + *If applicable and useful, add screenshots to help explain your problem.* diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 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 908b417..9a41d04 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ + + # Lufi for YunoHost [![Integration level](https://dash.yunohost.org/integration/lufi.svg)](https://dash.yunohost.org/appci/app/lufi) ![](https://ci-apps.yunohost.org/ci/badges/lufi.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/lufi.maintain.svg) @@ -5,55 +10,35 @@ *[Lire ce readme en français.](./README_fr.md)* -> *This package allows you to install Lufi quickly and simply on a YunoHost server. +> *This package allows you to install Lufi 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 -It stores files and allows you to download them. -Is that all? No. All the files are encrypted **by the browser**! It means that your files **never** leave your computer unencrypted. -The administrator of the Lufi instance you use will not be able to see what is in your file, neither will your network administrator, or your ISP. +Self hosting files and sharing anonymous application -The encryption key part of the URL is a anchor (Cf. [Fragment Identifier](https://en.wikipedia.org/wiki/Fragment_identifier)), that means this part is only processed client-side and does not reach the server. :-) +**Shipped version:** 0.05.13~ynh2 -**Shipped version:** 0.05.13 +**Demo:** https://demo.lufi.io/ ## Screenshots -![](https://framalibre.org/sites/default/files/screenshot_lufi_1.png) +![](./doc/screenshots/screenshot_lufi_1.png) -## Demo - -* [Official demo](https://demo.lufi.io/) +## Disclaimers / important information ## Configuration * How to configure this app: a plain file at `/var/www/lufi/lufi.conf` with SSH. -## Documentation +## Documentation and resources - * Official documentation: https://framagit.org/luc/lufi/wikis/home - * YunoHost documentation: https://yunohost.org/en/app_lufi - -## YunoHost specific features - -#### Multi-user support - -Are LDAP and HTTP auth supported? **Yes** -Can the app be used by multiple users? **Yes** - -#### Supported architectures - -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/lufi%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/lufi/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/lufi%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/lufi/) - -## Links - - * Report a bug: https://github.com/YunoHost-Apps/lufi_ynh/issues - * Upstream app repository: https://framagit.org/fiat-tux/hat-softwares/lufi - * YunoHost website: https://yunohost.org/ - ---- +* Official app website: https://example.com +* Official user documentation: https://yunohost.org/en/app_lufi +* Official admin documentation: https://framagit.org/luc/lufi/wikis/home +* Upstream app code repository: https://framagit.org/fiat-tux/hat-softwares/lufi +* YunoHost documentation for this app: https://yunohost.org/app_lufi +* Report a bug: https://github.com/YunoHost-Apps/lufi_ynh/issues ## Developer info @@ -65,3 +50,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/lufi_ynh/tree/testing or sudo yunohost app upgrade lufi -u https://github.com/YunoHost-Apps/lufi_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 eea48f0..6dbb47c 100644 --- a/README_fr.md +++ b/README_fr.md @@ -3,56 +3,38 @@ [![Niveau d'intégration](https://dash.yunohost.org/integration/lufi.svg)](https://dash.yunohost.org/appci/app/lufi) ![](https://ci-apps.yunohost.org/ci/badges/lufi.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/lufi.maintain.svg) [![Installer Lufi avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lufi) -*[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 Lufi 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 Lufi 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 -Il stocke vos fichiers et vous permet de les télécharger. -Est-ce tout ? Non. Tous les fichiers sont chiffrés par le navigateur ! L'administrateur de l'instance Lufi ne pourra pas voir quel est votre administrateur réseau ou votre FAI. +Application d'hébergement et de partage de fichiers anonyme -La clé de déchiffrement est une ancre (voir [Fragment Identifier](https://en.wikipedia.org/wiki/Fragment_identifier)), ce qui signifie que cette partie n'est traitée que par le client et n'atteint pas le serveur. :-) +**Version incluse :** 0.05.13~ynh2 -**Version incluse:** 0.05.13 +**Démo :** https://demo.lufi.io/ ## Captures d'écran -![](https://framalibre.org/sites/default/files/screenshot_lufi_1.png) +![](./doc/screenshots/screenshot_lufi_1.png) -## Démo - -* [Démo officielle](https://demo.lufi.io/) +## Avertissements / informations importantes ## Configuration -* Comment configurer cette application: un fichier brut `/var/www/lufi/lufi.conf` en SSH. +* Comment configurer cette application: un fichier brut `/var/www/lufi/lufi.conf` en SSH. -## Documentation +## Documentations et ressources - * Documentation officielle : https://framagit.org/luc/lufi/wikis/home - * Documentation YunoHost : https://yunohost.org/fr/app_lufi - -## Caractéristiques spécifiques YunoHost - -#### Support multi-utilisateur - -* L'authentification LDAP et HTTP est-elle prise en charge ? **Oui** -* 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/lufi%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/lufi/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/lufi%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/lufi/) - -## Liens - - * Signaler un bug : https://github.com/YunoHost-Apps/lufi_ynh/issues - * Dépôt de l'application principale : https://framagit.org/fiat-tux/hat-softwares/lufi - * Site web YunoHost : https://yunohost.org/ - ---- +* Site officiel de l'app : https://example.com +* Documentation officielle utilisateur : https://yunohost.org/en/app_lufi +* Documentation officielle de l'admin : https://framagit.org/luc/lufi/wikis/home +* Dépôt de code officiel de l'app : https://framagit.org/fiat-tux/hat-softwares/lufi +* Documentation YunoHost pour cette app : https://yunohost.org/app_lufi +* Signaler un bug : https://github.com/YunoHost-Apps/lufi_ynh/issues ## Informations pour les développeurs @@ -64,3 +46,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/lufi_ynh/tree/testing ou sudo yunohost app upgrade lufi -u https://github.com/YunoHost-Apps/lufi_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/check_process b/check_process index 1986361..e177dbf 100644 --- a/check_process +++ b/check_process @@ -1,11 +1,11 @@ ;; Nom du test auto_remove=1 ; Manifest - domain="domain.tld" (DOMAIN) - path="/path" (PATH) + domain="domain.tld" + path="/path" max_file_size=100 - is_public=1 (PUBLIC|public=1|private=0) - admin="john" (USER) + is_public=1 + admin="john" ; Checks pkg_linter=1 setup_sub_dir=1 diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md new file mode 100644 index 0000000..1dcb41b --- /dev/null +++ b/doc/DISCLAIMER.md @@ -0,0 +1,3 @@ +## Configuration + +* How to configure this app: a plain file at `/var/www/lufi/lufi.conf` with SSH. diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md new file mode 100644 index 0000000..cc1be3d --- /dev/null +++ b/doc/DISCLAIMER_fr.md @@ -0,0 +1,3 @@ +## Configuration + +* Comment configurer cette application: un fichier brut `/var/www/lufi/lufi.conf` en SSH. diff --git a/doc/screenshots/screenshot_lufi_1.png b/doc/screenshots/screenshot_lufi_1.png new file mode 100644 index 0000000..07d3dc0 Binary files /dev/null and b/doc/screenshots/screenshot_lufi_1.png differ diff --git a/manifest.json b/manifest.json index f82f919..df8db82 100644 --- a/manifest.json +++ b/manifest.json @@ -6,15 +6,23 @@ "en": "Self hosting files and sharing anonymous application", "fr": "Application d'hébergement et de partage de fichiers anonyme" }, - "version": "0.05.13~ynh1", + "version": "0.05.13~ynh2", "url": "https://git.framasoft.org/luc/lufi", + "upstream": { + "license": "AGPL-3.0-or-later", + "website": "https://example.com", + "demo": "https://demo.lufi.io/", + "admindoc": "https://framagit.org/luc/lufi/wikis/home", + "userdoc": "https://yunohost.org/en/app_lufi", + "code": "https://framagit.org/fiat-tux/hat-softwares/lufi" + }, "license": "AGPL-3.0-or-later", "maintainer": { "name": "frju365, cyp", "email": "win10@tutanota.com, cyp@rouquin.me" }, "requirements": { - "yunohost": ">= 4.1.7" + "yunohost": ">= 4.2.0" }, "multi_instance": true, "services": [ 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 a98a4f3..17b4b74 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -141,10 +141,13 @@ else fi ynh_store_file_checksum --file="$config" +chmod 600 $final_path/lufi.conf +chown $app:$app $final_path/lufi.conf + #================================================= # UPDATE SSOWAT #================================================= -ynh_script_progression --message="Reconfigure SSOwat" +ynh_script_progression --message="Reconfiguring permissions..." ynh_permission_update --permission="main" --add="visitors" diff --git a/scripts/install b/scripts/install index b3ae194..918714e 100644 --- a/scripts/install +++ b/scripts/install @@ -76,6 +76,14 @@ ynh_script_progression --message="Installing dependencies..." ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Configuring system user..." + +# Create a system user +ynh_system_user_create --username=$app + #================================================= # CREATE A POSTGRESQL DATABASE #================================================= @@ -106,14 +114,6 @@ ynh_script_progression --message="Configuring NGINX web server..." # Create a dedicated NGINX config ynh_add_nginx_config max_file_size -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." - -# Create a system user -ynh_system_user_create --username=$app - #================================================= # SPECIFIC SETUP #================================================= @@ -144,6 +144,9 @@ fi ynh_store_file_checksum --file="$config" +chmod 600 $final_path/lufi.conf +chown $app:$app $final_path/lufi.conf + #================================================= # INSTALL LUFI #================================================= @@ -158,9 +161,6 @@ popd #================================================= ynh_script_progression --message="Setuping a cron..." -# cp ../conf/cron_lufi /etc/cron.d/$app -# ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path/" --target_file="/etc/cron.d/$app" -# ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="/etc/cron.d/$app" ynh_add_config --template="../conf/cron_lufi" --destination="/etc/cron.d/$app" chmod +x $final_path/script/lufi diff --git a/scripts/remove b/scripts/remove index 7640fa9..0cca7d3 100644 --- a/scripts/remove +++ b/scripts/remove @@ -83,16 +83,6 @@ ynh_script_progression --message="Removing logrotate configuration..." # Remove the app-specific logrotate config ynh_remove_logrotate -#================================================= -# CLOSE A PORT -#================================================= - -if yunohost firewall list | grep -q "\- $port$" -then - ynh_script_progression --message="Closing port $port..." - ynh_exec_warn_less yunohost firewall disallow TCP $port -fi - #================================================= # SPECIFIC REMOVE #================================================= diff --git a/scripts/restore b/scripts/restore index 8790bf1..a6153c4 100644 --- a/scripts/restore +++ b/scripts/restore @@ -53,13 +53,6 @@ ynh_script_progression --message="Restoring NGINX configuration..." ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# RESTORE THE APP MAIN DIR -#================================================= -ynh_script_progression --message="Restoring the app main directory..." - -ynh_restore_file --origin_path="$final_path" - #================================================= # RECREATE THE DEDICATED USER #================================================= @@ -68,6 +61,13 @@ ynh_script_progression --message="Recreating the dedicated system user..." # Create the dedicated user (if not existing) ynh_system_user_create --username=$app +#================================================= +# RESTORE THE APP MAIN DIR +#================================================= +ynh_script_progression --message="Restoring the app main directory..." + +ynh_restore_file --origin_path="$final_path" + #================================================= # RESTORE USER RIGHTS #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index a47faf4..bea6a94 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -39,19 +39,18 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Ensuring downward compatibility..." +# If db_name doesn't exist, create it +if [ -z "$db_name" ]; then + db_name=$(ynh_sanitize_dbid --db_name=$app) + ynh_app_setting_set --app=$app --key=db_name --value=$db_name +fi + # 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 -if [ -z "$db_pwd" ]; then - # Need to install new dependencies before creating the new database - need_migration_from_sqlite_to_psql=1 -else - need_migration_from_sqlite_to_psql=0 -fi - if [ -z "$max_file_size" ]; then max_file_size=100 # 100 Mo ynh_app_setting_set --app=$app --key=max_file_size --value=$max_file_size @@ -86,7 +85,15 @@ ynh_abort_if_errors #================================================= ynh_script_progression --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action="stop" --log_path="$final_path/log/production.log" +ynh_systemd_action --service_name=$app --action=stop --log_path="$final_path/log/production.log" + +#================================================= +# 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 #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -115,36 +122,10 @@ ynh_script_progression --message="Upgrading dependencies..." ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies -#================================================= -# 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 - -#================================================= -# SPECIFIC UPGRADE -#================================================= -# CREATE A POSTGRESQL DATABASE IF NEEDED -#================================================= - -if [ $need_migration_from_sqlite_to_psql -eq 1 ]; then - ynh_print_info --message="Creating a PostgreSQL database..." - # Create postgresql database - ynh_psql_test_if_first_run - db_name=$(ynh_sanitize_dbid --db_name=$app) - db_user=$db_name - ynh_app_setting_set --app=$app --key=db_name --value=$db_name - # Initialize database and store postgres password for upgrade - ynh_psql_setup_db --db_user=$db_user --db_name=$db_name - db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) # Password created in ynh_psql_setup_db function -fi - #================================================= # SETUP LUFI #================================================= -ynh_script_progression --message="Configuring lufi..." +ynh_script_progression --message="Configuring Lufi..." config=${final_path}/lufi.conf ynh_backup_if_checksum_is_different --file="$config" @@ -170,28 +151,16 @@ fi ynh_store_file_checksum --file="$config" +chmod 600 $final_path/lufi.conf +chown $app:$app $final_path/lufi.conf + #================================================= # BUILD LUFI #================================================= ynh_script_progression --message="Building Lufi..." pushd $final_path -# Migrate from SQLite to PostgreSQL -if [ $need_migration_from_sqlite_to_psql -eq 1 ]; then - # Preinstall with sqlite - carton install --deployment --without=mysql --without=htpasswd --without=test - - # if /var/log/$app/production.log is a symbolic link, then move it to $final_path/log/production.log - if [ ! -L "/var/log/$app/production.log" ] - then - mv "/var/log/$app/production.log" "$final_path/log/production.log" - chown -R $app: "$final_path/log/production.log" - fi - - carton exec script/lufi sqliteToOtherDB -fi - -carton install --deployment --without=sqlite --without=mysql --without=htpasswd --without=test + carton install --deployment --without=sqlite --without=mysql --without=htpasswd --without=test popd #================================================= @@ -233,12 +202,12 @@ ynh_add_systemd_config ynh_script_progression --message="Securing files and directories..." # Set permissions on app files -chown -R $app: $final_path +chown -R $app:$app $final_path #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Upgrading SSOwat configuration..." +ynh_script_progression --message="Upgrading permissions..." ynh_permission_update --permission="main" --add="visitors"