diff options
author | Chocobozzz <me@florianbigard.com> | 2020-02-17 10:27:00 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-02-17 10:27:00 +0100 |
commit | 4c1c17093461b58d3ee3f23f239e340d8dac1149 (patch) | |
tree | 236b724f1415a812a4274fd63b519124cba2e42f /server/controllers | |
parent | 45f1bd72a08998c60a9dd68ff069cea9de39161c (diff) | |
download | PeerTube-4c1c17093461b58d3ee3f23f239e340d8dac1149.tar.gz PeerTube-4c1c17093461b58d3ee3f23f239e340d8dac1149.tar.zst PeerTube-4c1c17093461b58d3ee3f23f239e340d8dac1149.zip |
Refactor email enabled function
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/api/config.ts | 5 | ||||
-rw-r--r-- | server/controllers/static.ts | 11 |
2 files changed, 7 insertions, 9 deletions
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts index a383a723f..06fe30371 100644 --- a/server/controllers/api/config.ts +++ b/server/controllers/api/config.ts | |||
@@ -11,10 +11,9 @@ import { ClientHtml } from '../../lib/client-html' | |||
11 | import { auditLoggerFactory, CustomConfigAuditView, getAuditIdFromRes } from '../../helpers/audit-logger' | 11 | import { auditLoggerFactory, CustomConfigAuditView, getAuditIdFromRes } from '../../helpers/audit-logger' |
12 | import { remove, writeJSON } from 'fs-extra' | 12 | import { remove, writeJSON } from 'fs-extra' |
13 | import { getServerCommit } from '../../helpers/utils' | 13 | import { getServerCommit } from '../../helpers/utils' |
14 | import { Emailer } from '../../lib/emailer' | ||
15 | import validator from 'validator' | 14 | import validator from 'validator' |
16 | import { objectConverter } from '../../helpers/core-utils' | 15 | import { objectConverter } from '../../helpers/core-utils' |
17 | import { CONFIG, reloadConfig } from '../../initializers/config' | 16 | import { CONFIG, isEmailEnabled, reloadConfig } from '../../initializers/config' |
18 | import { PluginManager } from '../../lib/plugins/plugin-manager' | 17 | import { PluginManager } from '../../lib/plugins/plugin-manager' |
19 | import { getThemeOrDefault } from '../../lib/plugins/theme-utils' | 18 | import { getThemeOrDefault } from '../../lib/plugins/theme-utils' |
20 | import { Hooks } from '@server/lib/plugins/hooks' | 19 | import { Hooks } from '@server/lib/plugins/hooks' |
@@ -87,7 +86,7 @@ async function getConfig (req: express.Request, res: express.Response) { | |||
87 | default: defaultTheme | 86 | default: defaultTheme |
88 | }, | 87 | }, |
89 | email: { | 88 | email: { |
90 | enabled: Emailer.isEnabled() | 89 | enabled: isEmailEnabled() |
91 | }, | 90 | }, |
92 | contactForm: { | 91 | contactForm: { |
93 | enabled: CONFIG.CONTACT_FORM.ENABLED | 92 | enabled: CONFIG.CONTACT_FORM.ENABLED |
diff --git a/server/controllers/static.ts b/server/controllers/static.ts index 75d1a816b..271b788f6 100644 --- a/server/controllers/static.ts +++ b/server/controllers/static.ts | |||
@@ -1,15 +1,15 @@ | |||
1 | import * as cors from 'cors' | 1 | import * as cors from 'cors' |
2 | import * as express from 'express' | 2 | import * as express from 'express' |
3 | import { | 3 | import { |
4 | CONSTRAINTS_FIELDS, | ||
5 | DEFAULT_THEME_NAME, | ||
4 | HLS_STREAMING_PLAYLIST_DIRECTORY, | 6 | HLS_STREAMING_PLAYLIST_DIRECTORY, |
5 | PEERTUBE_VERSION, | 7 | PEERTUBE_VERSION, |
6 | ROUTE_CACHE_LIFETIME, | 8 | ROUTE_CACHE_LIFETIME, |
7 | STATIC_DOWNLOAD_PATHS, | 9 | STATIC_DOWNLOAD_PATHS, |
8 | STATIC_MAX_AGE, | 10 | STATIC_MAX_AGE, |
9 | STATIC_PATHS, | 11 | STATIC_PATHS, |
10 | WEBSERVER, | 12 | WEBSERVER |
11 | CONSTRAINTS_FIELDS, | ||
12 | DEFAULT_THEME_NAME | ||
13 | } from '../initializers/constants' | 13 | } from '../initializers/constants' |
14 | import { cacheRoute } from '../middlewares/cache' | 14 | import { cacheRoute } from '../middlewares/cache' |
15 | import { asyncMiddleware, videosDownloadValidator } from '../middlewares' | 15 | import { asyncMiddleware, videosDownloadValidator } from '../middlewares' |
@@ -19,8 +19,7 @@ import { VideoCommentModel } from '../models/video/video-comment' | |||
19 | import { HttpNodeinfoDiasporaSoftwareNsSchema20 } from '../../shared/models/nodeinfo' | 19 | import { HttpNodeinfoDiasporaSoftwareNsSchema20 } from '../../shared/models/nodeinfo' |
20 | import { join } from 'path' | 20 | import { join } from 'path' |
21 | import { root } from '../helpers/core-utils' | 21 | import { root } from '../helpers/core-utils' |
22 | import { CONFIG } from '../initializers/config' | 22 | import { CONFIG, isEmailEnabled } from '../initializers/config' |
23 | import { Emailer } from '../lib/emailer' | ||
24 | import { getPreview, getVideoCaption } from './lazy-static' | 23 | import { getPreview, getVideoCaption } from './lazy-static' |
25 | import { VideoStreamingPlaylistType } from '@shared/models/videos/video-streaming-playlist.type' | 24 | import { VideoStreamingPlaylistType } from '@shared/models/videos/video-streaming-playlist.type' |
26 | import { MVideoFile, MVideoFullLight } from '@server/typings/models' | 25 | import { MVideoFile, MVideoFullLight } from '@server/typings/models' |
@@ -249,7 +248,7 @@ async function generateNodeinfo (req: express.Request, res: express.Response) { | |||
249 | default: getThemeOrDefault(CONFIG.THEME.DEFAULT, DEFAULT_THEME_NAME) | 248 | default: getThemeOrDefault(CONFIG.THEME.DEFAULT, DEFAULT_THEME_NAME) |
250 | }, | 249 | }, |
251 | email: { | 250 | email: { |
252 | enabled: Emailer.isEnabled() | 251 | enabled: isEmailEnabled() |
253 | }, | 252 | }, |
254 | contactForm: { | 253 | contactForm: { |
255 | enabled: CONFIG.CONTACT_FORM.ENABLED | 254 | enabled: CONFIG.CONTACT_FORM.ENABLED |