aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/activitypub/inbox.ts2
-rw-r--r--server/controllers/activitypub/outbox.ts2
-rw-r--r--server/controllers/api/users.ts11
3 files changed, 10 insertions, 5 deletions
diff --git a/server/controllers/activitypub/inbox.ts b/server/controllers/activitypub/inbox.ts
index bfcb7b369..8d65639f8 100644
--- a/server/controllers/activitypub/inbox.ts
+++ b/server/controllers/activitypub/inbox.ts
@@ -16,7 +16,7 @@ inboxRouter.post('/inbox',
16 asyncMiddleware(inboxController) 16 asyncMiddleware(inboxController)
17) 17)
18 18
19inboxRouter.post('/account/:name/inbox', 19inboxRouter.post('/accounts/:name/inbox',
20 signatureValidator, 20 signatureValidator,
21 asyncMiddleware(checkSignature), 21 asyncMiddleware(checkSignature),
22 localAccountValidator, 22 localAccountValidator,
diff --git a/server/controllers/activitypub/outbox.ts b/server/controllers/activitypub/outbox.ts
index 01ba253c6..620f9ee83 100644
--- a/server/controllers/activitypub/outbox.ts
+++ b/server/controllers/activitypub/outbox.ts
@@ -11,7 +11,7 @@ import { VideoModel } from '../../models/video/video'
11 11
12const outboxRouter = express.Router() 12const outboxRouter = express.Router()
13 13
14outboxRouter.get('/account/:name/outbox', 14outboxRouter.get('/accounts/:name/outbox',
15 localAccountValidator, 15 localAccountValidator,
16 asyncMiddleware(outboxController) 16 asyncMiddleware(outboxController)
17) 17)
diff --git a/server/controllers/api/users.ts b/server/controllers/api/users.ts
index 57b98b84a..6c24434f2 100644
--- a/server/controllers/api/users.ts
+++ b/server/controllers/api/users.ts
@@ -1,12 +1,13 @@
1import * as express from 'express' 1import * as express from 'express'
2import { extname, join } from 'path' 2import { extname, join } from 'path'
3import * as sharp from 'sharp'
3import * as uuidv4 from 'uuid/v4' 4import * as uuidv4 from 'uuid/v4'
4import { UserCreate, UserRight, UserRole, UserUpdate, UserUpdateMe, UserVideoRate as FormattedUserVideoRate } from '../../../shared' 5import { UserCreate, UserRight, UserRole, UserUpdate, UserUpdateMe, UserVideoRate as FormattedUserVideoRate } from '../../../shared'
5import { renamePromise } from '../../helpers/core-utils' 6import { renamePromise, unlinkPromise } from '../../helpers/core-utils'
6import { retryTransactionWrapper } from '../../helpers/database-utils' 7import { retryTransactionWrapper } from '../../helpers/database-utils'
7import { logger } from '../../helpers/logger' 8import { logger } from '../../helpers/logger'
8import { createReqFiles, getFormattedObjects } from '../../helpers/utils' 9import { createReqFiles, getFormattedObjects } from '../../helpers/utils'
9import { AVATAR_MIMETYPE_EXT, CONFIG, sequelizeTypescript } from '../../initializers' 10import { AVATAR_MIMETYPE_EXT, AVATARS_SIZE, CONFIG, sequelizeTypescript } from '../../initializers'
10import { createUserAccountAndChannel } from '../../lib/user' 11import { createUserAccountAndChannel } from '../../lib/user'
11import { 12import {
12 asyncMiddleware, authenticate, ensureUserHasRight, ensureUserRegistrationAllowed, paginationValidator, setPagination, setUsersSort, 13 asyncMiddleware, authenticate, ensureUserHasRight, ensureUserRegistrationAllowed, paginationValidator, setPagination, setUsersSort,
@@ -239,7 +240,11 @@ async function updateMyAvatar (req: express.Request, res: express.Response, next
239 const avatarName = uuidv4() + extension 240 const avatarName = uuidv4() + extension
240 const destination = join(avatarDir, avatarName) 241 const destination = join(avatarDir, avatarName)
241 242
242 await renamePromise(source, destination) 243 await sharp(source)
244 .resize(AVATARS_SIZE.width, AVATARS_SIZE.height)
245 .toFile(destination)
246
247 await unlinkPromise(source)
243 248
244 const { avatar } = await sequelizeTypescript.transaction(async t => { 249 const { avatar } = await sequelizeTypescript.transaction(async t => {
245 const avatar = await AvatarModel.create({ 250 const avatar = await AvatarModel.create({