From 22225e8d0ad5a447a19ff5e8dc21363335212239 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 26 Feb 2021 03:34:51 +0100 Subject: [PATCH 01/10] Apply example_ynh --- README.md | 2 +- README_fr.md | 10 +++--- issue_template.md | 29 +++++++++++------ manifest.json | 2 +- pull_request_template.md | 4 +-- scripts/backup | 2 +- scripts/install | 12 +++---- scripts/remove | 7 ++-- scripts/restore | 4 +-- scripts/upgrade | 70 +++++++++++++++++++--------------------- 10 files changed, 73 insertions(+), 69 deletions(-) diff --git a/README.md b/README.md index c102479..d753472 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ Want to see in action? * Report a bug: https://github.com/YunoHost-Apps/peertube_ynh/issues * App website: https://joinpeertube.org/fr/ - * GitHub App website: https://github.com/Chocobozzz/PeerTube/ + * Upstream app repository: https://github.com/Chocobozzz/PeerTube/ * YunoHost website: https://yunohost.org/ --- diff --git a/README_fr.md b/README_fr.md index ad91989..941d29a 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,7 +1,7 @@ # PeerTube pour YunoHost [![Niveau d'intégration](https://dash.yunohost.org/integration/peertube.svg)](https://dash.yunohost.org/appci/app/peertube) ![](https://ci-apps.yunohost.org/ci/badges/peertube.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/peertube.maintain.svg) -[![Installer PeerTube pour YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=peertube) +[![Installer PeerTube avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=peertube) *[Read this readme in english.](./README.md)* @@ -72,13 +72,13 @@ En regardant une vidéo, vous aidez l'hébergeur à la diffuser en devenant vous --- -## Developer info +## Informations pour les développeurs -Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/peertube_ynh/tree/testing). +Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/peertube_ynh/tree/testing). -To try the testing branch, please proceed like that. +Pour essayer la branche testing, procédez comme suit. ``` sudo yunohost app install https://github.com/YunoHost-Apps/peertube_ynh/tree/testing --debug -or +ou sudo yunohost app upgrade peertube -u https://github.com/YunoHost-Apps/peertube_ynh/tree/testing --debug ``` diff --git a/issue_template.md b/issue_template.md index b695583..4bd409c 100644 --- a/issue_template.md +++ b/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. --- @@ -9,24 +9,26 @@ about: Create a report to help us debug, it would be nice to fill the template a 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 PeerTube 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 peertube @@ -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/manifest.json b/manifest.json index 66323d3..290da71 100644 --- a/manifest.json +++ b/manifest.json @@ -19,7 +19,7 @@ } ], "requirements": { - "yunohost": ">= 3.8.1" + "yunohost": ">= 4.1.3" }, "multi_instance": false, "services": [ diff --git a/pull_request_template.md b/pull_request_template.md index 4190ff6..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/peertube_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/peertube_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/backup b/scripts/backup index 7837123..8c58481 100644 --- a/scripts/backup +++ b/scripts/backup @@ -29,7 +29,7 @@ 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) -db_name=$(ynh_app_setting_get --app=$app --key=psql_db) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= diff --git a/scripts/install b/scripts/install index a4edbe7..335a1f7 100644 --- a/scripts/install +++ b/scripts/install @@ -54,7 +54,6 @@ ynh_script_progression --message="Storing installation settings..." ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=admin_email --value=$admin_email ynh_app_setting_set --app=$app --key=admin_pass --value=$admin_pass -ynh_app_setting_set --app=$app --key=is_public --value=$is_public ynh_app_setting_set --app=$app --key=datadir --value=$datadir #================================================= @@ -106,8 +105,8 @@ ynh_script_progression --message="Creating a PostgreSQL database..." db_name="peertube_${app}" db_user=$app db_pwd=$(ynh_string_random --length=30) -ynh_app_setting_set --app=$app --key=psql_db --value=$db_name -ynh_app_setting_set --app=$app --key=psqlpwd --value=$db_pwd +ynh_app_setting_set --app=$app --key=db_name --value=$db_name +ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd ynh_psql_test_if_first_run ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd @@ -236,13 +235,14 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --l #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." +ynh_script_progression --message="Configuring permissions..." # Make app public if necessary if [ $is_public -eq 1 ] then - # unprotected_uris allows SSO credentials to be passed anyway. - 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" fi #================================================= diff --git a/scripts/remove b/scripts/remove index a8a15b4..c3922ae 100644 --- a/scripts/remove +++ b/scripts/remove @@ -20,7 +20,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) port=$(ynh_app_setting_get --app=$app --key=port) rtmp_port=$(ynh_app_setting_get --app=$app --key=rtmp_port) -db_name=$(ynh_app_setting_get --app=$app --key=psql_db) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$app final_path=$(ynh_app_setting_get --app=$app --key=final_path) admin_email=$(ynh_app_setting_get --app=$app --key=admin_email) @@ -53,7 +53,7 @@ ynh_remove_systemd_config ynh_script_progression --message="Removing the PostgreSQL database..." # Remove a database if it exists, along with the associated user -ynh_psql_remove_db --db_user="$db_user" --db_name="$db_name" +ynh_psql_remove_db --db_user=$db_user --db_name=$db_name #================================================= # REMOVE DEPENDENCIES @@ -61,9 +61,8 @@ ynh_psql_remove_db --db_user="$db_user" --db_name="$db_name" ynh_script_progression --message="Removing dependencies..." # Remove metapackage and its dependencies -ynh_remove_app_dependencies - ynh_remove_nodejs +ynh_remove_app_dependencies #================================================= # REMOVE APP MAIN DIR diff --git a/scripts/restore b/scripts/restore index adc0f06..70a2ac2 100644 --- a/scripts/restore +++ b/scripts/restore @@ -32,9 +32,9 @@ path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) port=$(ynh_app_setting_get --app=$app --key=port) rtmp_port=$(ynh_app_setting_get --app=$app --key=rtmp_port) -db_name=$(ynh_app_setting_get --app=$app --key=psql_db) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$app -db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) +db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index f4521d6..8b4eb1b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -23,8 +23,8 @@ admin_email=$(ynh_app_setting_get --app=$app --key=admin_email) final_path=$(ynh_app_setting_get --app=$app --key=final_path) port=$(ynh_app_setting_get --app=$app --key=port) rtmp_port=$(ynh_app_setting_get --app=$app --key=rtmp_port) -db_name=$(ynh_app_setting_get --app=$app --key=psql_db) -db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) +db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= @@ -39,19 +39,22 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Ensuring downward compatibility..." -# Fix is_public as a boolean value -if [ "$is_public" = "Yes" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=1 - is_public=1 -elif [ "$is_public" = "No" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=0 - is_public=0 +# If db_name doesn't exist, create it +if [ -z "$db_name" ]; then + db_name="peertube_${app}" + ynh_app_setting_set --app=$app --key=db_name --value=$db_name +fi + +# If db_pwd doesn't exist, create it +if [ -z "$db_pwd" ]; then + db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) + ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd fi if [ -z "$datadir" ]; then - datadir="/home/yunohost.app/${app}/storage" - ynh_app_setting_set --app=$app --key=datadir --value=$datadir + datadir="/home/yunohost.app/${app}/storage" + ynh_app_setting_set --app=$app --key=datadir --value=$datadir fi # Close a port @@ -71,13 +74,20 @@ ynh_secure_remove --file="/etc/apt/sources.list.d/yarn.list" if [ -z "$rtmp_port" ]; then - rtmp_port=1935 - ynh_port_available --port=$rtmp_port || ynh_die "Port $rtmp_port is needs to be available for this app" - ynh_app_setting_set --app=$app --key=rtmp_port --value=$rtmp_port - - # Open the port - ynh_script_progression --message="Configuring firewall..." - ynh_exec_warn_less yunohost firewall allow TCP $rtmp_port + rtmp_port=1935 + ynh_port_available --port=$rtmp_port || ynh_die "Port $rtmp_port is needs to be available for this app" + ynh_app_setting_set --app=$app --key=rtmp_port --value=$rtmp_port + + # Open the port + ynh_script_progression --message="Configuring firewall..." + ynh_exec_warn_less yunohost firewall allow TCP $rtmp_port +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 #================================================= @@ -119,23 +129,23 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." - + # Create a temporary directory tmpdir="$(mktemp -d)" - + # Backup the config file in the temp dir cp -a "$final_path/config/production.yaml" "$tmpdir/production.yaml" if [ -s "$final_path/config/local-production.json" ] then cp -a "$final_path/config/local-production.json" "$tmpdir/local-production.json" fi - + # Remove the app directory securely ynh_secure_remove --file="$final_path" - + # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" - + #Copy the admin saved settings from tmp directory to final path cp -a "$tmpdir/production.yaml" "$final_path/config/production.yaml" @@ -145,7 +155,7 @@ then else cp ../conf/local-production.json "$final_path/config/local-production.json" fi - + # Remove the tmp directory securely ynh_secure_remove --file="$tmpdir" fi @@ -280,18 +290,6 @@ ynh_script_progression --message="Starting a systemd service..." ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Server listening on localhost" -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Upgrading SSOwat configuration..." - -# Make app public if necessary -if [ $is_public -eq 1 ] -then - # unprotected_uris allows SSO credentials to be passed anyway - ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" -fi - #================================================= # RELOAD NGINX #================================================= From bd9836aecf2c87cf5982b83b8aa8fb1c363d3ae8 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 26 Feb 2021 03:48:49 +0100 Subject: [PATCH 02/10] ynh_add_config --- conf/production.yaml | 6 +++--- scripts/install | 32 ++++---------------------------- scripts/remove | 9 ++------- scripts/upgrade | 12 +----------- 4 files changed, 10 insertions(+), 49 deletions(-) diff --git a/conf/production.yaml b/conf/production.yaml index 2b79ab4..ede8aa8 100644 --- a/conf/production.yaml +++ b/conf/production.yaml @@ -37,8 +37,8 @@ database: hostname: 'localhost' port: 5432 ssl: false - suffix: '___DB_NAME__' - username: '__DB_NAME__' + suffix: '___APP__' + username: '__DB_USER__' password: '__DB_PWD__' pool: max: 5 @@ -203,7 +203,7 @@ cache: admin: # Used to generate the root user at first startup # And to receive emails from the contact form - email: '__EMAIL__' + email: '__ADMIN_EMAIL__' contact_form: enabled: true diff --git a/scripts/install b/scripts/install index 335a1f7..2e5a514 100644 --- a/scripts/install +++ b/scripts/install @@ -156,28 +156,9 @@ chown -R "$app":"$app" "$datadir" #================================================= ynh_script_progression --message="Modifying a config file..." -config="$final_path/config/production.yaml" -cp ../conf/production.yaml "$config" -ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config" -ynh_replace_string --match_string="__DB_NAME__" --replace_string="$app" --target_file="$config" -ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$config" -ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config" -ynh_replace_string --match_string="__EMAIL__" --replace_string="$admin_email" --target_file="$config" -ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config" -ynh_replace_string --match_string="__DATADIR__" --replace_string="$datadir" --target_file="$config" +ynh_add_config --template="../conf/production.yaml" --destination="$final_path/config/production.yaml" -#Create the admin settings file -local_config="$final_path/config/local-production.json" -cp ../conf/local-production.json "$local_config" - -#================================================= -# STORE THE CHECKSUM OF THE CONFIG FILE -#================================================= -ynh_script_progression --message="Storing the config file checksum..." - -# Calculate and store the config file checksum into the app settings -ynh_store_file_checksum --file="$config" -ynh_store_file_checksum --file="$local_config" +ynh_add_config --template="../conf/local-production.json" --destination="$final_path/config/local-production.json" #================================================= # BUILD YARN DEPENDENCIES @@ -266,13 +247,8 @@ popd #================================================= ynh_script_progression --message="Sending a readme for the admin..." -ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../conf/message_install" -ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="../conf/message_install" -ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="../conf/message_install" -ynh_replace_string --match_string="__ADMIN_PASS__" --replace_string="$admin_pass" --target_file="../conf/message_install" -ynh_replace_string --match_string="__RTMP_PORT__" --replace_string="$rtmp_port" --target_file="../conf/message_install" - -ynh_send_readme_to_admin --app_message="../conf/message_install" --recipients=$admin_email --type='install' +ynh_add_config --template="../conf/message_install" --destination="../conf/msg_install" +ynh_send_readme_to_admin --app_message="../conf/msg_install" --recipients=$admin_email --type='install' #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index c3922ae..fa4533b 100644 --- a/scripts/remove +++ b/scripts/remove @@ -119,13 +119,8 @@ ynh_system_user_delete --username=$app #================================================= ynh_script_progression --message="Sending a readme for the admin..." -ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../conf/message_remove" -ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="../conf/message_remove" -ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="../conf/message_remove" -ynh_replace_string --match_string="__DATADIR__" --replace_string="$datadir" --target_file="../conf/message_remove" -ynh_replace_string --match_string="__RTMP_PORT__" --replace_string="$rtmp_port" --target_file="../conf/message" - -ynh_send_readme_to_admin --app_message="../conf/message_remove" --recipients=$admin_email --type='remove' +ynh_add_config --template="../conf/message_remove" --destination="../conf/msg_remove" +ynh_send_readme_to_admin --app_message="../conf/msg_remove" --recipients=$admin_email --type='remove' #================================================= # END OF SCRIPT diff --git a/scripts/upgrade b/scripts/upgrade index 8b4eb1b..2f0de71 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -222,17 +222,7 @@ chown -R "$app":"$app" "$datadir" #================================================= ynh_script_progression --message="Modifying a config file..." -config="$final_path/config/production.yaml" -ynh_backup_if_checksum_is_different --file="$config" -cp ../conf/production.yaml "$config" -ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config" -ynh_replace_string --match_string="__DB_NAME__" --replace_string="$app" --target_file="$config" -ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$config" -ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config" -ynh_replace_string --match_string="__EMAIL__" --replace_string="$admin_email" --target_file="$config" -ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config" -ynh_replace_string --match_string="__DATADIR__" --replace_string="$datadir" --target_file="$config" -ynh_store_file_checksum --file="$config" +ynh_add_config --template="../conf/production.yaml" --destination="$final_path/config/production.yaml" local_config="$final_path/config/local-production.json" ynh_backup_if_checksum_is_different --file="$local_config" From 38cbc3b137aa66f31caa0a09e9ea27be0559fa1e Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 26 Feb 2021 03:50:36 +0100 Subject: [PATCH 03/10] Cleanup --- scripts/upgrade | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 2f0de71..3f1154e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -18,7 +18,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) -is_public=$(ynh_app_setting_get --app=$app --key=is_public) admin_email=$(ynh_app_setting_get --app=$app --key=admin_email) final_path=$(ynh_app_setting_get --app=$app --key=final_path) port=$(ynh_app_setting_get --app=$app --key=port) From e8c4305c872db7db09de4b5aebf71f8e2d451765 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 26 Feb 2021 04:16:57 +0100 Subject: [PATCH 04/10] switch from email to user --- manifest.json | 10 +++++----- scripts/install | 7 ++++--- scripts/upgrade | 3 ++- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/manifest.json b/manifest.json index 290da71..593a829 100644 --- a/manifest.json +++ b/manifest.json @@ -37,13 +37,13 @@ "example": "example.com" }, { - "name": "email", - "type": "string", + "name": "admin", + "type": "user", "ask": { - "en": "Choose an admin email (can be changed after installation)", - "fr": "Choisissez une adresse e-mail d'administrateur (peut être modifiée après l'installation)" + "en": "Choose an admin user", + "fr": "Choisissez l'administrateur" }, - "example": "johndoe@example.com" + "example": "johndoe" }, { "name": "is_public", diff --git a/scripts/install b/scripts/install index 2e5a514..0704a90 100644 --- a/scripts/install +++ b/scripts/install @@ -26,9 +26,10 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url="/" -admin_email=$YNH_APP_ARG_EMAIL -admin_pass=$(ynh_string_random --length=24) +admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC +admin_email=$(ynh_user_get_info --username=$admin --key="mail") +admin_pass=$(ynh_string_random --length=24) app=$YNH_APP_INSTANCE_NAME @@ -52,8 +53,8 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url ynh_script_progression --message="Storing installation settings..." ynh_app_setting_set --app=$app --key=domain --value=$domain +ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=admin_email --value=$admin_email -ynh_app_setting_set --app=$app --key=admin_pass --value=$admin_pass ynh_app_setting_set --app=$app --key=datadir --value=$datadir #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 3f1154e..1f76327 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -18,7 +18,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) -admin_email=$(ynh_app_setting_get --app=$app --key=admin_email) final_path=$(ynh_app_setting_get --app=$app --key=final_path) port=$(ynh_app_setting_get --app=$app --key=port) rtmp_port=$(ynh_app_setting_get --app=$app --key=rtmp_port) @@ -38,6 +37,8 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Ensuring downward compatibility..." +ynh_app_setting_delete --app=$app --key=admin_pass + # If db_name doesn't exist, create it if [ -z "$db_name" ]; then db_name="peertube_${app}" From 6d9973c494dca93b94671f69cf72a4f0b4e3ce78 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 28 Feb 2021 20:16:04 +0100 Subject: [PATCH 05/10] YunoHost 4.2 --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 593a829..2fbe9e0 100644 --- a/manifest.json +++ b/manifest.json @@ -19,7 +19,7 @@ } ], "requirements": { - "yunohost": ">= 4.1.3" + "yunohost": ">= 4.2" }, "multi_instance": false, "services": [ From cfb6dd570da44695cedd030b22295a5f75a51d26 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 1 Mar 2021 02:27:44 +0100 Subject: [PATCH 06/10] Implement auth_header Fix #119 and #161 --- scripts/install | 2 ++ scripts/upgrade | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/scripts/install b/scripts/install index 0704a90..bb64ab9 100644 --- a/scripts/install +++ b/scripts/install @@ -227,6 +227,8 @@ 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" + #================================================= # RELOAD NGINX #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 1f76327..13d8e5a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -90,6 +90,11 @@ if ynh_legacy_permissions_exists; then 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 + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= From 23421172dbf5617273d7aa1c4e698ff19665e6fa Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 2 Mar 2021 08:18:32 +0100 Subject: [PATCH 07/10] YunoHost 4.1.7.3 --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 2fbe9e0..3cc83f3 100644 --- a/manifest.json +++ b/manifest.json @@ -19,7 +19,7 @@ } ], "requirements": { - "yunohost": ">= 4.2" + "yunohost": ">= 4.1.7.3" }, "multi_instance": false, "services": [ From bf1e38ee69dbf3d74111b3bdc2ad4839e8b06778 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 3 Mar 2021 14:42:35 +0100 Subject: [PATCH 08/10] Fix missing admin_email --- scripts/install | 1 - scripts/remove | 3 ++- scripts/upgrade | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index bb64ab9..f24c8d2 100644 --- a/scripts/install +++ b/scripts/install @@ -54,7 +54,6 @@ ynh_script_progression --message="Storing installation settings..." ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=admin --value=$admin -ynh_app_setting_set --app=$app --key=admin_email --value=$admin_email ynh_app_setting_set --app=$app --key=datadir --value=$datadir #================================================= diff --git a/scripts/remove b/scripts/remove index fa4533b..b5cff17 100644 --- a/scripts/remove +++ b/scripts/remove @@ -23,7 +23,8 @@ rtmp_port=$(ynh_app_setting_get --app=$app --key=rtmp_port) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$app final_path=$(ynh_app_setting_get --app=$app --key=final_path) -admin_email=$(ynh_app_setting_get --app=$app --key=admin_email) +admin=$(ynh_app_setting_get --app=$app --key=admin) +admin_email=$(ynh_user_get_info --username=$admin --key="mail") datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 13d8e5a..3e3dead 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,6 +24,8 @@ rtmp_port=$(ynh_app_setting_get --app=$app --key=rtmp_port) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) datadir=$(ynh_app_setting_get --app=$app --key=datadir) +admin=$(ynh_app_setting_get --app=$app --key=admin) +admin_email=$(ynh_user_get_info --username=$admin --key="mail") #================================================= # CHECK VERSION @@ -38,6 +40,7 @@ upgrade_type=$(ynh_check_app_version_changed) ynh_script_progression --message="Ensuring downward compatibility..." ynh_app_setting_delete --app=$app --key=admin_pass +ynh_app_setting_delete --app=$app --key=admin_email # If db_name doesn't exist, create it if [ -z "$db_name" ]; then From 0b90adcfa20d5688c87bf4867bee3d2bc3dc9de4 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 4 Mar 2021 08:15:15 +0100 Subject: [PATCH 09/10] fix upgrade --- scripts/upgrade | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/upgrade b/scripts/upgrade index 3e3dead..26c512f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -22,6 +22,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) port=$(ynh_app_setting_get --app=$app --key=port) rtmp_port=$(ynh_app_setting_get --app=$app --key=rtmp_port) db_name=$(ynh_app_setting_get --app=$app --key=db_name) +db_user=$app db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) datadir=$(ynh_app_setting_get --app=$app --key=datadir) admin=$(ynh_app_setting_get --app=$app --key=admin) From 5e62f1c1fe2201e8f522fce7e41495ef69d14f27 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 4 Mar 2021 08:16:21 +0100 Subject: [PATCH 10/10] fix remove --- scripts/remove | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/remove b/scripts/remove index b5cff17..7950022 100644 --- a/scripts/remove +++ b/scripts/remove @@ -26,6 +26,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) admin=$(ynh_app_setting_get --app=$app --key=admin) admin_email=$(ynh_user_get_info --username=$admin --key="mail") datadir=$(ynh_app_setting_get --app=$app --key=datadir) +path_url=$(ynh_app_setting_get --app=$app --key=path) #================================================= # STANDARD REMOVE