aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/users
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-04-11 11:33:44 +0200
committerChocobozzz <me@florianbigard.com>2019-04-11 13:45:39 +0200
commit6dd9de95dfa39bd5c1faed00d1dbd52cd112bae0 (patch)
treeb47de7efb8c6c611c63a15a971c6125a278f547a /server/controllers/api/users
parent2c3abc4fa796555eb7d25f416c4f41ab3e3ad8ca (diff)
downloadPeerTube-6dd9de95dfa39bd5c1faed00d1dbd52cd112bae0.tar.gz
PeerTube-6dd9de95dfa39bd5c1faed00d1dbd52cd112bae0.tar.zst
PeerTube-6dd9de95dfa39bd5c1faed00d1dbd52cd112bae0.zip
Move config in its own file
Diffstat (limited to 'server/controllers/api/users')
-rw-r--r--server/controllers/api/users/index.ts7
-rw-r--r--server/controllers/api/users/me.ts3
-rw-r--r--server/controllers/api/users/my-subscriptions.ts4
3 files changed, 8 insertions, 6 deletions
diff --git a/server/controllers/api/users/index.ts b/server/controllers/api/users/index.ts
index 2117bdfeb..a049e23e4 100644
--- a/server/controllers/api/users/index.ts
+++ b/server/controllers/api/users/index.ts
@@ -3,7 +3,7 @@ import * as RateLimit from 'express-rate-limit'
3import { UserCreate, UserRight, UserRole, UserUpdate } from '../../../../shared' 3import { UserCreate, UserRight, UserRole, UserUpdate } from '../../../../shared'
4import { logger } from '../../../helpers/logger' 4import { logger } from '../../../helpers/logger'
5import { getFormattedObjects } from '../../../helpers/utils' 5import { getFormattedObjects } from '../../../helpers/utils'
6import { CONFIG, RATES_LIMIT, sequelizeTypescript } from '../../../initializers' 6import { RATES_LIMIT, sequelizeTypescript, WEBSERVER } from '../../../initializers'
7import { Emailer } from '../../../lib/emailer' 7import { Emailer } from '../../../lib/emailer'
8import { Redis } from '../../../lib/redis' 8import { Redis } from '../../../lib/redis'
9import { createUserAccountAndChannelAndPlaylist } from '../../../lib/user' 9import { createUserAccountAndChannelAndPlaylist } from '../../../lib/user'
@@ -43,6 +43,7 @@ import { myVideosHistoryRouter } from './my-history'
43import { myNotificationsRouter } from './my-notifications' 43import { myNotificationsRouter } from './my-notifications'
44import { Notifier } from '../../../lib/notifier' 44import { Notifier } from '../../../lib/notifier'
45import { mySubscriptionsRouter } from './my-subscriptions' 45import { mySubscriptionsRouter } from './my-subscriptions'
46import { CONFIG } from '../../../initializers/config'
46 47
47const auditLogger = auditLoggerFactory('users') 48const auditLogger = auditLoggerFactory('users')
48 49
@@ -293,7 +294,7 @@ async function askResetUserPassword (req: express.Request, res: express.Response
293 const user = res.locals.user 294 const user = res.locals.user
294 295
295 const verificationString = await Redis.Instance.setResetPasswordVerificationString(user.id) 296 const verificationString = await Redis.Instance.setResetPasswordVerificationString(user.id)
296 const url = CONFIG.WEBSERVER.URL + '/reset-password?userId=' + user.id + '&verificationString=' + verificationString 297 const url = WEBSERVER.URL + '/reset-password?userId=' + user.id + '&verificationString=' + verificationString
297 await Emailer.Instance.addPasswordResetEmailJob(user.email, url) 298 await Emailer.Instance.addPasswordResetEmailJob(user.email, url)
298 299
299 return res.status(204).end() 300 return res.status(204).end()
@@ -310,7 +311,7 @@ async function resetUserPassword (req: express.Request, res: express.Response) {
310 311
311async function sendVerifyUserEmail (user: UserModel) { 312async function sendVerifyUserEmail (user: UserModel) {
312 const verificationString = await Redis.Instance.setVerifyEmailVerificationString(user.id) 313 const verificationString = await Redis.Instance.setVerifyEmailVerificationString(user.id)
313 const url = CONFIG.WEBSERVER.URL + '/verify-account/email?userId=' + user.id + '&verificationString=' + verificationString 314 const url = WEBSERVER.URL + '/verify-account/email?userId=' + user.id + '&verificationString=' + verificationString
314 await Emailer.Instance.addVerifyEmailJob(user.email, url) 315 await Emailer.Instance.addVerifyEmailJob(user.email, url)
315 return 316 return
316} 317}
diff --git a/server/controllers/api/users/me.ts b/server/controllers/api/users/me.ts
index 3533499be..1d1588eca 100644
--- a/server/controllers/api/users/me.ts
+++ b/server/controllers/api/users/me.ts
@@ -2,7 +2,7 @@ import * as express from 'express'
2import 'multer' 2import 'multer'
3import { UserUpdateMe, UserVideoRate as FormattedUserVideoRate } from '../../../../shared' 3import { UserUpdateMe, UserVideoRate as FormattedUserVideoRate } from '../../../../shared'
4import { getFormattedObjects } from '../../../helpers/utils' 4import { getFormattedObjects } from '../../../helpers/utils'
5import { CONFIG, MIMETYPES, sequelizeTypescript } from '../../../initializers' 5import { MIMETYPES, sequelizeTypescript } from '../../../initializers'
6import { sendUpdateActor } from '../../../lib/activitypub/send' 6import { sendUpdateActor } from '../../../lib/activitypub/send'
7import { 7import {
8 asyncMiddleware, 8 asyncMiddleware,
@@ -26,6 +26,7 @@ import { updateActorAvatarFile } from '../../../lib/avatar'
26import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '../../../helpers/audit-logger' 26import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '../../../helpers/audit-logger'
27import { VideoImportModel } from '../../../models/video/video-import' 27import { VideoImportModel } from '../../../models/video/video-import'
28import { AccountModel } from '../../../models/account/account' 28import { AccountModel } from '../../../models/account/account'
29import { CONFIG } from '../../../initializers/config'
29 30
30const auditLogger = auditLoggerFactory('users-me') 31const auditLogger = auditLoggerFactory('users-me')
31 32
diff --git a/server/controllers/api/users/my-subscriptions.ts b/server/controllers/api/users/my-subscriptions.ts
index a173adfd0..59b906a8b 100644
--- a/server/controllers/api/users/my-subscriptions.ts
+++ b/server/controllers/api/users/my-subscriptions.ts
@@ -1,7 +1,7 @@
1import * as express from 'express' 1import * as express from 'express'
2import 'multer' 2import 'multer'
3import { getFormattedObjects } from '../../../helpers/utils' 3import { getFormattedObjects } from '../../../helpers/utils'
4import { CONFIG, sequelizeTypescript } from '../../../initializers' 4import { sequelizeTypescript, WEBSERVER } from '../../../initializers'
5import { 5import {
6 asyncMiddleware, 6 asyncMiddleware,
7 asyncRetryTransactionMiddleware, 7 asyncRetryTransactionMiddleware,
@@ -80,7 +80,7 @@ async function areSubscriptionsExist (req: express.Request, res: express.Respons
80 80
81 const handles = uris.map(u => { 81 const handles = uris.map(u => {
82 let [ name, host ] = u.split('@') 82 let [ name, host ] = u.split('@')
83 if (host === CONFIG.WEBSERVER.HOST) host = null 83 if (host === WEBSERVER.HOST) host = null
84 84
85 return { name, host, uri: u } 85 return { name, host, uri: u }
86 }) 86 })