aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api')
-rw-r--r--server/controllers/api/server/follows.ts8
-rw-r--r--server/controllers/api/videos/index.ts11
2 files changed, 10 insertions, 9 deletions
diff --git a/server/controllers/api/server/follows.ts b/server/controllers/api/server/follows.ts
index ac8ea87f9..e00787f02 100644
--- a/server/controllers/api/server/follows.ts
+++ b/server/controllers/api/server/follows.ts
@@ -2,7 +2,7 @@ import * as express from 'express'
2import { UserRight } from '../../../../shared/models/users/user-right.enum' 2import { UserRight } from '../../../../shared/models/users/user-right.enum'
3import { getFormattedObjects } from '../../../helpers' 3import { getFormattedObjects } from '../../../helpers'
4import { logger } from '../../../helpers/logger' 4import { logger } from '../../../helpers/logger'
5import { getApplicationAccount } from '../../../helpers/utils' 5import { getServerAccount } from '../../../helpers/utils'
6import { getAccountFromWebfinger } from '../../../helpers/webfinger' 6import { getAccountFromWebfinger } from '../../../helpers/webfinger'
7import { SERVER_ACCOUNT_NAME } from '../../../initializers/constants' 7import { SERVER_ACCOUNT_NAME } from '../../../initializers/constants'
8import { database as db } from '../../../initializers/database' 8import { database as db } from '../../../initializers/database'
@@ -50,14 +50,14 @@ export {
50// --------------------------------------------------------------------------- 50// ---------------------------------------------------------------------------
51 51
52async function listFollowing (req: express.Request, res: express.Response, next: express.NextFunction) { 52async function listFollowing (req: express.Request, res: express.Response, next: express.NextFunction) {
53 const applicationAccount = await getApplicationAccount() 53 const applicationAccount = await getServerAccount()
54 const resultList = await db.AccountFollow.listFollowingForApi(applicationAccount.id, req.query.start, req.query.count, req.query.sort) 54 const resultList = await db.AccountFollow.listFollowingForApi(applicationAccount.id, req.query.start, req.query.count, req.query.sort)
55 55
56 return res.json(getFormattedObjects(resultList.data, resultList.total)) 56 return res.json(getFormattedObjects(resultList.data, resultList.total))
57} 57}
58 58
59async function listFollowers (req: express.Request, res: express.Response, next: express.NextFunction) { 59async function listFollowers (req: express.Request, res: express.Response, next: express.NextFunction) {
60 const applicationAccount = await getApplicationAccount() 60 const applicationAccount = await getServerAccount()
61 const resultList = await db.AccountFollow.listFollowersForApi(applicationAccount.id, req.query.start, req.query.count, req.query.sort) 61 const resultList = await db.AccountFollow.listFollowersForApi(applicationAccount.id, req.query.start, req.query.count, req.query.sort)
62 62
63 return res.json(getFormattedObjects(resultList.data, resultList.total)) 63 return res.json(getFormattedObjects(resultList.data, resultList.total))
@@ -65,7 +65,7 @@ async function listFollowers (req: express.Request, res: express.Response, next:
65 65
66async function follow (req: express.Request, res: express.Response, next: express.NextFunction) { 66async function follow (req: express.Request, res: express.Response, next: express.NextFunction) {
67 const hosts = req.body.hosts as string[] 67 const hosts = req.body.hosts as string[]
68 const fromAccount = await getApplicationAccount() 68 const fromAccount = await getServerAccount()
69 69
70 const tasks: Promise<any>[] = [] 70 const tasks: Promise<any>[] = []
71 const accountName = SERVER_ACCOUNT_NAME 71 const accountName = SERVER_ACCOUNT_NAME
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts
index ebc07e179..a5414cc50 100644
--- a/server/controllers/api/videos/index.ts
+++ b/server/controllers/api/videos/index.ts
@@ -12,10 +12,10 @@ import {
12 resetSequelizeInstance, 12 resetSequelizeInstance,
13 retryTransactionWrapper 13 retryTransactionWrapper
14} from '../../../helpers' 14} from '../../../helpers'
15import { getActivityPubUrl } from '../../../helpers/activitypub' 15import { getActivityPubUrl, shareVideoByServer } from '../../../helpers/activitypub'
16import { CONFIG, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_MIMETYPE_EXT, VIDEO_PRIVACIES } from '../../../initializers' 16import { CONFIG, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_MIMETYPE_EXT, VIDEO_PRIVACIES } from '../../../initializers'
17import { database as db } from '../../../initializers/database' 17import { database as db } from '../../../initializers/database'
18import { sendAddVideo, sendUpdateVideoChannel } from '../../../lib/activitypub/send-request' 18import { sendAddVideo, sendUpdateVideo } from '../../../lib/activitypub/send-request'
19import { transcodingJobScheduler } from '../../../lib/jobs/transcoding-job-scheduler/transcoding-job-scheduler' 19import { transcodingJobScheduler } from '../../../lib/jobs/transcoding-job-scheduler/transcoding-job-scheduler'
20import { 20import {
21 asyncMiddleware, 21 asyncMiddleware,
@@ -56,7 +56,7 @@ const storage = multer.diskStorage({
56 randomString = 'fake-random-string' 56 randomString = 'fake-random-string'
57 } 57 }
58 58
59 cb(null, randomString + '.' + extension) 59 cb(null, randomString + extension)
60 } 60 }
61}) 61})
62 62
@@ -237,6 +237,7 @@ async function addVideo (req: express.Request, res: express.Response, videoPhysi
237 if (video.privacy === VideoPrivacy.PRIVATE) return undefined 237 if (video.privacy === VideoPrivacy.PRIVATE) return undefined
238 238
239 await sendAddVideo(video, t) 239 await sendAddVideo(video, t)
240 await shareVideoByServer(video, t)
240 }) 241 })
241 242
242 logger.info('Video with name %s and uuid %s created.', videoInfo.name, videoUUID) 243 logger.info('Video with name %s and uuid %s created.', videoInfo.name, videoUUID)
@@ -254,7 +255,7 @@ async function updateVideoRetryWrapper (req: express.Request, res: express.Respo
254} 255}
255 256
256async function updateVideo (req: express.Request, res: express.Response) { 257async function updateVideo (req: express.Request, res: express.Response) {
257 const videoInstance = res.locals.video 258 const videoInstance: VideoInstance = res.locals.video
258 const videoFieldsSave = videoInstance.toJSON() 259 const videoFieldsSave = videoInstance.toJSON()
259 const videoInfoToUpdate: VideoUpdate = req.body 260 const videoInfoToUpdate: VideoUpdate = req.body
260 const wasPrivateVideo = videoInstance.privacy === VideoPrivacy.PRIVATE 261 const wasPrivateVideo = videoInstance.privacy === VideoPrivacy.PRIVATE
@@ -284,7 +285,7 @@ async function updateVideo (req: express.Request, res: express.Response) {
284 285
285 // Now we'll update the video's meta data to our friends 286 // Now we'll update the video's meta data to our friends
286 if (wasPrivateVideo === false) { 287 if (wasPrivateVideo === false) {
287 await sendUpdateVideoChannel(videoInstance, t) 288 await sendUpdateVideo(videoInstance, t)
288 } 289 }
289 290
290 // Video is not private anymore, send a create action to remote servers 291 // Video is not private anymore, send a create action to remote servers