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

Update mail

This commit is contained in:
Fabian Wilkens 2021-02-06 20:01:03 +01:00
parent e7161cf203
commit 378f9e9e38
No known key found for this signature in database
GPG key ID: 23DFA025BB4E9FAB
4 changed files with 54 additions and 10 deletions

View file

@ -45,9 +45,13 @@ DATADOG_ENABLED=false
# Mailer settings
SMTP_HOST=
SMTP_PORT=
SMTP_USERNAME=
SMTP_PASSWORD=
#SMTP_USERNAME=
#SMTP_PASSWORD=
SMTP_DOMAIN=
# Enalbe STARTTLS
# Empty is disabled
# Any value is enabled
SMTP_STARTTLS=
EMAIL_ATTACHMENT_MAX_SIZE=10485760
# SNS EVENTS

View file

@ -33,7 +33,7 @@ if [ -z "$access_domain" ]
then
access_domain=$domain
fi
mail=$app$domain
mail="$app@$domain"
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
@ -145,7 +145,8 @@ ynh_replace_string --match_string="DB_PASSWORD=.*$" --replace_string="DB_PASSWOR
ynh_replace_string --match_string="RAILS_RELATIVE_URL_ROOT=.*$" --replace_string="RAILS_RELATIVE_URL_ROOT=$path_url" --target_file="$config_file"
ynh_replace_string --match_string="SMTP_HOST=.*$" --replace_string="SMTP_HOST=localhost" --target_file="$config_file"
ynh_replace_string --match_string="SMTP_PORT=.*$" --replace_string="SMTP_PORT=25" --target_file="$config_file"
ynh_replace_string --match_string="SMTP_DOMAIN=.*$" --replace_string="SMTP_DOAMIN=localhost" --target_file="$config_file"
ynh_replace_string --match_string="SMTP_DOMAIN=.*$" --replace_string="SMTP_DOMAIN=localhost" --target_file="$config_file"
ynh_replace_string --match_string="SMTP_STARTTLS=.*$" --replace_string="SMTP_STARTTLS="" --target_file="$config_file"
ynh_replace_string --match_string="RAILS_SERVE_STATIC_FILES=.*$" --replace_string="RAILS_SERVE_STATIC_FILES=true" --target_file="$config_file"
ynh_replace_string --match_string="__MAIL__" --replace_string="$mail" --target_file="$final_path/live/app/mailers/application_mailer.rb"

View file

@ -79,6 +79,12 @@ if [ -z "$access_domain" ]; then
ynh_app_setting_set --app=$app --key=access_domain --value=$access_domain
fi
# If mail doesn't exist, create it
if [ -z "$mail" ]; then
mail="$app@$domain"
ynh_app_setting_set --app=$app --key=mail --value=$mail
fi
if [[ ! -d "$final_path/live/public/extensions/" || \
! -d "$final_path/live/public/extensions/src/" ]]
then
@ -88,6 +94,25 @@ then
fi
fi
if ynh_compare_current_package_version --comparison lt --version "3.13.6~ynh4"
then
# Add Variables to .env config file
echo -e "\
\n# Public file server\
\n# Empty is disabled\
\n# Any value is enabled\
\nRAILS_SERVE_STATIC_FILES=\
" >> "$final_path/live/.env"
# Apply Patch
if [ -f "$YNH_CWD/../sources/patches/app-01-add-mail.patch" ]
then
pushd "$final_path/live"
patch --strip=1 < "$YNH_CWD/../sources/patches/app-01-add-mail.patch"
popd
fi
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
@ -187,7 +212,11 @@ if ynh_compare_current_package_version --comparison lt --version "3.13.6~ynh4"
then
ynh_replace_string --match_string="SMTP_HOST=.*$" --replace_string="SMTP_HOST=localhost" --target_file="$config_file"
ynh_replace_string --match_string="SMTP_PORT=.*$" --replace_string="SMTP_PORT=25" --target_file="$config_file"
ynh_replace_string --match_string="SMTP_DOMAIN=.*$" --replace_string="SMTP_DOAMIN=localhost" --target_file="$config_file"
ynh_replace_string --match_string="SMTP_USERNAME=.*$" --replace_string="#&" --target_file="$config_file"
ynh_replace_string --match_string="SMTP_PASSWORD=.*$" --replace_string="#&" --target_file="$config_file"
ynh_replace_string --match_string="SMTP_DOMAIN=.*$" --replace_string="SMTP_DOMAIN=localhost" --target_file="$config_file"
ynh_replace_string --match_string="SMTP_DOMAIN=.*$" --replace_string="&\n# Enable STARTTLS\n# Empty is disabled\n# Any value is enabled\nSMTP_STARTTLS=" --target_file="$config_file"
ynh_replace_string --match_string="RAILS_SERVE_STATIC_FILES=.*$" --replace_string="RAILS_SERVE_STATIC_FILES=true" --target_file="$config_file"
fi
ynh_replace_string --match_string="__MAIL__" --replace_string="$mail" --target_file="$final_path/live/app/mailers/application_mailer.rb"

View file

@ -24,10 +24,10 @@ index 6bbbb11..ac7f55e 100644
end
diff --git a/app/views/user_mailer/welcome.html.erb b/app/views/user_mailer/welcome.html.erb
new file mode 100644
index 0000000..fa4ba56
index 0000000..4f156f4
--- /dev/null
+++ b/app/views/user_mailer/welcome.html.erb
@@ -0,0 +1,226 @@
@@ -0,0 +1,223 @@
+<!DOCTYPE html>
+<html style="font-family: sans-serif; line-height: 1.3 !important; font-size: 18px; color: black !important; box-sizing: border-box; margin: 0; padding: 0;">
+ <head>
@ -199,9 +199,6 @@ index 0000000..fa4ba56
+ Press <strong>Enter</strong> on your keyboard.
+ </li>
+ <li style="line-height: 1.3; margin-bottom: 10px; box-sizing: border-box;">
+ Press on <strong>Install</strong>
+ </li>
+ <li style="line-height: 1.3; margin-bottom: 10px; box-sizing: border-box;">
+ Now you can see Editors, Themes and Components which you can install
+ </li>
+ </ol>
@ -254,6 +251,19 @@ index 0000000..fa4ba56
+ </div>
+ </body>
+</html>
diff --git a/config/application.rb b/config/application.rb
index 3c749e2..feff27c 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -79,7 +79,7 @@ module SyncingServer
:user_name => ENV['SMTP_USERNAME'],
:password => ENV['SMTP_PASSWORD'],
:authentication => 'login',
- :enable_starttls_auto => true # detects and uses STARTTLS
+ :enable_starttls_auto => ENV['SMTP_STARTTLS'].present? # detects and uses STARTTLS
}
# Custom configuration
diff --git a/lib/sync_engine/abstract/user_manager.rb b/lib/sync_engine/abstract/user_manager.rb
index 26a549a..af92835 100644
--- a/lib/sync_engine/abstract/user_manager.rb