From 9f98885388c9fad95aebddec42ad4a08f82d117a Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sat, 6 Feb 2021 11:28:55 -0600 Subject: [PATCH 01/10] No reason to suggest users try the useless "Local" mail adapter --- config/description.exs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/config/description.exs b/config/description.exs index f84b52a4f..600fa87d7 100644 --- a/config/description.exs +++ b/config/description.exs @@ -218,8 +218,7 @@ key: :adapter, type: :module, description: - "One of the mail adapters listed in [Swoosh readme](https://github.com/swoosh/swoosh#adapters)," <> - " or Swoosh.Adapters.Local for in-memory mailbox", + "One of the mail adapters listed in [Swoosh readme](https://github.com/swoosh/swoosh#adapters)", suggestions: [ Swoosh.Adapters.SMTP, Swoosh.Adapters.Sendgrid, @@ -232,8 +231,7 @@ Swoosh.Adapters.AmazonSES, Swoosh.Adapters.Dyn, Swoosh.Adapters.SocketLabs, - Swoosh.Adapters.Gmail, - Swoosh.Adapters.Local + Swoosh.Adapters.Gmail ] }, %{ From 85710b026feea51057b05d02390d4d36e5f32bb1 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sat, 6 Feb 2021 11:55:01 -0600 Subject: [PATCH 02/10] Improve SMTP adapter setting descriptions --- config/description.exs | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/config/description.exs b/config/description.exs index 600fa87d7..85f90ca3e 100644 --- a/config/description.exs +++ b/config/description.exs @@ -243,21 +243,27 @@ group: {:subgroup, Swoosh.Adapters.SMTP}, key: :relay, type: :string, - description: "`Swoosh.Adapters.SMTP` adapter specific setting", - suggestions: ["smtp.gmail.com"] + description: "Hostname or IP address", + suggestions: ["smtp.example.com"] + }, + %{ + group: {:subgroup, Swoosh.Adapters.SMTP}, + key: :port, + type: :integer, + description: "SMTP port" }, %{ group: {:subgroup, Swoosh.Adapters.SMTP}, key: :username, type: :string, - description: "`Swoosh.Adapters.SMTP` adapter specific setting", - suggestions: ["pleroma"] + description: "SMTP auth username", + suggestions: ["user@example.com"] }, %{ group: {:subgroup, Swoosh.Adapters.SMTP}, key: :password, type: :string, - description: "`Swoosh.Adapters.SMTP` adapter specific setting", + description: "SMTP auth password", suggestions: ["password"] }, %{ @@ -265,29 +271,22 @@ key: :ssl, label: "SSL", type: :boolean, - description: "`Swoosh.Adapters.SMTP` adapter specific setting" + description: "Use implicit SSL/TLS: e.g., port 465", }, %{ group: {:subgroup, Swoosh.Adapters.SMTP}, key: :tls, - label: "TLS", - type: :atom, - description: "`Swoosh.Adapters.SMTP` adapter specific setting", - suggestions: [:always, :never, :if_available] + label: "STARTTLS", + type: {:dropdown, :atom}, + description: "Explicit TLS (STARTTLS) mode", + suggestions: [:if_available, :always, :never] }, %{ group: {:subgroup, Swoosh.Adapters.SMTP}, key: :auth, - type: :atom, - description: "`Swoosh.Adapters.SMTP` adapter specific setting", - suggestions: [:always, :never, :if_available] - }, - %{ - group: {:subgroup, Swoosh.Adapters.SMTP}, - key: :port, - type: :integer, - description: "`Swoosh.Adapters.SMTP` adapter specific setting", - suggestions: [1025] + type: {:dropdown, :atom}, + description: "SMTP authentication mode", + suggestions: [:if_available, :always, :never] }, %{ group: {:subgroup, Swoosh.Adapters.SMTP}, From 6ffe15cc9feadecf5e6756cb3db3240fa9eb63c2 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sat, 6 Feb 2021 11:55:25 -0600 Subject: [PATCH 03/10] Remove No MX lookups setting This setting defaults to false so the relay host will be used in an MX query so multiple SMTP servers can be used. gen_smtp code states that all records returned from the MX query are attempted in order and only a permanent SMTP error will stop the client from attempting other servers in the list. Connection failures, TLS issues, etc will cause it to try the next host. If there is no MX record associated with the relay host, it automatically tries connecting to it directly. There is really no reason to expose this to end users. The default value is fine for everyone. --- config/description.exs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/config/description.exs b/config/description.exs index 85f90ca3e..8922a3626 100644 --- a/config/description.exs +++ b/config/description.exs @@ -295,13 +295,6 @@ description: "`Swoosh.Adapters.SMTP` adapter specific setting", suggestions: [5] }, - %{ - group: {:subgroup, Swoosh.Adapters.SMTP}, - key: :no_mx_lookups, - label: "No MX lookups", - type: :boolean, - description: "`Swoosh.Adapters.SMTP` adapter specific setting" - }, %{ group: {:subgroup, Swoosh.Adapters.Sendgrid}, key: :api_key, From cfc474c5f7e29238132948d1858e4ed0d88bb062 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sat, 6 Feb 2021 12:01:11 -0600 Subject: [PATCH 04/10] There is no reason to expose these Local adapter settings either. --- config/description.exs | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/config/description.exs b/config/description.exs index 8922a3626..8a4410723 100644 --- a/config/description.exs +++ b/config/description.exs @@ -434,26 +434,6 @@ } ] }, - %{ - group: :swoosh, - type: :group, - description: "`Swoosh.Adapters.Local` adapter specific settings", - children: [ - %{ - group: {:subgroup, Swoosh.Adapters.Local}, - key: :serve_mailbox, - type: :boolean, - description: "Run the preview server together as part of your app" - }, - %{ - group: {:subgroup, Swoosh.Adapters.Local}, - key: :preview_port, - type: :integer, - description: "The preview server port", - suggestions: [4001] - } - ] - }, %{ group: :pleroma, key: :uri_schemes, From 9e3e8e2e30d48c2989bc645f2b7929eb339de09b Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sat, 6 Feb 2021 12:04:28 -0600 Subject: [PATCH 05/10] Update Swoosh docs URL, lint --- config/description.exs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/description.exs b/config/description.exs index 8a4410723..6f6462900 100644 --- a/config/description.exs +++ b/config/description.exs @@ -218,7 +218,7 @@ key: :adapter, type: :module, description: - "One of the mail adapters listed in [Swoosh readme](https://github.com/swoosh/swoosh#adapters)", + "One of the mail adapters listed in [Swoosh documentation](https://hexdocs.pm/swoosh/Swoosh.html#module-adapters)", suggestions: [ Swoosh.Adapters.SMTP, Swoosh.Adapters.Sendgrid, @@ -271,7 +271,7 @@ key: :ssl, label: "SSL", type: :boolean, - description: "Use implicit SSL/TLS: e.g., port 465", + description: "Use implicit SSL/TLS: e.g., port 465" }, %{ group: {:subgroup, Swoosh.Adapters.SMTP}, From 227dd84f1175ed61c768c0ada39b748371c0c441 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sat, 6 Feb 2021 12:06:47 -0600 Subject: [PATCH 06/10] Update SMTP error description and default value --- config/description.exs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/description.exs b/config/description.exs index 6f6462900..6e1a8e7ea 100644 --- a/config/description.exs +++ b/config/description.exs @@ -292,8 +292,8 @@ group: {:subgroup, Swoosh.Adapters.SMTP}, key: :retries, type: :integer, - description: "`Swoosh.Adapters.SMTP` adapter specific setting", - suggestions: [5] + description: "SMTP temporary (4xx) error retries", + suggestions: [1] }, %{ group: {:subgroup, Swoosh.Adapters.Sendgrid}, From bd828e5c9c2c1a373b13cf80b185d11b1fcd1bc3 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sat, 6 Feb 2021 12:28:49 -0600 Subject: [PATCH 07/10] More description improvements --- config/description.exs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/config/description.exs b/config/description.exs index 6e1a8e7ea..54b5fd5d6 100644 --- a/config/description.exs +++ b/config/description.exs @@ -237,7 +237,7 @@ %{ key: :enabled, type: :boolean, - description: "Allow/disallow send emails" + description: "Pleroma Email sending capability" }, %{ group: {:subgroup, Swoosh.Adapters.SMTP}, @@ -256,36 +256,37 @@ group: {:subgroup, Swoosh.Adapters.SMTP}, key: :username, type: :string, - description: "SMTP auth username", + description: "SMTP AUTH username", suggestions: ["user@example.com"] }, %{ group: {:subgroup, Swoosh.Adapters.SMTP}, key: :password, type: :string, - description: "SMTP auth password", + description: "SMTP AUTH password", suggestions: ["password"] }, %{ group: {:subgroup, Swoosh.Adapters.SMTP}, key: :ssl, - label: "SSL", + label: "Use SSL", type: :boolean, - description: "Use implicit SSL/TLS: e.g., port 465" + description: "Use implicit SSL/TLS. e.g. port 465" }, %{ group: {:subgroup, Swoosh.Adapters.SMTP}, key: :tls, - label: "STARTTLS", + label: "STARTTLS Mode", type: {:dropdown, :atom}, - description: "Explicit TLS (STARTTLS) mode", + description: "Explicit TLS (STARTTLS) enforcement mode", suggestions: [:if_available, :always, :never] }, %{ group: {:subgroup, Swoosh.Adapters.SMTP}, key: :auth, + label: "AUTH Mode", type: {:dropdown, :atom}, - description: "SMTP authentication mode", + description: "SMTP AUTH enforcement mode", suggestions: [:if_available, :always, :never] }, %{ From 0fcf16dcb858cdd464fbd614aaba54fb81264199 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sat, 6 Feb 2021 12:34:32 -0600 Subject: [PATCH 08/10] Move Enabled to top as it's the master control of all email. Description not really needed. --- config/description.exs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/config/description.exs b/config/description.exs index 54b5fd5d6..8d3312caa 100644 --- a/config/description.exs +++ b/config/description.exs @@ -214,6 +214,10 @@ type: :group, description: "Mailer-related settings", children: [ + %{ + key: :enabled, + type: :boolean, + }, %{ key: :adapter, type: :module, @@ -234,11 +238,6 @@ Swoosh.Adapters.Gmail ] }, - %{ - key: :enabled, - type: :boolean, - description: "Pleroma Email sending capability" - }, %{ group: {:subgroup, Swoosh.Adapters.SMTP}, key: :relay, From f736501e977f976324cda244b51f0a76ffb4691f Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sat, 6 Feb 2021 13:18:48 -0600 Subject: [PATCH 09/10] Alpha-sort adapters Add various labels, descriptions and suggestions for all adapter settings and try to use the same terminology by the service provider. --- config/description.exs | 111 +++++++++++++++++++---------------------- 1 file changed, 52 insertions(+), 59 deletions(-) diff --git a/config/description.exs b/config/description.exs index 8d3312caa..650b504c1 100644 --- a/config/description.exs +++ b/config/description.exs @@ -216,6 +216,7 @@ children: [ %{ key: :enabled, + label: "Mailer Enabled", type: :boolean, }, %{ @@ -224,18 +225,18 @@ description: "One of the mail adapters listed in [Swoosh documentation](https://hexdocs.pm/swoosh/Swoosh.html#module-adapters)", suggestions: [ + Swoosh.Adapters.AmazonSES, + Swoosh.Adapters.Dyn, + Swoosh.Adapters.Gmail, + Swoosh.Adapters.Mailgun, + Swoosh.Adapters.Mailjet, + Swoosh.Adapters.Mandrill, + Swoosh.Adapters.Postmark, Swoosh.Adapters.SMTP, Swoosh.Adapters.Sendgrid, Swoosh.Adapters.Sendmail, - Swoosh.Adapters.Mandrill, - Swoosh.Adapters.Mailgun, - Swoosh.Adapters.Mailjet, - Swoosh.Adapters.Postmark, - Swoosh.Adapters.SparkPost, - Swoosh.Adapters.AmazonSES, - Swoosh.Adapters.Dyn, Swoosh.Adapters.SocketLabs, - Swoosh.Adapters.Gmail + Swoosh.Adapters.SparkPost ] }, %{ @@ -249,7 +250,8 @@ group: {:subgroup, Swoosh.Adapters.SMTP}, key: :port, type: :integer, - description: "SMTP port" + description: "SMTP port", + suggestions: ["1025"] }, %{ group: {:subgroup, Swoosh.Adapters.SMTP}, @@ -270,7 +272,7 @@ key: :ssl, label: "Use SSL", type: :boolean, - description: "Use implicit SSL/TLS. e.g. port 465" + description: "Use Implicit SSL/TLS. e.g. port 465" }, %{ group: {:subgroup, Swoosh.Adapters.SMTP}, @@ -298,139 +300,130 @@ %{ group: {:subgroup, Swoosh.Adapters.Sendgrid}, key: :api_key, - label: "API key", + label: "SendGrid API Key", type: :string, - description: "`Swoosh.Adapters.Sendgrid` adapter specific setting", - suggestions: ["my-api-key"] + suggestions: ["YOUR_API_KEY"] }, %{ group: {:subgroup, Swoosh.Adapters.Sendmail}, key: :cmd_path, type: :string, - description: "`Swoosh.Adapters.Sendmail` adapter specific setting", suggestions: ["/usr/bin/sendmail"] }, %{ group: {:subgroup, Swoosh.Adapters.Sendmail}, key: :cmd_args, type: :string, - description: "`Swoosh.Adapters.Sendmail` adapter specific setting", suggestions: ["-N delay,failure,success"] }, %{ group: {:subgroup, Swoosh.Adapters.Sendmail}, key: :qmail, + label: "Qmail compat mode", type: :boolean, - description: "`Swoosh.Adapters.Sendmail` adapter specific setting" }, %{ group: {:subgroup, Swoosh.Adapters.Mandrill}, key: :api_key, - label: "API key", + label: "Mandrill API Key", type: :string, - description: "`Swoosh.Adapters.Mandrill` adapter specific setting", - suggestions: ["my-api-key"] + suggestions: ["YOUR_API_KEY"] }, %{ group: {:subgroup, Swoosh.Adapters.Mailgun}, key: :api_key, - label: "API key", + label: "Mailgun API Key", type: :string, - description: "`Swoosh.Adapters.Mailgun` adapter specific setting", - suggestions: ["my-api-key"] + suggestions: ["YOUR_API_KEY"] }, %{ group: {:subgroup, Swoosh.Adapters.Mailgun}, key: :domain, type: :string, - description: "`Swoosh.Adapters.Mailgun` adapter specific setting", - suggestions: ["pleroma.com"] + suggestions: ["YOUR_DOMAIN_NAME"] }, %{ group: {:subgroup, Swoosh.Adapters.Mailjet}, key: :api_key, - label: "API key", + label: "MailJet Public API Key", type: :string, - description: "`Swoosh.Adapters.Mailjet` adapter specific setting", - suggestions: ["my-api-key"] + suggestions: ["MJ_APIKEY_PUBLIC"] }, %{ group: {:subgroup, Swoosh.Adapters.Mailjet}, key: :secret, + label: "MailJet Private API Key", type: :string, - description: "`Swoosh.Adapters.Mailjet` adapter specific setting", - suggestions: ["my-secret-key"] + suggestions: ["MJ_APIKEY_PRIVATE"] }, %{ group: {:subgroup, Swoosh.Adapters.Postmark}, key: :api_key, - label: "API key", + label: "Postmark API Key", type: :string, - description: "`Swoosh.Adapters.Postmark` adapter specific setting", - suggestions: ["my-api-key"] + suggestions: ["X-Postmark-Server-Token"] }, %{ group: {:subgroup, Swoosh.Adapters.SparkPost}, key: :api_key, - label: "API key", + label: "SparkPost API key", type: :string, - description: "`Swoosh.Adapters.SparkPost` adapter specific setting", - suggestions: ["my-api-key"] + suggestions: ["YOUR_API_KEY"] }, %{ group: {:subgroup, Swoosh.Adapters.SparkPost}, key: :endpoint, type: :string, - description: "`Swoosh.Adapters.SparkPost` adapter specific setting", suggestions: ["https://api.sparkpost.com/api/v1"] }, - %{ - group: {:subgroup, Swoosh.Adapters.AmazonSES}, - key: :region, - type: :string, - description: "`Swoosh.Adapters.AmazonSES` adapter specific setting", - suggestions: ["us-east-1", "us-east-2"] - }, %{ group: {:subgroup, Swoosh.Adapters.AmazonSES}, key: :access_key, + label: "AWS Access Key", type: :string, - description: "`Swoosh.Adapters.AmazonSES` adapter specific setting", - suggestions: ["aws-access-key"] + suggestions: ["AWS_ACCESS_KEY"] }, %{ group: {:subgroup, Swoosh.Adapters.AmazonSES}, key: :secret, + label: "AWS Secret Key", type: :string, - description: "`Swoosh.Adapters.AmazonSES` adapter specific setting", - suggestions: ["aws-secret-key"] + suggestions: ["AWS_SECRET_KEY"] + }, + %{ + group: {:subgroup, Swoosh.Adapters.AmazonSES}, + key: :region, + label: "AWS Region", + type: :string, + suggestions: ["us-east-1", "us-east-2"] }, %{ group: {:subgroup, Swoosh.Adapters.Dyn}, key: :api_key, - label: "API key", + label: "Dyn API Key", type: :string, - description: "`Swoosh.Adapters.Dyn` adapter specific setting", - suggestions: ["my-api-key"] - }, - %{ - group: {:subgroup, Swoosh.Adapters.SocketLabs}, - key: :server_id, - type: :string, - description: "`Swoosh.Adapters.SocketLabs` adapter specific setting" + suggestions: ["apikey"] }, %{ group: {:subgroup, Swoosh.Adapters.SocketLabs}, key: :api_key, - label: "API key", + label: "SocketLabs API Key", type: :string, - description: "`Swoosh.Adapters.SocketLabs` adapter specific setting" + suggestions: ["INJECTION_API_KEY"] + }, + %{ + group: {:subgroup, Swoosh.Adapters.SocketLabs}, + key: :server_id, + label: "Server ID", + type: :string, + suggestions: ["SERVER_ID"] }, %{ group: {:subgroup, Swoosh.Adapters.Gmail}, key: :access_token, + label: "GMail API Access Token", type: :string, - description: "`Swoosh.Adapters.Gmail` adapter specific setting" + suggestions: ["GMAIL_API_ACCESS_TOKEN"] } ] }, From 4dbb08a19f57e720e299608ebeb4387d37c55e99 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sat, 6 Feb 2021 13:20:58 -0600 Subject: [PATCH 10/10] Improved Mailer descriptions --- CHANGELOG.md | 3 ++- config/description.exs | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1dbdb3f4e..15c75353f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Deprecated `Pleroma.Uploaders.S3, :public_endpoint`. Now `Pleroma.Upload, :base_url` is the standard configuration key for all uploaders. - Improved Apache webserver support: updated sample configuration, MediaProxy cache invalidation verified with the included sample script - Improve OAuth 2.0 provider support. A missing `fqn` field was added to the response, but does not expose the user's email address. -- Provide redirect of external posts from `/notice/:id` to their original URL +- Provide redirect of external posts from `/notice/:id` to their original URL. +- Improved Mailer configuration setting descriptions for AdminFE.
API Changes diff --git a/config/description.exs b/config/description.exs index 650b504c1..8eefa2ba1 100644 --- a/config/description.exs +++ b/config/description.exs @@ -217,7 +217,7 @@ %{ key: :enabled, label: "Mailer Enabled", - type: :boolean, + type: :boolean }, %{ key: :adapter, @@ -320,7 +320,7 @@ group: {:subgroup, Swoosh.Adapters.Sendmail}, key: :qmail, label: "Qmail compat mode", - type: :boolean, + type: :boolean }, %{ group: {:subgroup, Swoosh.Adapters.Mandrill},