From a5e59df272df21eabd6de27f2210a7bb961179f0 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 9 May 2022 20:25:01 +0200 Subject: [PATCH 1/6] Upgrade to 2022.05.09~ynh1 --- conf/app.src | 6 +++--- manifest.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/conf/app.src b/conf/app.src index c9d31d7..8fd3f61 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,7 +1,7 @@ -SOURCE_URL=https://github.com/spacedeck/spacedeck-open/archive/aacc3a8f1039834cc686674f3a2bac45d77a014b.zip -SOURCE_SUM=F16843F2F7382C071058594463423397B4A7F7C4E86855923047B791F8B3B380 +SOURCE_URL=https://github.com/spacedeck/spacedeck-open/archive/1109537675cd83f87499a37d37ef6b7a6efcaa4d.tar.gz +SOURCE_SUM=2abb471efb7343ee809cfe389e0d9c7a8c7359765d56d80725758b804a72d848 SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=zip +SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true SOURCE_FILENAME= SOURCE_EXTRACT=true diff --git a/manifest.json b/manifest.json index 5bf48e4..0cc7d2b 100644 --- a/manifest.json +++ b/manifest.json @@ -5,7 +5,7 @@ "description": { "en": "A web based, real time, collaborative whiteboard application with rich media support" }, - "version": "2021.08.10~ynh1", + "version": "2022.05.09~ynh1", "url": "https://spacedeck.com", "upstream": { "license": "AGPL-3.0-only", From eb26d569ab73080bd4ec33a52bb77912b9d44ede Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 9 May 2022 20:43:21 +0200 Subject: [PATCH 2/6] Apply last example_ynh --- check_process | 4 --- conf/default.json | 73 +++++++++++++++++++++++----------------------- scripts/change_url | 1 + scripts/install | 1 - scripts/restore | 3 +- scripts/upgrade | 1 - 6 files changed, 38 insertions(+), 45 deletions(-) diff --git a/check_process b/check_process index 0b4078d..cf97ffd 100644 --- a/check_process +++ b/check_process @@ -18,7 +18,3 @@ ;;; Options Email= Notification=none -;;; Upgrade options - ; commit=CommitHash - name=Name and date of the commit. - manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1& diff --git a/conf/default.json b/conf/default.json index 14e2038..369d8a8 100644 --- a/conf/default.json +++ b/conf/default.json @@ -1,39 +1,38 @@ { - "team_name": "My Open Spacedeck", - "contact_email": "webmaster@__DOMAIN__", - - "host": "localhost", - "port": __PORT__, - "endpoint": "https://__DOMAIN____PATH__", - "invite_code": "__INVITE_SECRET__", - - "storage_dialect": "sqlite", - - "storage_host": "localhost", - "storage_database": "spacedeck", - "storage_username": "username", - "storage_password": "password", - - "storage_local_path": "__DATADIR__/storage", - "storage_local_db": "./database/database.sqlite", - "storage_region": "eu-central-1", - "storage_endpoint": "http://localhost:4572", - "storage_bucket": "my_spacedeck_bucket", - "storage_cdn": "/storage", - - "mongodb_host": "localhost", - "redis_mock": true, - "redis_host": "localhost", + "team_name": "YunoHost Spacedeck", + "contact_email": "webmaster@__DOMAIN__", - "export_api_secret": "__API_SECRET__", - - "mail_provider": "smtp", - "mail_smtp_host": "localhost", - "mail_smtp_port": 587, - "mail_smtp_secure": false, - "mail_smtp_require_tls": false, - "mail_smtp_user": "__APP__@__DOMAIN__", - "mail_smtp_pass": "", - "spacedeck": {} - } - \ No newline at end of file + "host": "localhost", + "port": __PORT__, + "endpoint": "https://__DOMAIN____PATH__", + "invite_code": "__INVITE_SECRET__", + + "storage_dialect": "sqlite", + + "storage_host": "localhost", + "storage_database": "spacedeck", + "storage_username": "username", + "storage_password": "password", + + "storage_local_path": "__DATADIR__/storage", + "storage_local_db": "./database/database.sqlite", + "storage_region": "eu-central-1", + "storage_endpoint": "http://localhost:4572", + "storage_bucket": "my_spacedeck_bucket", + "storage_cdn": "/storage", + + "mongodb_host": "localhost", + "redis_mock": true, + "redis_host": "localhost", + + "export_api_secret": "__API_SECRET__", + + "mail_provider": "smtp", + "mail_smtp_host": "localhost", + "mail_smtp_port": 25, + "mail_smtp_secure": false, + "mail_smtp_require_tls": false, + "mail_smtp_user": "__APP__@__DOMAIN__", + "mail_smtp_pass": "", + "spacedeck": {} +} diff --git a/scripts/change_url b/scripts/change_url index dd252b9..7c31186 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -47,6 +47,7 @@ ynh_script_progression --message="Backing up the app before changing its URL (ma # Backup the current version of the app ynh_backup_before_upgrade ynh_clean_setup () { + ynh_clean_check_starting # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" diff --git a/scripts/install b/scripts/install index 2af999a..6e582ae 100755 --- a/scripts/install +++ b/scripts/install @@ -65,7 +65,6 @@ ynh_app_setting_set --app=$app --key=port --value=$port ynh_script_progression --message="Installing dependencies..." --weight=1 ynh_install_app_dependencies $pkg_dependencies - ynh_install_nodejs --nodejs_version=$NODEJS_VERSION #================================================= diff --git a/scripts/restore b/scripts/restore index 5b1ccef..9302439 100755 --- a/scripts/restore +++ b/scripts/restore @@ -45,7 +45,7 @@ test ! -d $final_path \ #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1 +ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1 ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" @@ -90,7 +90,6 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=1 # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies - ynh_install_nodejs --nodejs_version=$NODEJS_VERSION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 4d45d90..1fdf8a4 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -105,7 +105,6 @@ ynh_add_nginx_config ynh_script_progression --message="Upgrading dependencies..." --weight=1 ynh_install_app_dependencies $pkg_dependencies - ynh_install_nodejs --nodejs_version=$NODEJS_VERSION #================================================= From bcedb1a4c3b147515edfa51d8cd0c624fc9f3026 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 9 May 2022 20:47:19 +0200 Subject: [PATCH 3/6] remove audit fix --- scripts/install | 3 +-- scripts/upgrade | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 6e582ae..7e860b4 100755 --- a/scripts/install +++ b/scripts/install @@ -104,8 +104,7 @@ ynh_add_nginx_config ynh_script_progression --message="Installing NodeJS dependencies..." --weight=1 pushd $final_path - ynh_exec_as $app $ynh_node_load_PATH $ynh_npm --loglevel=error install - ynh_exec_as $app $ynh_node_load_PATH $ynh_npm --loglevel=error audit fix + ynh_exec_as $app $ynh_node_load_PATH $ynh_npm --loglevel=error install popd #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 1fdf8a4..7e3aad2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -116,7 +116,6 @@ ynh_script_progression --message="Installing NodeJS dependencies..." --weight=1 pushd $final_path ynh_exec_as $app $ynh_node_load_PATH $ynh_npm --loglevel=error install - ynh_exec_as $app $ynh_node_load_PATH $ynh_npm --loglevel=error audit fix popd #================================================= From 15961e9eb0be8db632e994cf9626190dfe79cd17 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 9 May 2022 18:47:23 +0000 Subject: [PATCH 4/6] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4517c41..356f718 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 A web based, real time, collaborative whiteboard application with rich media support -**Shipped version:** 2021.08.10~ynh1 +**Shipped version:** 2022.05.09~ynh1 diff --git a/README_fr.md b/README_fr.md index c6f8a28..41d563e 100644 --- a/README_fr.md +++ b/README_fr.md @@ -14,7 +14,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour A web based, real time, collaborative whiteboard application with rich media support -**Version incluse :** 2021.08.10~ynh1 +**Version incluse :** 2022.05.09~ynh1 From 326cb728607f10e3aa79ffa3fd8dc4be0f377986 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 9 May 2022 23:31:27 +0200 Subject: [PATCH 5/6] Send msg_install Fix #3 --- conf/msg_install | 7 ++ doc/DISCLAIMER.md | 3 +- scripts/install | 9 ++ scripts/ynh_send_readme_to_admin__2 | 128 ++++++++++++++++++++++++++++ 4 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 conf/msg_install create mode 100644 scripts/ynh_send_readme_to_admin__2 diff --git a/conf/msg_install b/conf/msg_install new file mode 100644 index 0000000..e46ba80 --- /dev/null +++ b/conf/msg_install @@ -0,0 +1,7 @@ +__APP__ was successfully installed :) + +Please open your __APP__ domain: https://__DOMAIN____PATH_URL__signup to signup + +The Beta Invite Code is: __INVITE_SECRET__ + +If you are facing any problem or want to improve this app, please open a new issue here: https://github.com/YunoHost-Apps/spacedeck_ynh diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md index 14e4e59..d1b6e63 100644 --- a/doc/DISCLAIMER.md +++ b/doc/DISCLAIMER.md @@ -1,2 +1,3 @@ * The app can only be installed at the root of a domain -* There is no integration with YunoHost SSO \ No newline at end of file +* There is no integration with YunoHost SSO +* A email is send at the end of the installation with the Beta Invite Code diff --git a/scripts/install b/scripts/install index 7e860b4..7c43d51 100755 --- a/scripts/install +++ b/scripts/install @@ -7,6 +7,7 @@ #================================================= source _common.sh +source ynh_send_readme_to_admin__2 source /usr/share/yunohost/helpers #================================================= @@ -190,6 +191,14 @@ ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload + +#================================================= +# SEND A README FOR THE ADMIN +#================================================= +ynh_script_progression --message="Sending a readme for the admin..." + +ynh_send_readme_to_admin --app_message="msg_install" + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/ynh_send_readme_to_admin__2 b/scripts/ynh_send_readme_to_admin__2 new file mode 100644 index 0000000..6a0ba70 --- /dev/null +++ b/scripts/ynh_send_readme_to_admin__2 @@ -0,0 +1,128 @@ +#!/bin/bash + +# Send an email to inform the administrator +# +# usage: ynh_send_readme_to_admin --app_message=app_message [--recipients=recipients] [--type=type] +# | arg: -m --app_message= - The file with the content to send to the administrator. +# | arg: -r, --recipients= - The recipients of this email. Use spaces to separate multiples recipients. - default: root +# example: "root admin@domain" +# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you +# example: "root admin@domain user1 user2" +# | arg: -t, --type= - Type of mail, could be 'backup', 'change_url', 'install', 'remove', 'restore', 'upgrade' +# +# Requires YunoHost version 4.1.0 or higher. +ynh_send_readme_to_admin() { + # Declare an array to define the options of this helper. + declare -Ar args_array=( [m]=app_message= [r]=recipients= [t]=type= ) + local app_message + local recipients + local type + # Manage arguments with getopts + + ynh_handle_getopts_args "$@" + app_message="${app_message:-}" + recipients="${recipients:-root}" + type="${type:-install}" + + # Get the value of admin_mail_html + admin_mail_html=$(ynh_app_setting_get $app admin_mail_html) + admin_mail_html="${admin_mail_html:-0}" + + # Retrieve the email of users + find_mails () { + local list_mails="$1" + local mail + local recipients=" " + # Read each mail in argument + for mail in $list_mails + do + # Keep root or a real email address as it is + if [ "$mail" = "root" ] || echo "$mail" | grep --quiet "@" + then + recipients="$recipients $mail" + else + # But replace an user name without a domain after by its email + if mail=$(ynh_user_get_info "$mail" "mail" 2> /dev/null) + then + recipients="$recipients $mail" + fi + fi + done + echo "$recipients" + } + recipients=$(find_mails "$recipients") + + # Subject base + local mail_subject="☁️🆈🅽🅷☁️: \`$app\`" + + # Adapt the subject according to the type of mail required. + if [ "$type" = "backup" ]; then + mail_subject="$mail_subject has just been backup." + elif [ "$type" = "change_url" ]; then + mail_subject="$mail_subject has just been moved to a new URL!" + elif [ "$type" = "remove" ]; then + mail_subject="$mail_subject has just been removed!" + elif [ "$type" = "restore" ]; then + mail_subject="$mail_subject has just been restored!" + elif [ "$type" = "upgrade" ]; then + mail_subject="$mail_subject has just been upgraded!" + else # install + mail_subject="$mail_subject has just been installed!" + fi + + ynh_add_config --template="$app_message" --destination="../conf/msg_to_send" + + ynh_delete_file_checksum --file="../conf/msg_to_send" + local mail_message="This is an automated message from your beloved YunoHost server. + +Specific information for the application $app. + +$(cat "../conf/msg_to_send")" + + # Store the message into a file for further modifications. + echo "$mail_message" > mail_to_send + + # If a html email is required. Apply html tags to the message. + if [ "$admin_mail_html" -eq 1 ] + then + # Insert 'br' tags at each ending of lines. + ynh_replace_string "$" "
" mail_to_send + + # Insert starting HTML tags + sed --in-place '1s@^@\n\n\n\n@' mail_to_send + + # Keep tabulations + ynh_replace_string " " "\ \ " mail_to_send + ynh_replace_string "\t" "\ \ " mail_to_send + + # Insert url links tags + ynh_replace_string "__URL_TAG1__\(.*\)__URL_TAG2__\(.*\)__URL_TAG3__" "\1" mail_to_send + + # Insert finishing HTML tags + echo -e "\n\n" >> mail_to_send + + # Otherwise, remove tags to keep a plain text. + else + # Remove URL tags + ynh_replace_string "__URL_TAG[1,3]__" "" mail_to_send + ynh_replace_string "__URL_TAG2__" ": " mail_to_send + fi + + # Define binary to use for mail command + if [ -e /usr/bin/bsd-mailx ] + then + local mail_bin=/usr/bin/bsd-mailx + else + local mail_bin=/usr/bin/mail.mailutils + fi + + if [ "$admin_mail_html" -eq 1 ] + then + content_type="text/html" + else + content_type="text/plain" + fi + + # Send the email to the recipients + cat mail_to_send | $mail_bin -a "Content-Type: $content_type; charset=UTF-8" -s "$mail_subject" "$recipients" +} From 0f3dbf13b1afa3ff1720174f8992ce6b7c4eb4cd Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 9 May 2022 21:31:32 +0000 Subject: [PATCH 6/6] Auto-update README --- README.md | 2 ++ README_fr.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/README.md b/README.md index 356f718..eb9f079 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,8 @@ A web based, real time, collaborative whiteboard application with rich media sup * The app can only be installed at the root of a domain * There is no integration with YunoHost SSO +* A email is send at the end of the installation with the Beta Invite Code + ## Documentation and resources * Official app website: https://spacedeck.com diff --git a/README_fr.md b/README_fr.md index 41d563e..b131a43 100644 --- a/README_fr.md +++ b/README_fr.md @@ -26,6 +26,8 @@ A web based, real time, collaborative whiteboard application with rich media sup * The app can only be installed at the root of a domain * There is no integration with YunoHost SSO +* A email is send at the end of the installation with the Beta Invite Code + ## Documentations et ressources * Site officiel de l'app : https://spacedeck.com