diff options
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/activitypub/inbox.ts | 2 | ||||
-rw-r--r-- | server/controllers/activitypub/outbox.ts | 2 | ||||
-rw-r--r-- | server/controllers/api/users.ts | 11 |
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 | ||
19 | inboxRouter.post('/account/:name/inbox', | 19 | inboxRouter.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 | ||
12 | const outboxRouter = express.Router() | 12 | const outboxRouter = express.Router() |
13 | 13 | ||
14 | outboxRouter.get('/account/:name/outbox', | 14 | outboxRouter.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 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { extname, join } from 'path' | 2 | import { extname, join } from 'path' |
3 | import * as sharp from 'sharp' | ||
3 | import * as uuidv4 from 'uuid/v4' | 4 | import * as uuidv4 from 'uuid/v4' |
4 | import { UserCreate, UserRight, UserRole, UserUpdate, UserUpdateMe, UserVideoRate as FormattedUserVideoRate } from '../../../shared' | 5 | import { UserCreate, UserRight, UserRole, UserUpdate, UserUpdateMe, UserVideoRate as FormattedUserVideoRate } from '../../../shared' |
5 | import { renamePromise } from '../../helpers/core-utils' | 6 | import { renamePromise, unlinkPromise } from '../../helpers/core-utils' |
6 | import { retryTransactionWrapper } from '../../helpers/database-utils' | 7 | import { retryTransactionWrapper } from '../../helpers/database-utils' |
7 | import { logger } from '../../helpers/logger' | 8 | import { logger } from '../../helpers/logger' |
8 | import { createReqFiles, getFormattedObjects } from '../../helpers/utils' | 9 | import { createReqFiles, getFormattedObjects } from '../../helpers/utils' |
9 | import { AVATAR_MIMETYPE_EXT, CONFIG, sequelizeTypescript } from '../../initializers' | 10 | import { AVATAR_MIMETYPE_EXT, AVATARS_SIZE, CONFIG, sequelizeTypescript } from '../../initializers' |
10 | import { createUserAccountAndChannel } from '../../lib/user' | 11 | import { createUserAccountAndChannel } from '../../lib/user' |
11 | import { | 12 | import { |
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({ |