aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/video-channel.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-02-26 14:22:25 +0100
committerChocobozzz <me@florianbigard.com>2021-02-26 14:22:25 +0100
commit8795d6f254bd8f88c385bf77b82cc6f177c94df9 (patch)
tree88f8f4fced9e0c12db5b43dcac6e44bd94eb8b1a /server/controllers/api/video-channel.ts
parent92315d979c3f424d81f8fca3c8831d81e4e2a6d6 (diff)
downloadPeerTube-8795d6f254bd8f88c385bf77b82cc6f177c94df9.tar.gz
PeerTube-8795d6f254bd8f88c385bf77b82cc6f177c94df9.tar.zst
PeerTube-8795d6f254bd8f88c385bf77b82cc6f177c94df9.zip
Fix broken local actors
Some channels can't federate because they don't have public/private keys, maybe because the generation failed for various reasons
Diffstat (limited to 'server/controllers/api/video-channel.ts')
-rw-r--r--server/controllers/api/video-channel.ts7
1 files changed, 3 insertions, 4 deletions
diff --git a/server/controllers/api/video-channel.ts b/server/controllers/api/video-channel.ts
index 14bd64730..03617dc8d 100644
--- a/server/controllers/api/video-channel.ts
+++ b/server/controllers/api/video-channel.ts
@@ -3,6 +3,7 @@ import { Hooks } from '@server/lib/plugins/hooks'
3import { getServerActor } from '@server/models/application/application' 3import { getServerActor } from '@server/models/application/application'
4import { MChannelAccountDefault } from '@server/types/models' 4import { MChannelAccountDefault } from '@server/types/models'
5import { VideoChannelCreate, VideoChannelUpdate } from '../../../shared' 5import { VideoChannelCreate, VideoChannelUpdate } from '../../../shared'
6import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
6import { auditLoggerFactory, getAuditIdFromRes, VideoChannelAuditView } from '../../helpers/audit-logger' 7import { auditLoggerFactory, getAuditIdFromRes, VideoChannelAuditView } from '../../helpers/audit-logger'
7import { resetSequelizeInstance } from '../../helpers/database-utils' 8import { resetSequelizeInstance } from '../../helpers/database-utils'
8import { buildNSFWFilter, createReqFiles, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' 9import { buildNSFWFilter, createReqFiles, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils'
@@ -11,7 +12,6 @@ import { getFormattedObjects } from '../../helpers/utils'
11import { CONFIG } from '../../initializers/config' 12import { CONFIG } from '../../initializers/config'
12import { MIMETYPES } from '../../initializers/constants' 13import { MIMETYPES } from '../../initializers/constants'
13import { sequelizeTypescript } from '../../initializers/database' 14import { sequelizeTypescript } from '../../initializers/database'
14import { setAsyncActorKeys } from '../../lib/activitypub/actor'
15import { sendUpdateActor } from '../../lib/activitypub/send' 15import { sendUpdateActor } from '../../lib/activitypub/send'
16import { deleteLocalActorAvatarFile, updateLocalActorAvatarFile } from '../../lib/avatar' 16import { deleteLocalActorAvatarFile, updateLocalActorAvatarFile } from '../../lib/avatar'
17import { JobQueue } from '../../lib/job-queue' 17import { JobQueue } from '../../lib/job-queue'
@@ -39,7 +39,6 @@ import { AccountModel } from '../../models/account/account'
39import { VideoModel } from '../../models/video/video' 39import { VideoModel } from '../../models/video/video'
40import { VideoChannelModel } from '../../models/video/video-channel' 40import { VideoChannelModel } from '../../models/video/video-channel'
41import { VideoPlaylistModel } from '../../models/video/video-playlist' 41import { VideoPlaylistModel } from '../../models/video/video-playlist'
42import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
43 42
44const auditLogger = auditLoggerFactory('channels') 43const auditLogger = auditLoggerFactory('channels')
45const reqAvatarFile = createReqFiles([ 'avatarfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { avatarfile: CONFIG.STORAGE.TMP_DIR }) 44const reqAvatarFile = createReqFiles([ 'avatarfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { avatarfile: CONFIG.STORAGE.TMP_DIR })
@@ -168,8 +167,8 @@ async function addVideoChannel (req: express.Request, res: express.Response) {
168 return createLocalVideoChannel(videoChannelInfo, account, t) 167 return createLocalVideoChannel(videoChannelInfo, account, t)
169 }) 168 })
170 169
171 setAsyncActorKeys(videoChannelCreated.Actor) 170 const payload = { actorId: videoChannelCreated.actorId }
172 .catch(err => logger.error('Cannot set async actor keys for account %s.', videoChannelCreated.Actor.url, { err })) 171 await JobQueue.Instance.createJobWithPromise({ type: 'actor-keys', payload })
173 172
174 auditLogger.create(getAuditIdFromRes(res), new VideoChannelAuditView(videoChannelCreated.toFormattedJSON())) 173 auditLogger.create(getAuditIdFromRes(res), new VideoChannelAuditView(videoChannelCreated.toFormattedJSON()))
175 logger.info('Video channel %s created.', videoChannelCreated.Actor.url) 174 logger.info('Video channel %s created.', videoChannelCreated.Actor.url)