aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--client/src/app/+video-channels/video-channels.component.scss8
-rw-r--r--client/src/app/header/search-typeahead.component.ts22
-rw-r--r--client/src/sass/include/_variables.scss4
-rw-r--r--server/controllers/api/config.ts5
-rw-r--r--server/controllers/static.ts11
-rw-r--r--server/helpers/custom-validators/users.ts7
-rw-r--r--server/initializers/checker-after-init.ts5
-rw-r--r--server/initializers/config.ts7
-rw-r--r--server/lib/emailer.ts6
-rw-r--r--server/middlewares/validators/config.ts4
-rw-r--r--server/middlewares/validators/server.ts5
11 files changed, 37 insertions, 47 deletions
diff --git a/client/src/app/+video-channels/video-channels.component.scss b/client/src/app/+video-channels/video-channels.component.scss
index aa26a7e7b..6470629f8 100644
--- a/client/src/app/+video-channels/video-channels.component.scss
+++ b/client/src/app/+video-channels/video-channels.component.scss
@@ -12,12 +12,10 @@
12 display: grid !important; 12 display: grid !important;
13 grid-template-columns: 1fr auto; 13 grid-template-columns: 1fr auto;
14 grid-template-rows: 1fr auto / 1fr auto; 14 grid-template-rows: 1fr auto / 1fr auto;
15 grid-template-areas: "name buttons" 15 grid-template-areas: "name buttons" "lower buttons";
16 "lower buttons";
17 16
18 @media screen and (max-width: #{map-get($grid-breakpoints, lg)}) { 17 @media screen and (max-width: #{map-get($grid-breakpoints, lg)}) {
19 grid-template-areas: "name name" 18 grid-template-areas: "name name" "lower buttons";
20 "lower buttons";
21 } 19 }
22 } 20 }
23 21
@@ -53,4 +51,4 @@
53 my-subscribe-button { 51 my-subscribe-button {
54 height: min-content; 52 height: min-content;
55 } 53 }
56} \ No newline at end of file 54}
diff --git a/client/src/app/header/search-typeahead.component.ts b/client/src/app/header/search-typeahead.component.ts
index 210a1474c..372601fa8 100644
--- a/client/src/app/header/search-typeahead.component.ts
+++ b/client/src/app/header/search-typeahead.component.ts
@@ -1,17 +1,9 @@
1import { 1import { Component, ElementRef, OnDestroy, OnInit, QueryList, ViewChild } from '@angular/core'
2 Component, 2import { ActivatedRoute, Params, Router } from '@angular/router'
3 OnInit,
4 OnDestroy,
5 QueryList,
6 ViewChild,
7 ElementRef
8} from '@angular/core'
9import { Router, Params, ActivatedRoute } from '@angular/router'
10import { AuthService, ServerService } from '@app/core' 3import { AuthService, ServerService } from '@app/core'
11import { first, tap } from 'rxjs/operators' 4import { first, tap } from 'rxjs/operators'
12import { ListKeyManager } from '@angular/cdk/a11y' 5import { ListKeyManager } from '@angular/cdk/a11y'
13import { UP_ARROW, DOWN_ARROW, ENTER } from '@angular/cdk/keycodes' 6import { Result, SuggestionComponent } from './suggestion.component'
14import { SuggestionComponent, Result } from './suggestion.component'
15import { of } from 'rxjs' 7import { of } from 'rxjs'
16import { ServerConfig } from '@shared/models' 8import { ServerConfig } from '@shared/models'
17 9
@@ -145,13 +137,13 @@ export class SearchTypeaheadComponent implements OnInit, OnDestroy {
145 handleKeyUp (event: KeyboardEvent) { 137 handleKeyUp (event: KeyboardEvent) {
146 event.stopImmediatePropagation() 138 event.stopImmediatePropagation()
147 if (!this.keyboardEventsManager) return 139 if (!this.keyboardEventsManager) return
148 140
149 switch (event.key) { 141 switch (event.key) {
150 case "ArrowDown": 142 case 'ArrowDown':
151 case "ArrowUp": 143 case 'ArrowUp':
152 this.keyboardEventsManager.onKeydown(event) 144 this.keyboardEventsManager.onKeydown(event)
153 break 145 break
154 case "Enter": 146 case 'Enter':
155 this.newSearch = false 147 this.newSearch = false
156 this.doSearch() 148 this.doSearch()
157 break 149 break
diff --git a/client/src/sass/include/_variables.scss b/client/src/sass/include/_variables.scss
index d8db3f3f8..3fb8bb625 100644
--- a/client/src/sass/include/_variables.scss
+++ b/client/src/sass/include/_variables.scss
@@ -103,8 +103,8 @@ $variables: (
103 103
104$zindex: ( 104$zindex: (
105 header : 1000, 105 header : 1000,
106 /* header context */ 106 /* header context */
107 headerLeft : 10, 107 headerLeft : 10,
108 menu : 11000, 108 menu : 11000,
109 dropdown : 12000, 109 dropdown : 12000,
110 loadbar : 13000, 110 loadbar : 13000,
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
diff --git a/server/helpers/custom-validators/users.ts b/server/helpers/custom-validators/users.ts
index 63673bee2..1ddbe0815 100644
--- a/server/helpers/custom-validators/users.ts
+++ b/server/helpers/custom-validators/users.ts
@@ -3,7 +3,7 @@ import { UserRole } from '../../../shared'
3import { CONSTRAINTS_FIELDS, NSFW_POLICY_TYPES } from '../../initializers/constants' 3import { CONSTRAINTS_FIELDS, NSFW_POLICY_TYPES } from '../../initializers/constants'
4import { exists, isArray, isBooleanValid, isFileValid } from './misc' 4import { exists, isArray, isBooleanValid, isFileValid } from './misc'
5import { values } from 'lodash' 5import { values } from 'lodash'
6import { CONFIG } from '../../initializers/config' 6import { isEmailEnabled } from '../../initializers/config'
7 7
8const USERS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.USERS 8const USERS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.USERS
9 9
@@ -13,9 +13,8 @@ function isUserPasswordValid (value: string) {
13 13
14function isUserPasswordValidOrEmpty (value: string) { 14function isUserPasswordValidOrEmpty (value: string) {
15 // Empty password is only possible if emailing is enabled. 15 // Empty password is only possible if emailing is enabled.
16 if (value === '') { 16 if (value === '') return isEmailEnabled()
17 return !!CONFIG.SMTP.HOSTNAME && !!CONFIG.SMTP.PORT 17
18 }
19 return isUserPasswordValid(value) 18 return isUserPasswordValid(value)
20} 19}
21 20
diff --git a/server/initializers/checker-after-init.ts b/server/initializers/checker-after-init.ts
index 978023129..e01609eef 100644
--- a/server/initializers/checker-after-init.ts
+++ b/server/initializers/checker-after-init.ts
@@ -4,13 +4,12 @@ import { UserModel } from '../models/account/user'
4import { ApplicationModel } from '../models/application/application' 4import { ApplicationModel } from '../models/application/application'
5import { OAuthClientModel } from '../models/oauth/oauth-client' 5import { OAuthClientModel } from '../models/oauth/oauth-client'
6import { URL } from 'url' 6import { URL } from 'url'
7import { CONFIG } from './config' 7import { CONFIG, isEmailEnabled } from './config'
8import { logger } from '../helpers/logger' 8import { logger } from '../helpers/logger'
9import { getServerActor } from '../helpers/utils' 9import { getServerActor } from '../helpers/utils'
10import { RecentlyAddedStrategy } from '../../shared/models/redundancy' 10import { RecentlyAddedStrategy } from '../../shared/models/redundancy'
11import { isArray } from '../helpers/custom-validators/misc' 11import { isArray } from '../helpers/custom-validators/misc'
12import { uniq } from 'lodash' 12import { uniq } from 'lodash'
13import { Emailer } from '../lib/emailer'
14import { WEBSERVER } from './constants' 13import { WEBSERVER } from './constants'
15 14
16async function checkActivityPubUrls () { 15async function checkActivityPubUrls () {
@@ -41,7 +40,7 @@ function checkConfig () {
41 } 40 }
42 41
43 // Email verification 42 // Email verification
44 if (!Emailer.isEnabled()) { 43 if (!isEmailEnabled()) {
45 if (CONFIG.SIGNUP.ENABLED && CONFIG.SIGNUP.REQUIRES_EMAIL_VERIFICATION) { 44 if (CONFIG.SIGNUP.ENABLED && CONFIG.SIGNUP.REQUIRES_EMAIL_VERIFICATION) {
46 return 'Emailer is disabled but you require signup email verification.' 45 return 'Emailer is disabled but you require signup email verification.'
47 } 46 }
diff --git a/server/initializers/config.ts b/server/initializers/config.ts
index 75372fa4e..950ca61bd 100644
--- a/server/initializers/config.ts
+++ b/server/initializers/config.ts
@@ -284,11 +284,16 @@ function registerConfigChangedHandler (fun: Function) {
284 configChangedHandlers.push(fun) 284 configChangedHandlers.push(fun)
285} 285}
286 286
287function isEmailEnabled () {
288 return !!CONFIG.SMTP.HOSTNAME && !!CONFIG.SMTP.PORT
289}
290
287// --------------------------------------------------------------------------- 291// ---------------------------------------------------------------------------
288 292
289export { 293export {
290 CONFIG, 294 CONFIG,
291 registerConfigChangedHandler 295 registerConfigChangedHandler,
296 isEmailEnabled
292} 297}
293 298
294// --------------------------------------------------------------------------- 299// ---------------------------------------------------------------------------
diff --git a/server/lib/emailer.ts b/server/lib/emailer.ts
index 0f74d2a8c..d0874ab20 100644
--- a/server/lib/emailer.ts
+++ b/server/lib/emailer.ts
@@ -1,7 +1,7 @@
1import { createTransport, Transporter } from 'nodemailer' 1import { createTransport, Transporter } from 'nodemailer'
2import { isTestInstance } from '../helpers/core-utils' 2import { isTestInstance } from '../helpers/core-utils'
3import { bunyanLogger, logger } from '../helpers/logger' 3import { bunyanLogger, logger } from '../helpers/logger'
4import { CONFIG } from '../initializers/config' 4import { CONFIG, isEmailEnabled } from '../initializers/config'
5import { JobQueue } from './job-queue' 5import { JobQueue } from './job-queue'
6import { EmailPayload } from './job-queue/handlers/email' 6import { EmailPayload } from './job-queue/handlers/email'
7import { readFileSync } from 'fs-extra' 7import { readFileSync } from 'fs-extra'
@@ -40,7 +40,7 @@ class Emailer {
40 if (this.initialized === true) return 40 if (this.initialized === true) return
41 this.initialized = true 41 this.initialized = true
42 42
43 if (Emailer.isEnabled()) { 43 if (isEmailEnabled) {
44 logger.info('Using %s:%s as SMTP server.', CONFIG.SMTP.HOSTNAME, CONFIG.SMTP.PORT) 44 logger.info('Using %s:%s as SMTP server.', CONFIG.SMTP.HOSTNAME, CONFIG.SMTP.PORT)
45 45
46 let tls 46 let tls
@@ -459,7 +459,7 @@ class Emailer {
459 } 459 }
460 460
461 async sendMail (options: EmailPayload) { 461 async sendMail (options: EmailPayload) {
462 if (!Emailer.isEnabled()) { 462 if (!isEmailEnabled()) {
463 throw new Error('Cannot send mail because SMTP is not configured.') 463 throw new Error('Cannot send mail because SMTP is not configured.')
464 } 464 }
465 465
diff --git a/server/middlewares/validators/config.ts b/server/middlewares/validators/config.ts
index ceab646c0..dfa549e76 100644
--- a/server/middlewares/validators/config.ts
+++ b/server/middlewares/validators/config.ts
@@ -3,10 +3,10 @@ import { body } from 'express-validator'
3import { isUserNSFWPolicyValid, isUserVideoQuotaDailyValid, isUserVideoQuotaValid } from '../../helpers/custom-validators/users' 3import { isUserNSFWPolicyValid, isUserVideoQuotaDailyValid, isUserVideoQuotaValid } from '../../helpers/custom-validators/users'
4import { logger } from '../../helpers/logger' 4import { logger } from '../../helpers/logger'
5import { CustomConfig } from '../../../shared/models/server/custom-config.model' 5import { CustomConfig } from '../../../shared/models/server/custom-config.model'
6import { Emailer } from '../../lib/emailer'
7import { areValidationErrors } from './utils' 6import { areValidationErrors } from './utils'
8import { isThemeNameValid } from '../../helpers/custom-validators/plugins' 7import { isThemeNameValid } from '../../helpers/custom-validators/plugins'
9import { isThemeRegistered } from '../../lib/plugins/theme-utils' 8import { isThemeRegistered } from '../../lib/plugins/theme-utils'
9import { isEmailEnabled } from '@server/initializers/config'
10 10
11const customConfigUpdateValidator = [ 11const customConfigUpdateValidator = [
12 body('instance.name').exists().withMessage('Should have a valid instance name'), 12 body('instance.name').exists().withMessage('Should have a valid instance name'),
@@ -73,7 +73,7 @@ export {
73} 73}
74 74
75function checkInvalidConfigIfEmailDisabled (customConfig: CustomConfig, res: express.Response) { 75function checkInvalidConfigIfEmailDisabled (customConfig: CustomConfig, res: express.Response) {
76 if (Emailer.isEnabled()) return true 76 if (isEmailEnabled()) return true
77 77
78 if (customConfig.signup.requiresEmailVerification === true) { 78 if (customConfig.signup.requiresEmailVerification === true) {
79 res.status(400) 79 res.status(400)
diff --git a/server/middlewares/validators/server.ts b/server/middlewares/validators/server.ts
index f6812647b..6158c3363 100644
--- a/server/middlewares/validators/server.ts
+++ b/server/middlewares/validators/server.ts
@@ -5,9 +5,8 @@ import { isHostValid, isValidContactBody } from '../../helpers/custom-validators
5import { ServerModel } from '../../models/server/server' 5import { ServerModel } from '../../models/server/server'
6import { body } from 'express-validator' 6import { body } from 'express-validator'
7import { isUserDisplayNameValid } from '../../helpers/custom-validators/users' 7import { isUserDisplayNameValid } from '../../helpers/custom-validators/users'
8import { Emailer } from '../../lib/emailer'
9import { Redis } from '../../lib/redis' 8import { Redis } from '../../lib/redis'
10import { CONFIG } from '../../initializers/config' 9import { CONFIG, isEmailEnabled } from '../../initializers/config'
11 10
12const serverGetValidator = [ 11const serverGetValidator = [
13 body('host').custom(isHostValid).withMessage('Should have a valid host'), 12 body('host').custom(isHostValid).withMessage('Should have a valid host'),
@@ -50,7 +49,7 @@ const contactAdministratorValidator = [
50 .end() 49 .end()
51 } 50 }
52 51
53 if (Emailer.isEnabled() === false) { 52 if (isEmailEnabled() === false) {
54 return res 53 return res
55 .status(409) 54 .status(409)
56 .send({ error: 'Emailer is not enabled on this instance.' }) 55 .send({ error: 'Emailer is not enabled on this instance.' })