aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-02-17 10:27:00 +0100
committerChocobozzz <me@florianbigard.com>2020-02-17 10:27:00 +0100
commit4c1c17093461b58d3ee3f23f239e340d8dac1149 (patch)
tree236b724f1415a812a4274fd63b519124cba2e42f /server/controllers
parent45f1bd72a08998c60a9dd68ff069cea9de39161c (diff)
downloadPeerTube-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.ts5
-rw-r--r--server/controllers/static.ts11
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'
11import { auditLoggerFactory, CustomConfigAuditView, getAuditIdFromRes } from '../../helpers/audit-logger' 11import { auditLoggerFactory, CustomConfigAuditView, getAuditIdFromRes } from '../../helpers/audit-logger'
12import { remove, writeJSON } from 'fs-extra' 12import { remove, writeJSON } from 'fs-extra'
13import { getServerCommit } from '../../helpers/utils' 13import { getServerCommit } from '../../helpers/utils'
14import { Emailer } from '../../lib/emailer'
15import validator from 'validator' 14import validator from 'validator'
16import { objectConverter } from '../../helpers/core-utils' 15import { objectConverter } from '../../helpers/core-utils'
17import { CONFIG, reloadConfig } from '../../initializers/config' 16import { CONFIG, isEmailEnabled, reloadConfig } from '../../initializers/config'
18import { PluginManager } from '../../lib/plugins/plugin-manager' 17import { PluginManager } from '../../lib/plugins/plugin-manager'
19import { getThemeOrDefault } from '../../lib/plugins/theme-utils' 18import { getThemeOrDefault } from '../../lib/plugins/theme-utils'
20import { Hooks } from '@server/lib/plugins/hooks' 19import { 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 @@
1import * as cors from 'cors' 1import * as cors from 'cors'
2import * as express from 'express' 2import * as express from 'express'
3import { 3import {
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'
14import { cacheRoute } from '../middlewares/cache' 14import { cacheRoute } from '../middlewares/cache'
15import { asyncMiddleware, videosDownloadValidator } from '../middlewares' 15import { asyncMiddleware, videosDownloadValidator } from '../middlewares'
@@ -19,8 +19,7 @@ import { VideoCommentModel } from '../models/video/video-comment'
19import { HttpNodeinfoDiasporaSoftwareNsSchema20 } from '../../shared/models/nodeinfo' 19import { HttpNodeinfoDiasporaSoftwareNsSchema20 } from '../../shared/models/nodeinfo'
20import { join } from 'path' 20import { join } from 'path'
21import { root } from '../helpers/core-utils' 21import { root } from '../helpers/core-utils'
22import { CONFIG } from '../initializers/config' 22import { CONFIG, isEmailEnabled } from '../initializers/config'
23import { Emailer } from '../lib/emailer'
24import { getPreview, getVideoCaption } from './lazy-static' 23import { getPreview, getVideoCaption } from './lazy-static'
25import { VideoStreamingPlaylistType } from '@shared/models/videos/video-streaming-playlist.type' 24import { VideoStreamingPlaylistType } from '@shared/models/videos/video-streaming-playlist.type'
26import { MVideoFile, MVideoFullLight } from '@server/typings/models' 25import { 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