From 346f8924840a6a5ee01a7cbcf71a6290c2776a66 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 26 Feb 2021 01:50:19 +0100 Subject: [PATCH] Apply example_ynh --- README.md | 9 ++------- check_process | 5 ----- issue_template.md | 35 ++++++++++++++++++++++------------- manifest.json | 10 +++++----- pull_request_template.md | 4 +--- scripts/install | 11 +++++++---- scripts/remove | 3 +-- scripts/restore | 2 +- scripts/upgrade | 23 ++++++++++------------- 9 files changed, 49 insertions(+), 53 deletions(-) diff --git a/README.md b/README.md index e8f82f9..8dbc1f9 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Syncthing for YunoHost [![Integration level](https://dash.yunohost.org/integration/syncthing.svg)](https://dash.yunohost.org/appci/app/syncthing) ![](https://ci-apps.yunohost.org/ci/badges/syncthing.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/syncthing.maintain.svg) -[![Install Syncthing with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=syncthing) +[![Install Syncthing with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=syncthing) > *This package allows you to install Syncthing 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.* @@ -15,10 +15,6 @@ Syncthing replaces proprietary sync and cloud services with something open, trus ![](https://docs.syncthing.net/_images/gs1.png) -## Configuration - -How to configure this app: by an admin panel, a plain file with SSH, or any other way. - ## Documentation * Official documentation: https://docs.syncthing.net @@ -39,8 +35,7 @@ How to configure this app: by an admin panel, a plain file with SSH, or any othe --- -Developer info ----------------- +## Developer info Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/syncthing_ynh/tree/testing). diff --git a/check_process b/check_process index 19a138d..dec6edb 100644 --- a/check_process +++ b/check_process @@ -36,13 +36,8 @@ upgrade=1 from_commit=89687d0fb06f4743328b1198c7861d7d9d624641 backup_restore=1 multi_instance=0 - # This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version. - # incorrect_path=1 port_already_use=0 change_url=0 -;;; Levels - # If the level 5 (Package linter) is forced to 1. Please add justifications here. - Level 5=auto ;;; Options Email=yalh@yahoo.com Notification=all diff --git a/issue_template.md b/issue_template.md index 1db9a8e..6208360 100644 --- a/issue_template.md +++ b/issue_template.md @@ -1,32 +1,34 @@ --- 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. --- **How to post a meaningful bug report** 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!* + - *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 Syncthing itself. Refer to its documentation or repository for help.* - - *If you have a doubt, post here, we will figure it out together.* + - *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 | ...* -- Are you in a special context or did you perform some particular tweaking on your YunoHost instance ?: *no / yes* +- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes* - If yes, please explain: - 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 syncthing @@ -34,13 +36,20 @@ about: Create a report to help us debug, it would be nice to fill the template a - *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:* 1. *Go to '...'* - 2. *Click on '....'* - 3. *Scroll down to '....'* + 2. *Click on '...'* + 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/manifest.json b/manifest.json index ffaec3c..784b436 100644 --- a/manifest.json +++ b/manifest.json @@ -19,7 +19,7 @@ } ], "requirements": { - "yunohost": ">= 3.5" + "yunohost": ">= 4.1.3" }, "multi_instance": false, "services": [ @@ -34,7 +34,7 @@ "en": "Choose a domain for Syncthing", "fr": "Choisissez un nom de domaine pour Syncthing" }, - "example": "domain.org" + "example": "example.com" }, { "name": "path", @@ -50,9 +50,9 @@ "name": "admin", "type": "user", "ask": { - "en": "Choose the user for Syncthing (must be an existing YunoHost user)", - "fr": "Choisissez l'utilisateur de Syncthing (doit ĂȘtre un utilisateur YunoHost existant)" - }, + "en": "Choose an admin user", + "fr": "Choisissez l'administrateur" + }, "example": "johndoe" } ] diff --git a/pull_request_template.md b/pull_request_template.md index 8ca4b1f..6c28fc5 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -13,6 +13,4 @@ ## Package_check results --- -*If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results* - -[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/syncthing_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/syncthing_ynh%20PR-NUM-%20(USERNAME)/) +* 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/install b/scripts/install index 10a1496..57fe58f 100644 --- a/scripts/install +++ b/scripts/install @@ -59,7 +59,7 @@ ynh_app_setting_set --app=$app --key=sync_home --value=$sync_home #================================================= # FIND AND OPEN A PORT #================================================= -ynh_script_progression --message="Configuring firewall..." +ynh_script_progression --message="Finding an available port..." # Find an available port gui_port=$(ynh_find_port --port=8384) @@ -67,7 +67,9 @@ ynh_app_setting_set --app=$app --key=gui_port --value=$gui_port sync_port=$(ynh_find_port --port=22000) ynh_app_setting_set --app=$app --key=sync_port --value=$sync_port + # Open the port +ynh_script_progression --message="Configuring firewall..." ynh_exec_warn_less yunohost firewall allow TCP $sync_port #================================================= @@ -174,10 +176,11 @@ ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --lin #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." +ynh_script_progression --message="Configuring permissions..." -# Make app public -ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" +# Everyone can access the app. +# The "main" permission is automatically created before the install script. +ynh_permission_update --permission="main" --add="visitors" #================================================= # RELOAD NGINX diff --git a/scripts/remove b/scripts/remove index a219726..60b3656 100644 --- a/scripts/remove +++ b/scripts/remove @@ -17,7 +17,6 @@ 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) sync_port=$(ynh_app_setting_get --app=$app --key=sync_port) @@ -31,7 +30,7 @@ sync_port=$(ynh_app_setting_get --app=$app --key=sync_port) # Remove the service from the list of services known by Yunohost (added from `yunohost service add`) if ynh_exec_warn_less yunohost service status $app >/dev/null then - ynh_script_progression --message="Removing $app service..." + ynh_script_progression --message="Removing $app service integration..." yunohost service remove $app fi diff --git a/scripts/restore b/scripts/restore index b51c5ca..323bb7b 100644 --- a/scripts/restore +++ b/scripts/restore @@ -121,7 +121,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --lin #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/upgrade b/scripts/upgrade index 96ad24e..ac47955 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -19,7 +19,6 @@ 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) sync_home=$(ynh_app_setting_get --app=$app --key=sync_home) @@ -38,10 +37,15 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Ensuring downward compatibility..." +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + # If gui_port doesn't exist, create it if [ -z $gui_port ]; then - - OLD_SYNCHOME="/home/yunohost.app/syncthing" OLD_SYNCUSER=debian-syncthing OLD_SYNCPORT=22000 @@ -175,13 +179,6 @@ ynh_script_progression --message="Upgrading systemd configuration..." # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." - -yunohost service add $app --description "$app daemon for Syncthing" --needs_exposed_ports $sync_port - #================================================= # GENERIC FINALIZATION #================================================= @@ -193,11 +190,11 @@ ynh_script_progression --message="Securing files and directories..." chown -R $app: $final_path #================================================= -# SETUP SSOWAT +# INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Upgrading SSOwat configuration..." +ynh_script_progression --message="Integrating service in YunoHost..." -ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" +yunohost service add $app --description "$app daemon for Syncthing" --needs_exposed_ports $sync_port #================================================= # START SYSTEMD SERVICE