From 14b31d5d7eb28a95412bc94d4a1d070dc700b542 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 30 Aug 2021 17:12:56 +0200 Subject: [PATCH 1/6] Create DESCRIPTION.md --- doc/DESCRIPTION.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 doc/DESCRIPTION.md diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md new file mode 100644 index 0000000..8abe306 --- /dev/null +++ b/doc/DESCRIPTION.md @@ -0,0 +1,2 @@ +A Kanban-inspired app for keeping track of things that need to get done. +The goal of TaskBoard is to provide a simple and clean interface to a functional and minimal application for keeping track of tasks. It's not trying to be the next Trello or LeanKit. \ No newline at end of file From e2a77ce97f60d9a9031815c295c361ca40cff73b Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Mon, 30 Aug 2021 15:13:03 +0000 Subject: [PATCH 2/6] Auto-update README --- README.md | 3 ++- README_fr.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 649450a..3ddf7d6 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,8 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in ## Overview -Kanban-inspired app for keeping track of things that need to get done. +A Kanban-inspired app for keeping track of things that need to get done. +The goal of TaskBoard is to provide a simple and clean interface to a functional and minimal application for keeping track of tasks. It's not trying to be the next Trello or LeanKit. **Shipped version:** 1.0.2~ynh2 diff --git a/README_fr.md b/README_fr.md index 564484d..61b71ce 100644 --- a/README_fr.md +++ b/README_fr.md @@ -11,7 +11,8 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour ## Vue d'ensemble -Application inspirée de Kanban pour garder une trace des choses à faire. +A Kanban-inspired app for keeping track of things that need to get done. +The goal of TaskBoard is to provide a simple and clean interface to a functional and minimal application for keeping track of tasks. It's not trying to be the next Trello or LeanKit. **Version incluse :** 1.0.2~ynh2 From 6e7699ce5f99e7dab0d6b1fef184d499527e5b86 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 30 Aug 2021 17:20:07 +0200 Subject: [PATCH 3/6] Fix --- conf/Mailer.php | 164 ++++++++++++++++++++++++++++++++++++++++++++++++ scripts/install | 11 ++++ 2 files changed, 175 insertions(+) create mode 100644 conf/Mailer.php diff --git a/conf/Mailer.php b/conf/Mailer.php new file mode 100644 index 0000000..402d822 --- /dev/null +++ b/conf/Mailer.php @@ -0,0 +1,164 @@ +loadStrings($lang); + } + + /** + * Send email to one or more users in the provided list. + * + * @param $emails List of email addresses (must have at least one). + * @param $data Object containing template type and replacements for template. + */ + public function sendMail($emails, $data) { + $this->initMail(); + + if (count($emails) < 1) { + return ''; + } + + foreach($emails as $user) { + $this->mail->addAddress($user); + } + + $this->mail->Subject = $this->strings->mail_subject; + $this->mail->msgHTML($this->parseTemplate($data)); + + if (!$this->mail->send()) { + return $this->strings->mail_error; + } + + return $this->strings->mail_sent; // @codeCoverageIgnore + } + + private function parseTemplate(EmailData $data) { + $template = $this->getTemplate($data->type); + + $template = str_replace('%hostUrl%', $data->hostUrl, $template); + $template = str_replace('%boardId%', $data->boardId, $template); + + $template = str_replace('%username%', $data->username, $template); + $template = str_replace('%boardName%', $data->boardName, $template); + + $template = str_replace('%comment%', $data->comment, $template); + $template = str_replace('%taskName%', $data->taskName, $template); + + $template = + str_replace('%taskDescription%', $data->taskDescription, $template); + $template = str_replace('%taskDueDate%', $data->taskDueDate, $template); + $template = str_replace('%taskAssignees%', $data->taskAssignees, $template); + $template = + str_replace('%taskCategories%', $data->taskCategories, $template); + $template = str_replace('%taskPoints%', $data->taskPoints, $template); + $template = + str_replace('%taskColumnName%', $data->taskColumnName, $template); + $template = str_replace('%taskPosition%', $data->taskPosition, $template); + + return $template; + } + + /** + * @codeCoverageIgnore + */ + private function getTemplate($type) { + $template = ''; + + switch($type) { + case 'newBoard': + $template = $this->strings->mail_template_newBoard; + break; + + case 'newComment': + $template = $this->strings->mail_template_newComment; + break; + + case 'newTask': + $template = $this->strings->mail_template_newTask; + + case 'editBoard': + $template = $this->strings->mail_template_editBoard; + break; + + case 'editComment': + $template = $this->strings->mail_template_editComment; + break; + + case 'editTask': + $template = $this->strings->mail_template_editTask; + break; + + case 'removeBoard': + $template = $this->strings->mail_template_removeBoard; + break; + + case 'removeComment': + $template = $this->strings->mail_template_removeComment; + break; + + case 'removeTask': + $template = $this->strings->mail_template_removeTask; + break; + } + + $template .= $this->strings->mail_template_openBoardLink; + + return $template; + } + + private function initMail() { + $this->mail = new PHPMailer(); + $this->mail->isSendmail(); + + $this->mail->setFrom(Mailer::FROM_EMAIL, Mailer::FROM_NAME); + $this->mail->CharSet = PHPMailer::CHARSET_UTF8; + + // @codeCoverageIgnoreStart + if (!Mailer::USE_SENDMAIL) { + $this->mail->isSMTP(); + + $this->mail->Host = Mailer::SMTP_HOST; + $this->mail->Port = Mailer::SMTP_PORT; + $this->mail->Username = Mailer::SMTP_USER; + $this->mail->Password = Mailer::SMTP_PASS; + + $this->mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; + $this->mail->SMTPAuth = true; + } + // @codeCoverageIgnoreEnd + } + + private function loadStrings($lang) { + $json = '{}'; + + try { + $json = + file_get_contents(__DIR__ . '/../../strings/' . $lang . '_api.json'); + } catch (Exception $ex) { + $ex->getMessage(); + + $json = file_get_contents(__DIR__ . '/../../json/' . $lang . '_api.json'); + } + + $this->strings = json_decode($json); + } +} diff --git a/scripts/install b/scripts/install index 02f478e..57d341a 100644 --- a/scripts/install +++ b/scripts/install @@ -90,6 +90,17 @@ ynh_script_progression --message="Configuring PHP-FPM..." --weight=3 ynh_add_fpm_config --package="$extra_php_dependencies" phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +#================================================= +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Adding a configuration file..." --time --weight=1 + +dir="__DIR__" +ynh_add_config --template="../conf/Mailer.php" --destination="$final_path/api/helpers/Mailer.php" + +chmod 400 "$final_path/api/helpers/Mailer.php" +chown $app:$app "$final_path/api/helpers/Mailer.php" + #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= From 578e0b9b38eb8a9dbb0df0ad18e3f78a54c0550b Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 30 Aug 2021 17:21:43 +0200 Subject: [PATCH 4/6] Update install --- scripts/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 57d341a..6d855f0 100644 --- a/scripts/install +++ b/scripts/install @@ -84,7 +84,7 @@ ynh_add_nginx_config #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring PHP-FPM..." --weight=3 +ynh_script_progression --message="Configuring PHP-FPM..." --weight=4 # Create a dedicated PHP-FPM config ynh_add_fpm_config --package="$extra_php_dependencies" @@ -93,7 +93,7 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Adding a configuration file..." --time --weight=1 +ynh_script_progression --message="Adding a configuration file..." --weight=2 dir="__DIR__" ynh_add_config --template="../conf/Mailer.php" --destination="$final_path/api/helpers/Mailer.php" From 799bec3ca0c57167375a5a6d9c8eed6a50f3ee37 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 30 Aug 2021 17:29:32 +0200 Subject: [PATCH 5/6] Update install --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index 6d855f0..c4f14ed 100644 --- a/scripts/install +++ b/scripts/install @@ -70,6 +70,7 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_setup_source --dest_dir="$final_path" chmod 750 "$final_path" +chmod 766 "$final_path/api" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" From b9af1c949fb51b71188298685fae03c7376bb30a Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 30 Aug 2021 17:35:00 +0200 Subject: [PATCH 6/6] Fix --- conf/nginx.conf | 2 ++ scripts/install | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 1ffdffd..66a5775 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -13,6 +13,8 @@ location __PATH__/ { client_max_body_size 100M; client_body_buffer_size 128k; + proxy_set_header Authorization $http_authorization; + proxy_pass_header Authorization; try_files $uri $uri/ @__NAME__; diff --git a/scripts/install b/scripts/install index c4f14ed..a46ce18 100644 --- a/scripts/install +++ b/scripts/install @@ -70,7 +70,7 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_setup_source --dest_dir="$final_path" chmod 750 "$final_path" -chmod 766 "$final_path/api" +chmod 777 "$final_path/api" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path"