Apply last changes in development branch

This commit is contained in:
joker-x 2020-09-06 03:26:57 +02:00
commit 01d9e8b90a
14 changed files with 30 additions and 39 deletions

View file

@ -269,6 +269,7 @@ variables (e.g. `URL_BASE_TRUSTED=https://mailtrain.domain.com (and more env-var
| CAS_MAILTAG | The field used to save the email (default: mail) | | CAS_MAILTAG | The field used to save the email (default: mail) |
| CAS_NEWUSERROLE | The role of new users (default: nobody) | | CAS_NEWUSERROLE | The role of new users (default: nobody) |
| CAS_NEWUSERNAMESPACEID | The namespace id of new users (default: 1) | | CAS_NEWUSERNAMESPACEID | The namespace id of new users (default: 1) |
| LOG_LEVEL | sets log level among `silly|verbose|info|http|warn|error|silent` (default: `info`) |
If you don't want to modify the original `docker-compose.yml`, you can put your overrides to another file (e.g. `docker-compose.override.yml`) -- like the one below. If you don't want to modify the original `docker-compose.yml`, you can put your overrides to another file (e.g. `docker-compose.override.yml`) -- like the one below.

View file

@ -327,7 +327,7 @@ export default class CUD extends Component {
data.source = channel.source; data.source = channel.source;
if (channel.source === CampaignSource.CUSTOM_FROM_TEMPLATE) { if (channel.source === CampaignSource.CUSTOM_FROM_TEMPLATE) {
data.data_sourceTemplate = channel.sourceTemplate; data.data_sourceTemplate = channel.data.sourceTemplate;
} else if (channel.source === CampaignSource.CUSTOM_FROM_CAMPAIGN) { } else if (channel.source === CampaignSource.CUSTOM_FROM_CAMPAIGN) {
data.data_sourceCampaign = channel.data.sourceCampaign; data.data_sourceCampaign = channel.data.sourceCampaign;

View file

@ -700,7 +700,7 @@ export function getEditForm(owner, typeKey, prefix = '') {
height="400px" height="400px"
mode="text" mode="text"
label={t('templateContentPlainText')} label={t('templateContentPlainText')}
help={<Trans i18nKey="toExtractTheTextFromHtmlClickHerePlease">To extract the text from HTML click <ActionLink onClickAsync={::owner.extractPlainText}>here</ActionLink>. Please note that your existing plaintext in the field above will be overwritten. This feature uses the <a href="http://premailer.dialect.ca/api">Premailer API</a>, a third party service. Their Terms of Service and Privacy Policy apply.</Trans>} help={<Trans i18nKey="toExtractTheTextFromHtmlClickHerePlease">To extract the text from HTML click <ActionLink onClickAsync={::owner.extractPlainText}>here</ActionLink>. Please note that your existing plaintext in the field above will be overwritten.</Trans>}
/> />
</div> </div>
); );

View file

@ -41,6 +41,7 @@ MYSQL_USER=${MYSQL_USER:-'mailtrain'}
MYSQL_PASSWORD=${MYSQL_PASSWORD:-'mailtrain'} MYSQL_PASSWORD=${MYSQL_PASSWORD:-'mailtrain'}
WITH_ZONE_MTA=${WITH_ZONE_MTA:-'true'} WITH_ZONE_MTA=${WITH_ZONE_MTA:-'true'}
POOL_NAME=${POOL_NAME:-$(hostname)} POOL_NAME=${POOL_NAME:-$(hostname)}
LOG_LEVEL=${LOG_LEVEL:-'info'}
# Warning for users that already rely on the MAILTRAIN_SETTING variable # Warning for users that already rely on the MAILTRAIN_SETTING variable
# Can probably be removed in the future. # Can probably be removed in the future.
@ -88,6 +89,9 @@ builtinZoneMTA:
queue: queue:
processes: 5 processes: 5
log:
level: $LOG_LEVEL
EOT EOT
# Manage LDAP if enabled # Manage LDAP if enabled

View file

@ -955,7 +955,7 @@
"contentOfAnRssEntry": "Inhalt eines RSS Eintrag", "contentOfAnRssEntry": "Inhalt eines RSS Eintrag",
"rssEntrySummary": "RSS Eintrag Zusammenfassung", "rssEntrySummary": "RSS Eintrag Zusammenfassung",
"rssEntryImageUrl": "RSS Eintrag Bild URL", "rssEntryImageUrl": "RSS Eintrag Bild URL",
"toExtractTheTextFromHtmlClickHerePlease": "<1>Hier</1> klicken den Text aus dem HTML zu extrahieren. Hinweis: der bestehende Klartext wird überschrieben. Dieses Feature nutzt die <3>Premailer API</3>. Es gelten die Datenschutzbestimmungen des Anbieters.", "toExtractTheTextFromHtmlClickHerePlease": "<1>Hier</1> klicken den Text aus dem HTML zu extrahieren. Hinweis: der bestehende Klartext wird überschrieben.",
"mosaicoTemplateUpdated": "Mosaico Vorlage aktualisiert", "mosaicoTemplateUpdated": "Mosaico Vorlage aktualisiert",
"mosaicoTemplateCreated": "Mosaico Vorlage erstellt", "mosaicoTemplateCreated": "Mosaico Vorlage erstellt",
"deletingMosaicoTemplate": "Mosaico Vorlage wird gelöscht ...", "deletingMosaicoTemplate": "Mosaico Vorlage wird gelöscht ...",

View file

@ -961,7 +961,7 @@
"contentOfAnRssEntry": "Content of an RSS entry", "contentOfAnRssEntry": "Content of an RSS entry",
"rssEntrySummary": "RSS entry summary", "rssEntrySummary": "RSS entry summary",
"rssEntryImageUrl": "RSS entry image URL", "rssEntryImageUrl": "RSS entry image URL",
"toExtractTheTextFromHtmlClickHerePlease": "To extract the text from HTML click <1>here</1>. Please note that your existing plaintext in the field above will be overwritten. This feature uses the <3>Premailer API</3>, a third party service. Their Terms of Service and Privacy Policy apply.", "toExtractTheTextFromHtmlClickHerePlease": "To extract the text from HTML click <1>here</1>. Please note that your existing plaintext in the field above will be overwritten.",
"mosaicoTemplateUpdated": "Mosaico template updated", "mosaicoTemplateUpdated": "Mosaico template updated",
"mosaicoTemplateCreated": "Mosaico template created", "mosaicoTemplateCreated": "Mosaico template created",
"deletingMosaicoTemplate": "Deleting Mosaico template ...", "deletingMosaicoTemplate": "Deleting Mosaico template ...",

View file

@ -985,7 +985,7 @@
"contentOfAnRssEntry": "Contenido de la entrada RSS", "contentOfAnRssEntry": "Contenido de la entrada RSS",
"rssEntrySummary": "Resumen de la entrada RSS", "rssEntrySummary": "Resumen de la entrada RSS",
"rssEntryImageUrl": "Enlace a la imágen RSS", "rssEntryImageUrl": "Enlace a la imágen RSS",
"toExtractTheTextFromHtmlClickHerePlease": "To extract the text from HTML click <1>here</1>. Please note that your existing plaintext in the field above will be overwritten. This feature uses the <3>Premailer API</3>, a third party service. Their Terms of Service and Privacy Policy apply.", "toExtractTheTextFromHtmlClickHerePlease": "To extract the text from HTML click <1>here</1>. Please note that your existing plaintext in the field above will be overwritten.",
"mosaicoTemplateUpdated": "Plantilla Mosaico actualizada", "mosaicoTemplateUpdated": "Plantilla Mosaico actualizada",
"mosaicoTemplateCreated": "Plantilla Mosaico creada", "mosaicoTemplateCreated": "Plantilla Mosaico creada",
"deletingMosaicoTemplate": "Borrando plantilla Mosaico ...", "deletingMosaicoTemplate": "Borrando plantilla Mosaico ...",

View file

@ -956,7 +956,7 @@
"contentOfAnRssEntry": "Contenu d'une entrée RSS", "contentOfAnRssEntry": "Contenu d'une entrée RSS",
"rssEntrySummary": "Résumé de l'entrée RSS", "rssEntrySummary": "Résumé de l'entrée RSS",
"rssEntryImageUrl": "URL de l'image d'entrée RSS", "rssEntryImageUrl": "URL de l'image d'entrée RSS",
"toExtractTheTextFromHtmlClickHerePlease": "Pour extraire le texte de HTML, cliquez <1> ici </1>. Veuillez noter que votre texte en clair existant dans le champ ci-dessus sera écrasé. Cette fonctionnalité utilise l '<3> API Premailer </3>, un service tiers. Leurs conditions d'utilisation et leur politique de confidentialité s'appliquent. ", "toExtractTheTextFromHtmlClickHerePlease": "Pour extraire le texte de HTML, cliquez <1> ici </1>. Veuillez noter que votre texte en clair existant dans le champ ci-dessus sera écrasé.",
"mosaicoTemplateUpdated": "Modèle Mosaico mis à jour", "mosaicoTemplateUpdated": "Modèle Mosaico mis à jour",
"mosaicoTemplateCreated": "Modèle Mosaico créé", "mosaicoTemplateCreated": "Modèle Mosaico créé",
"deletingMosaicoTemplate": "Suppression du modèle Mosaico ...", "deletingMosaicoTemplate": "Suppression du modèle Mosaico ...",

View file

@ -1028,7 +1028,7 @@
"contentOfAnRssEntry": "Conteúdo de uma entrada RSS", "contentOfAnRssEntry": "Conteúdo de uma entrada RSS",
"rssEntrySummary": "Resumo da entrada do RSS", "rssEntrySummary": "Resumo da entrada do RSS",
"rssEntryImageUrl": "URL da imagem de entrada RSS", "rssEntryImageUrl": "URL da imagem de entrada RSS",
"toExtractTheTextFromHtmlClickHerePlease": "Para extrair o texto do HTML, clique <1> aqui </ 1>. Observe que o texto original existente no campo acima será sobrescrito. Esse recurso usa a <3> Premailer API </ 3>, uma serviço de terceiros. Os seus Termos de Serviço e Política de Privacidade são aplicáveis. ", "toExtractTheTextFromHtmlClickHerePlease": "Para extrair o texto do HTML, clique <1> aqui </ 1>. Observe que o texto original existente no campo acima será sobrescrito.",
"mosaicoTemplateUpdated": "Mosaico template updated", "mosaicoTemplateUpdated": "Mosaico template updated",
"mosaicoTemplateUpdated - TODO: update line above and then delete this line to mark that the translation has been fixed": "Mosaico template updated", "mosaicoTemplateUpdated - TODO: update line above and then delete this line to mark that the translation has been fixed": "Mosaico template updated",
"mosaicoTemplateCreated": "Mosaico template created", "mosaicoTemplateCreated": "Mosaico template created",

View file

@ -12162,15 +12162,6 @@
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz",
"integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=" "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ="
}, },
"premailer-api": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/premailer-api/-/premailer-api-1.0.4.tgz",
"integrity": "sha1-hz9A/DiN3IgG81uY3NKymTeKh08=",
"requires": {
"request": "^2.72.0",
"underscore": "^1.8.3"
}
},
"process-nextick-args": { "process-nextick-args": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz",
@ -13432,11 +13423,6 @@
"resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz",
"integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=" "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo="
}, },
"underscore": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz",
"integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg=="
},
"underscore.string": { "underscore.string": {
"version": "3.3.5", "version": "3.3.5",
"resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-3.3.5.tgz", "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-3.3.5.tgz",

View file

@ -102,7 +102,6 @@
"openpgp": "^4.7.2", "openpgp": "^4.7.2",
"passport": "^0.4.1", "passport": "^0.4.1",
"passport-local": "^1.0.0", "passport-local": "^1.0.0",
"premailer-api": "^1.0.4",
"request": "^2.88.0", "request": "^2.88.0",
"request-promise": "^4.2.5", "request-promise": "^4.2.5",
"serve-favicon": "^2.5.0", "serve-favicon": "^2.5.0",

View file

@ -18,6 +18,8 @@ const slugify = require('slugify');
const passport = require('../lib/passport'); const passport = require('../lib/passport');
const templates = require('../models/templates'); const templates = require('../models/templates');
const campaigns = require('../models/campaigns'); const campaigns = require('../models/campaigns');
const urls = require('../lib/urls')
const { getMergeTagsForBases } = require('../../shared/templates')
const {castToInteger} = require('../lib/helpers'); const {castToInteger} = require('../lib/helpers');
const {getSystemSendConfigurationId} = require('../../shared/send-configurations'); const {getSystemSendConfigurationId} = require('../../shared/send-configurations');
@ -362,7 +364,9 @@ router.postAsync('/templates/:templateId/send', async (req, res) => {
} }
const emails = input.EMAIL.split(','); const emails = input.EMAIL.split(',');
const mergeTags = input.TAGS || {}; const mergeTagsGlobal = getMergeTagsForBases(urls.getTrustedUrl(), urls.getSandboxUrl(), urls.getPublicUrl());
const mergeTagsLocal = input.TAGS || {};
const mergeTags = { ...mergeTagsGlobal, ...mergeTagsLocal}
const subject = input.SUBJECT || ''; const subject = input.SUBJECT || '';
const attachments = input.ATTACHMENTS || []; const attachments = input.ATTACHMENTS || [];

View file

@ -3,23 +3,14 @@
const passport = require('../../lib/passport'); const passport = require('../../lib/passport');
const bluebird = require('bluebird'); const bluebird = require('bluebird');
const premailerApi = require('premailer-api'); const htmlToText = require('html-to-text');
const premailerPrepareAsync = bluebird.promisify(premailerApi.prepare.bind(premailerApi));
const router = require('../../lib/router-async').create(); const router = require('../../lib/router-async').create();
router.postAsync('/html-to-text', passport.loggedIn, passport.csrfProtection, async (req, res) => { router.postAsync('/html-to-text', passport.loggedIn, passport.csrfProtection, async (req, res) => {
if (!req.body.html) { const email = htmlToText.fromString(req.body.html, {wordwrap: 130});
return res.json({text: ''}); // Premailer crashes very hard when html is empty
}
const email = await premailerPrepareAsync({
html: req.body.html,
fetchHTML: false
});
res.json({text: email.text.replace(/%5B/g, '[').replace(/%5D/g, ']')});
res.json({text: email});
}); });
module.exports = router; module.exports = router;

View file

@ -281,6 +281,11 @@ router.postAsync('/:cid/subscribe', passport.parseForm, corsOrCsrfProtection, as
if (existingSubscription && existingSubscription.status === SubscriptionStatus.SUBSCRIBED) { if (existingSubscription && existingSubscription.status === SubscriptionStatus.SUBSCRIBED) {
await mailHelpers.sendAlreadySubscribed(req.locale, list, email, existingSubscription); await mailHelpers.sendAlreadySubscribed(req.locale, list, email, existingSubscription);
if (req.xhr) {
return res.status(200).json({
msg: tUI('pleaseConfirmSubscription', req.locale)
});
}
res.redirect('/subscription/' + encodeURIComponent(req.params.cid) + '/confirm-subscription-notice'); res.redirect('/subscription/' + encodeURIComponent(req.params.cid) + '/confirm-subscription-notice');
} else { } else {
@ -325,17 +330,18 @@ router.getAsync('/:cid/widget', cors(corsOptions), async (req, res) => {
title: list.name, title: list.name,
cid: list.cid, cid: list.cid,
publicKeyUrl: getTrustedUrl('subscription/publickey'), publicKeyUrl: getTrustedUrl('subscription/publickey'),
subscribeUrl: getTrustedUrl(`subscription/${list.cid}/subscribe`), subscribeUrl: getPublicUrl(`subscription/${list.cid}/subscribe`),
hasPubkey: !!configItems.pgpPrivateKey, hasPubkey: !!configItems.pgpPrivateKey,
customFields: await fields.forHbs(contextHelpers.getAdminContext(), list.id), customFields: await fields.forHbs(contextHelpers.getAdminContext(), list.id),
template: {}, template: 'subscription/widget-subscribe.hbs',
layout: null, layout: null,
}; };
await injectCustomFormData(req.query.fid || list.default_form, 'web_subscribe', data); await injectCustomFormData(req.query.fid || list.default_form, 'web_subscribe', data);
const renderAsync = bluebird.promisify(res.render.bind(res)); const htmlRenderer = await tools.getTemplate(data.template, req.locale);
const html = await renderAsync('subscription/widget-subscribe', data);
const html = htmlRenderer(data);
const response = { const response = {
data: { data: {