Skip to content

Commit

Permalink
fix(templates): Allow setting brand name to replace 'EmailEngine' in …
Browse files Browse the repository at this point in the history
…the HTML title
  • Loading branch information
andris9 committed Dec 30, 2024
1 parent b2c0c5a commit bf85c06
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = function (grunt) {
wait: {
server: {
options: {
delay: 6 * 1000
delay: 12 * 1000
}
}
},
Expand Down
5 changes: 5 additions & 0 deletions lib/routes-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -1234,6 +1234,7 @@ function applyRoutes(server, call) {

imapIndexer: (await settings.get('imapIndexer')) || 'full',

pageBrandName: (await settings.get('pageBrandName')) || '',
templateHeader: (await settings.get('templateHeader')) || '',
templateHtmlHead: (await settings.get('templateHtmlHead')) || '',
scriptEnv: (await settings.get('scriptEnv')) || '',
Expand Down Expand Up @@ -1305,6 +1306,7 @@ function applyRoutes(server, call) {
let data = {
serviceSecret: request.payload.serviceSecret,
queueKeep: request.payload.queueKeep,
pageBrandName: request.payload.pageBrandName,
templateHeader: request.payload.templateHeader,
templateHtmlHead: request.payload.templateHtmlHead,
scriptEnv: request.payload.scriptEnv,
Expand Down Expand Up @@ -1429,6 +1431,7 @@ function applyRoutes(server, call) {
queueKeep: settingsSchema.queueKeep.default(0),
deliveryAttempts: settingsSchema.deliveryAttempts.default(DEFAULT_DELIVERY_ATTEMPTS),
imapIndexer: settingsSchema.imapIndexer.default('full'),
pageBrandName: settingsSchema.pageBrandName.default(''),
templateHeader: settingsSchema.templateHeader.default(''),
templateHtmlHead: settingsSchema.templateHtmlHead.default(''),
scriptEnv: settingsSchema.scriptEnv.default(''),
Expand Down Expand Up @@ -1844,6 +1847,7 @@ return true;`
return h.view(
'config/service-preview',
{
pageBrandName: request.payload.pageBrandName,
embeddedTemplateHeader: request.payload.templateHeader,
embeddedTemplateHtmlHeadr: request.payload.templateHtmlHead
},
Expand All @@ -1866,6 +1870,7 @@ return true;`
},

payload: Joi.object({
pageBrandName: settingsSchema.pageBrandName.default(''),
templateHeader: settingsSchema.templateHeader.default(''),
templateHtmlHead: settingsSchema.templateHtmlHead.default('')
})
Expand Down
2 changes: 2 additions & 0 deletions lib/schemas.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,8 @@ const settingsSchema = {

timezone: Joi.string().max(100).example('Europe/Tallinn').description('Default timezone identifier'),

pageBrandName: Joi.string().allow('', null).max(1024).example('EmailEngine').description('Brand name to use in the HTML title element'),

openAiPreProcessingFn: Joi.string()
.allow('')
.max(512 * 1024)
Expand Down
2 changes: 1 addition & 1 deletion static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="EmailEngine Homepage" />
<meta name="description" content="EmailEngine Application page; The Ultimate Email API for Developers" />
<title>EmailEngine</title>

<link rel="apple-touch-icon" href="/static/favicon/apple-touch-icon.png" sizes="180x180" />
Expand Down
15 changes: 15 additions & 0 deletions views/config/service.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,21 @@
<p>These settings apply to all publicly accessible pages, such as 404 error pages, the hosted authentication
form, and the virtual mailing list unsubscribe page.</p>

<div class="form-group">
<div class="text-muted float-right code-link">[<a href="/admin/swagger#/Settings/postV1Settings"
target="_blank" rel="noopener noreferrer">pageBrandName</a>]</div>

<label for="settingsPageBrandName">Brand name</label>
<input type="text" class="form-control {{#if errors.pageBrandName}}is-invalid{{/if}}"
id="settingsPageBrandName" name="pageBrandName" value="{{values.pageBrandName}}"
data-lpignore="true" autocomplete="off" placeholder="Brand name like &quot;EmailEngine&quot;" />
{{#if errors.pageBrandName}}
<span class="invalid-feedback">{{errors.pageBrandName}}</span>
{{/if}}
<small class="form-text text-muted">Brand name to use in the HTML title element (defaults to
<em>"EmailEngine"</em>)</small>
</div>

<div class="form-group">

<div class="text-muted float-right code-link">[<a href="/admin/swagger#/Settings/postV1Settings"
Expand Down
4 changes: 2 additions & 2 deletions views/layout/app.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="EmailEngine Homepage" />
<meta name="description" content="EmailEngine Application page; The Ultimate Email API for Developers" />
<meta name="author" content="Postal Systems OÜ">

<title>{{#if pageTitleFull}}{{pageTitleFull}}{{else}}EmailEngine{{#if pageTitle}} &ndash;
<title>{{#if pageTitleFull}}{{pageTitleFull}}{{else}}{{pageBrandName}}{{#if pageTitle}} &ndash;
{{pageTitle}}{{/if}}{{/if}}</title>

<link rel="apple-touch-icon" href="/static/favicon/apple-touch-icon.png" sizes="180x180" />
Expand Down
4 changes: 2 additions & 2 deletions views/layout/login.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="EmailEngine Homepage" />
<meta name="description" content="EmailEngine Application page; The Ultimate Email API for Developers" />
<meta name="author" content="Postal Systems OÜ">

<title>{{#if pageTitleFull}}{{pageTitleFull}}{{else}}EmailEngine{{#if pageTitle}} &ndash;
<title>{{#if pageTitleFull}}{{pageTitleFull}}{{else}}{{pageBrandName}}{{#if pageTitle}} &ndash;
{{pageTitle}}{{/if}}{{/if}}</title>

<link rel="apple-touch-icon" href="/static/favicon/apple-touch-icon.png" sizes="180x180" />
Expand Down
2 changes: 1 addition & 1 deletion views/layout/main.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="EmailEngine Homepage" />
<meta name="description" content="EmailEngine Application page; The Ultimate Email API for Developers" />
<title>EmailEngine</title>

<link rel="apple-touch-icon" href="/static/favicon/apple-touch-icon.png" sizes="180x180" />
Expand Down
4 changes: 2 additions & 2 deletions views/layout/public.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="EmailEngine Homepage" />
<meta name="description" content="EmailEngine Application page; The Ultimate Email API for Developers" />
<meta name="author" content="Postal Systems OÜ">

<title>{{#if pageTitleFull}}{{pageTitleFull}}{{else}}EmailEngine{{#if pageTitle}} &ndash;
<title>{{#if pageTitleFull}}{{pageTitleFull}}{{else}}{{pageBrandName}}{{#if pageTitle}} &ndash;
{{pageTitle}}{{/if}}{{/if}}</title>

<link rel="apple-touch-icon" href="/static/favicon/apple-touch-icon.png" sizes="180x180" />
Expand Down
7 changes: 5 additions & 2 deletions workers/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -8453,7 +8453,8 @@ ${now}`,
serviceUrl,
language,
locale,
timezone
timezone,
pageBrandName
} = await settings.getMulti(
'upgrade',
'subexp',
Expand All @@ -8470,7 +8471,8 @@ ${now}`,
'serviceUrl',
'language',
'locale',
'timezone'
'timezone',
'pageBrandName'
);

const systemAlerts = [];
Expand Down Expand Up @@ -8614,6 +8616,7 @@ ${now}`,
}

return {
pageBrandName: pageBrandName || 'EmailEngine',
values: request.payload || {},
errors: (request.error && request.error.details) || {},
pendingMessages,
Expand Down

0 comments on commit bf85c06

Please sign in to comment.