1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/spacedeck_ynh.git synced 2024-09-03 20:26:14 +02:00

Merge pull request #4 from YunoHost-Apps/fix

Upgrade to 2022.05.09~ynh1
This commit is contained in:
tituspijean 2022-05-10 12:05:26 +02:00 committed by GitHub
commit aae5337193
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 195 additions and 55 deletions

View file

@ -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 A web based, real time, collaborative whiteboard application with rich media support
**Shipped version:** 2021.08.10~ynh1 **Shipped version:** 2022.05.09~ynh1
@ -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 * The app can only be installed at the root of a domain
* There is no integration with YunoHost SSO * 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 ## Documentation and resources
* Official app website: https://spacedeck.com * Official app website: https://spacedeck.com

View file

@ -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 A web based, real time, collaborative whiteboard application with rich media support
**Version incluse :** 2021.08.10~ynh1 **Version incluse :** 2022.05.09~ynh1
@ -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 * The app can only be installed at the root of a domain
* There is no integration with YunoHost SSO * 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 ## Documentations et ressources
* Site officiel de l'app : https://spacedeck.com * Site officiel de l'app : https://spacedeck.com

View file

@ -18,7 +18,3 @@
;;; Options ;;; Options
Email= Email=
Notification=none Notification=none
;;; Upgrade options
; commit=CommitHash
name=Name and date of the commit.
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1&

View file

@ -1,7 +1,7 @@
SOURCE_URL=https://github.com/spacedeck/spacedeck-open/archive/aacc3a8f1039834cc686674f3a2bac45d77a014b.zip SOURCE_URL=https://github.com/spacedeck/spacedeck-open/archive/1109537675cd83f87499a37d37ef6b7a6efcaa4d.tar.gz
SOURCE_SUM=F16843F2F7382C071058594463423397B4A7F7C4E86855923047B791F8B3B380 SOURCE_SUM=2abb471efb7343ee809cfe389e0d9c7a8c7359765d56d80725758b804a72d848
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true
SOURCE_FILENAME= SOURCE_FILENAME=
SOURCE_EXTRACT=true SOURCE_EXTRACT=true

View file

@ -1,39 +1,38 @@
{ {
"team_name": "My Open Spacedeck", "team_name": "YunoHost Spacedeck",
"contact_email": "webmaster@__DOMAIN__", "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",
"export_api_secret": "__API_SECRET__", "host": "localhost",
"port": __PORT__,
"mail_provider": "smtp", "endpoint": "https://__DOMAIN____PATH__",
"mail_smtp_host": "localhost", "invite_code": "__INVITE_SECRET__",
"mail_smtp_port": 587,
"mail_smtp_secure": false, "storage_dialect": "sqlite",
"mail_smtp_require_tls": false,
"mail_smtp_user": "__APP__@__DOMAIN__", "storage_host": "localhost",
"mail_smtp_pass": "", "storage_database": "spacedeck",
"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": {}
}

7
conf/msg_install Normal file
View file

@ -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

View file

@ -1,2 +1,3 @@
* The app can only be installed at the root of a domain * The app can only be installed at the root of a domain
* There is no integration with YunoHost SSO * There is no integration with YunoHost SSO
* A email is send at the end of the installation with the Beta Invite Code

View file

@ -5,7 +5,7 @@
"description": { "description": {
"en": "A web based, real time, collaborative whiteboard application with rich media support" "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", "url": "https://spacedeck.com",
"upstream": { "upstream": {
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",

View file

@ -47,6 +47,7 @@ ynh_script_progression --message="Backing up the app before changing its URL (ma
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
ynh_clean_setup () { 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. # 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" ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"

View file

@ -7,6 +7,7 @@
#================================================= #=================================================
source _common.sh source _common.sh
source ynh_send_readme_to_admin__2
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
@ -65,7 +66,6 @@ ynh_app_setting_set --app=$app --key=port --value=$port
ynh_script_progression --message="Installing dependencies..." --weight=1 ynh_script_progression --message="Installing dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
#================================================= #=================================================
@ -105,8 +105,7 @@ ynh_add_nginx_config
ynh_script_progression --message="Installing NodeJS dependencies..." --weight=1 ynh_script_progression --message="Installing NodeJS dependencies..." --weight=1
pushd $final_path 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 install
ynh_exec_as $app $ynh_node_load_PATH $ynh_npm --loglevel=error audit fix
popd popd
#================================================= #=================================================
@ -192,6 +191,14 @@ ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload 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 # END OF SCRIPT
#================================================= #=================================================

View file

@ -45,7 +45,7 @@ test ! -d $final_path \
#================================================= #=================================================
# RESTORE THE NGINX CONFIGURATION # 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" 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 # Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
#================================================= #=================================================

View file

@ -105,7 +105,6 @@ ynh_add_nginx_config
ynh_script_progression --message="Upgrading dependencies..." --weight=1 ynh_script_progression --message="Upgrading dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
#================================================= #=================================================
@ -117,7 +116,6 @@ ynh_script_progression --message="Installing NodeJS dependencies..." --weight=1
pushd $final_path 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 install
ynh_exec_as $app $ynh_node_load_PATH $ynh_npm --loglevel=error audit fix
popd popd
#================================================= #=================================================

View file

@ -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 "$" "<br>" mail_to_send
# Insert starting HTML tags
sed --in-place '1s@^@<!DOCTYPE html>\n<html>\n<head></head>\n<body>\n@' mail_to_send
# Keep tabulations
ynh_replace_string " " "\&#160;\&#160;" mail_to_send
ynh_replace_string "\t" "\&#160;\&#160;" mail_to_send
# Insert url links tags
ynh_replace_string "__URL_TAG1__\(.*\)__URL_TAG2__\(.*\)__URL_TAG3__" "<a href=\"\2\">\1</a>" mail_to_send
# Insert finishing HTML tags
echo -e "\n</body>\n</html>" >> 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"
}