From 0664ec55c9c0d11280d3a6f04378ee9921029f02 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Mon, 25 Feb 2019 19:36:03 +0100 Subject: [PATCH] Normalization from example_ynh --- README.md | 104 ++++++++++++++++++++---------- check_process | 1 - conf/data/configs/application.ini | 14 ++-- conf/nginx.conf | 7 +- manifest.json | 3 +- scripts/backup | 7 +- scripts/install | 34 +++++----- scripts/restore | 7 +- scripts/upgrade | 10 +-- sources/sso/sso.php | 6 +- 10 files changed, 110 insertions(+), 83 deletions(-) diff --git a/README.md b/README.md index 9c392e6..8f56a24 100644 --- a/README.md +++ b/README.md @@ -1,43 +1,79 @@ -# Rainloop for YunoHost - -* [rainloop](http://rainloop.net/ ): 1.11.3 - -## English -Rainloop is a lightweight webmail. - -To configure it, go to http://DOMAIN.TLD/rainloop/app/?admin - -- The default login is : admin -- The default password is : Password chosen during install +# Rainloop for YunoHost + +[![Integration level](https://dash.yunohost.org/integration/rainloop.svg)](https://dash.yunohost.org/appci/app/rainloop) +[![Install Rainloop with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=rainloop) + +*[Lire ce readme en français.](./README_fr.md)* + +> *This package allow you to install Rainloop quickly and simply on a YunoHost server. +If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* + +## Overview + +Rainloop is a lightweight webmail. + +**Shipped version:** 1.11.3 + +## Screenshots + +![](https://www.rainloop.net/static/media/screenshots/v2/12.png) + +## Demo + +* [YunoHost demo](https://demo.yunohost.org/rainloop/app/) +* [Official demo](https://mail.rainloop.net/) + +## Configuration + +Go to http://DOMAIN.TLD/rainloop/app/?admin + +- The default login is : admin +- The default password is : Password chosen during install - If you lost the admin password, you can retrieve it using ``sudo yunohost app settings rainloop password`` - -Each user can add a remote carddav server from their own parameters interface. + +Each user can add a remote carddav server from their own parameters interface. - If you use baikal, the CardDav address is: https://DOMAIN.TLD/baikal/card.php/addressbooks/USER/default/ - If you use NextCloud, the CardDav address is: https://DOMAIN.TLD/nextcloud/remote.php/carddav/addressbooks/USER/contacts - -Rainloop saves your PGP private keys in the browser storage. This means that you will loose your private keys if you clear your browser storage (e.g., private browsing, different computer...). This packages integrates [PGPback by chtixof](https://github.com/chtixof/pgpback_ynh) so you can store your PGP private keys on the server securely. Go to **http://DOMAIN.TLD/rainloop/pgpback** to backup your PGP keys on the server or restore them. -To upgrade the app once a new rainloop version is available, simply run in a local shell via ssh or otherwise : -``sudo yunohost app upgrade -u https://github.com/YunoHost-Apps/rainloop_ynh rainloop`` +## Documentation - -## Français -Rainloop est un webmail simple et léger. - -Pour le configurer après l'installation, veuillez vous rendre sur http://DOMAIN.TLD/rainloop/app/?admin - -- Le nom d'utilisateur admin par défaut est : admin -- Le mot de passe admin par défaut est : Mot de passe choisi lors de l'installation -- Si vous avez oublié votre mot de passe, vous pouvez le retrouver avec ``sudo yunohost app settings rainloop password`` - -Chaque utilisateur peut ajouter un carnet d'adresse distant CardDav via leurs propres paramètres. - -- Si vous utilisez Baikal, l'adresse à renseigner est du type : https://DOMAIN.TLD/baikal/card.php/addressbooks/UTILISATEUR/default/ -- Si vous utilisez NextCloud, l'adresse à renseigner est du type : https://DOMAIN.TLD/nextcloud/remote.php/carddav/addressbooks/USER/contacts + * Official documentation: https://www.rainloop.net/docs/configuration/ + * YunoHost documentation: https://yunohost.org/#/app_rainloop -Rainloop stocke les clés PGP privées dans le stockage de navigateur. Cela implique que vos clés seront perdues quand vous videz le stockage de navigateur (navigation incognito, changement d'ordinateur, ...). Ce paquet intègre [PGPback de chtixof](https://github.com/chtixof/pgpback_ynh) pour que vous puissiez stocker vos clés privées PGP de manière sécurisée sur le serveur. Rendez-vous **http://DOMAIN.TLD/rainloop/pgpback** pour stocker vos clés privées PGP sur le serveur ou les restaurer dans un nouveau navigateur. +## YunoHost specific features -Pour mettre à jour rainloop lorsqu'une nouvelle version est disponible, lancez en console locale (ssh ou autre) : -``sudo yunohost app upgrade -u https://github.com/YunoHost-Apps/rainloop_ynh rainloop`` +#### Multi-users support +#### Supported architectures + +* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/rainloop%20%28Official%29.svg)](https://ci-apps.yunohost.org/ci/apps/rainloop/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/rainloop%20%28Official%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/rainloop/) +* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/rainloop%20%28Official%29.svg)](https://ci-stretch.nohost.me/ci/apps/rainloop/) + +## Limitations + +## Additional information + +* Rainloop saves your PGP private keys in the browser storage. This means that you will loose your private keys if you clear your browser storage (e.g., private browsing, different computer...). This packages integrates [PGPback by chtixof](https://github.com/chtixof/pgpback_ynh) so you can store your PGP private keys on the server securely. Go to **http://DOMAIN.TLD/rainloop/pgpback** to backup your PGP keys on the server or restore them. + +## Links + + * Report a bug: https://github.com/YunoHost-Apps/rainloop_ynh/issues + * Rainloop website: https://www.rainloop.net/ + * YunoHost website: https://yunohost.org/ + +--- + +Developers info +---------------- + +**Only if you want to use a testing branch for coding, instead of merging directly into master.** +Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/rainloop_ynh/tree/testing). + +To try the testing branch, please proceed like that. +``` +sudo yunohost app install https://github.com/YunoHost-Apps/rainloop_ynh/tree/testing --debug +or +sudo yunohost app upgrade rainloop -u https://github.com/YunoHost-Apps/rainloop_ynh/tree/testing --debug +``` diff --git a/check_process b/check_process index bb5cd2d..2dcc5da 100644 --- a/check_process +++ b/check_process @@ -1,5 +1,4 @@ ;; Test Rainloop - auto_remove=1 ; Manifest domain="domain.tld" (DOMAIN) path="/rainloop" (PATH) diff --git a/conf/data/configs/application.ini b/conf/data/configs/application.ini index 4b22ba1..71a4cc5 100644 --- a/conf/data/configs/application.ini +++ b/conf/data/configs/application.ini @@ -17,10 +17,10 @@ allow_themes = On allow_user_background = Off ; Language used by default -language = "LANGTOCHANGE" +language = "__LANGTOCHANGE__" ; Admin Panel interface language -language_admin = "LANGTOCHANGE" +language_admin = "__LANGTOCHANGE__" ; Allow language selection on settings screen allow_languages_on_settings = On @@ -58,9 +58,9 @@ allow_sharing = On allow_sync = On sync_interval = 20 type = "mysql" -pdo_dsn = "mysql:host=127.0.0.1;port=3306;dbname=MYSQLUSER" -pdo_user = "MYSQLUSER" -pdo_password = "MYSQLPASSWORD" +pdo_dsn = "mysql:host=127.0.0.1;port=3306;dbname=__MYSQLUSER__" +pdo_user = "__MYSQLUSER__" +pdo_password = "__MYSQLPASSWORD__" suggestions_limit = 30 [security] @@ -114,7 +114,7 @@ messagelist_actions = On attachments_actions = On [login] -default_domain = "domain.tld" +default_domain = "__DOMAIN__" ; Allow language selection on webmail login screen allow_languages_on_login = On @@ -138,7 +138,7 @@ sign_me_auto = "DefaultOff" enable = On ; List of enabled plugins -enabled_list = "PLUGINSTOENABLE" +enabled_list = "__PLUGINSTOENABLE__" [defaults] ; Editor mode used by default (Plain, Html, HtmlForced or PlainForced) diff --git a/conf/nginx.conf b/conf/nginx.conf index 7f3d212..8a5987b 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,6 +1,10 @@ -location __PATH__ { +#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; +location __PATH__/ { + + # Path to source alias __FINALPATH__/; + # Force usage of https if ($scheme = http) { rewrite ^ https://$server_name$request_uri? permanent; } @@ -28,5 +32,4 @@ location __PATH__ { # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; - } diff --git a/manifest.json b/manifest.json index 0a5abde..b2a2492 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Lightweight multi-account webmail", "fr": "Webmail léger multi-comptes" }, - "version": "1.11.1", + "version": "1.11.1~ynh2", "url": "https://www.rainloop.net/", "license": "AGPL-3.0", "maintainer": { @@ -70,6 +70,7 @@ }, { "name": "lang", + "type": "string", "ask": { "en": "Select default language", "fr": "Definir la langue par defaut" diff --git a/scripts/backup b/scripts/backup index 0a064c2..02fb585 100644 --- a/scripts/backup +++ b/scripts/backup @@ -6,12 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -if [ ! -e _common.sh ]; then - # Get the _common.sh file if it's not in the current directory - cp ../settings/scripts/_common.sh ./_common.sh - chmod a+rx _common.sh -fi -source _common.sh +source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers #================================================= diff --git a/scripts/install b/scripts/install index a641701..d105cc9 100644 --- a/scripts/install +++ b/scripts/install @@ -39,8 +39,6 @@ test ! -e "$final_path" || ynh_die "This path already contains a folder" # Normalize the url path syntax path_url=$(ynh_normalize_url_path $path_url) -# Check web path availability -ynh_webpath_available $domain $path_url # Register (book) web path ynh_webpath_register $app $domain $path_url @@ -76,7 +74,6 @@ ynh_setup_source "$final_path/app" # NGINX CONFIGURATION #================================================= -ynh_replace_string "__PATH__/" "${path_url%/}/" "../conf/nginx.conf" # Create a dedicated nginx config ynh_add_nginx_config @@ -111,32 +108,33 @@ case "$lang" in *) lang="en" esac -ynh_app_setting_set "$app" lang "$lang" +ynh_app_setting_set $app lang $lang # Set plugins -plugins="ynh-login-mapping,auto-domain-grab" # This plugin is trying to automatically grab unknown domains if users want to add external email accounts +# This plugin is trying to automatically grab unknown domains if users want to add external email accounts +plugins="ynh-login-mapping,auto-domain-grab" if [ $ldap -eq 1 ] then - plugins="$plugins,ynh-ldap-suggestions" # This plugin is to suggest YunoHost users in recipients list + # This plugin is to suggest YunoHost users in recipients list + plugins="$plugins,ynh-ldap-suggestions" fi -ynh_app_setting_set "$app" plugins "$plugins" +ynh_app_setting_set $app plugins "$plugins" mkdir -p "$final_path/app/data/_data_/_default_/configs/" application_file="$final_path/app/data/_data_/_default_/configs/application.ini" -sudo cp ../conf/data/configs/application.ini "$application_file" -ynh_replace_string "domain.tld" "$domain" "$application_file" -ynh_replace_string "MYSQLUSER" "$db_name" "$application_file" -ynh_replace_string "MYSQLPASSWORD" "$db_pwd" "$application_file" -ynh_replace_string "LANGTOCHANGE" "$lang" "$application_file" -ynh_replace_string "PLUGINSTOENABLE" "$plugins" "$application_file" +cp ../conf/data/configs/application.ini "$application_file" +ynh_replace_string "__DOMAIN__" $domain "$application_file" +ynh_replace_string "__MYSQLUSER__" $db_name "$application_file" +ynh_replace_string "__MYSQLPASSWORD__" "$db_pwd" "$application_file" +ynh_replace_string "__LANGTOCHANGE__" $lang "$application_file" +ynh_replace_string "__PLUGINSTOENABLE__" "$plugins" "$application_file" # Set admin password php ../conf/config.php --index="$final_path/app/index.php" --password="$password" - # Add default domain configs by looping through all the domains already added mkdir -p "$final_path/app/data/_data_/_default_/domains/" # get list of ldap domains @@ -150,12 +148,12 @@ cp ../conf/data/domains/default.ini "$final_path/app/data/_data_/_default_/domai # install SSO - at the moment the index is the SSO and rainloop is installed in /app cp ../sources/sso/sso.php "$final_path/index.php" -ynh_replace_string "domain.tld" "$domain" "$final_path/index.php" -ynh_replace_string "ALIASTOCHANGE" "$final_path" "$final_path/index.php" +ynh_replace_string "__DOMAIN__" "$domain" "$final_path/index.php" +ynh_replace_string "__ALIASTOCHANGE__" "$final_path" "$final_path/index.php" if [ $path_url = "/" ]; then - ynh_replace_string "ROOTTOCHANGE" "" "$final_path/index.php" + ynh_replace_string "__ROOTTOCHANGE__" "" "$final_path/index.php" else - ynh_replace_string "ROOTTOCHANGE" "$path_url" "$final_path/index.php" + ynh_replace_string "__ROOTTOCHANGE__" "$path_url" "$final_path/index.php" fi diff --git a/scripts/restore b/scripts/restore index 656cb89..89798b6 100644 --- a/scripts/restore +++ b/scripts/restore @@ -6,12 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -if [ ! -e _common.sh ]; then - # Get the _common.sh file if it's not in the current directory - cp ../settings/scripts/_common.sh ./_common.sh - chmod a+rx _common.sh -fi -source _common.sh +source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index f698571..f41984e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -86,7 +86,7 @@ ynh_add_nginx_config # CREATE DEDICATED USER #================================================= -# Create a system user +# Create a dedicated user (if not existing) ynh_system_user_create $app #================================================= @@ -104,12 +104,12 @@ ynh_add_fpm_config # update SSO cp ../sources/sso/sso.php "$final_path/index.php" -ynh_replace_string "domain.tld" "$domain" "$final_path/index.php" -ynh_replace_string "ALIASTOCHANGE" "$final_path" "$final_path/index.php" +ynh_replace_string "__DOMAIN__" "$domain" "$final_path/index.php" +ynh_replace_string "__ALIASTOCHANGE__" "$final_path" "$final_path/index.php" if [ $path_url = "/" ]; then - ynh_replace_string "ROOTTOCHANGE" "" "$final_path/index.php" + ynh_replace_string "__ROOTTOCHANGE__" "" "$final_path/index.php" else - ynh_replace_string "ROOTTOCHANGE" "$path_url" "$final_path/index.php" + ynh_replace_string "__ROOTTOCHANGE__" "$path_url" "$final_path/index.php" fi diff --git a/sources/sso/sso.php b/sources/sso/sso.php index 98980ae..b8a374a 100644 --- a/sources/sso/sso.php +++ b/sources/sso/sso.php @@ -2,7 +2,7 @@ // Enable RainLoop Api and include index file $_ENV['RAINLOOP_INCLUDE_AS_API'] = true; -include 'ALIASTOCHANGE/app/index.php'; +include '__ALIASTOCHANGE__/app/index.php'; // Retrieve email and password if (isset($_SERVER['HTTP_EMAIL']) && isset($_SERVER['PHP_AUTH_PW'])) { @@ -11,8 +11,8 @@ if (isset($_SERVER['HTTP_EMAIL']) && isset($_SERVER['PHP_AUTH_PW'])) { $ssoHash = \RainLoop\Api::GetUserSsoHash($email, $password); // redirect to webmail sso url - \header('Location: https://domain.tldROOTTOCHANGE/app/index.php?sso&hash='.$ssoHash); + \header('Location: https://__DOMAIN____ROOTTOCHANGE__/app/index.php?sso&hash='.$ssoHash); } else { - \header('Location: https://domain.tldROOTTOCHANGE/app/index.php'); + \header('Location: https://__DOMAIN____ROOTTOCHANGE__/app/index.php'); }