diff options
author | Chocobozzz <me@florianbigard.com> | 2021-02-26 14:22:25 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-02-26 14:22:25 +0100 |
commit | 8795d6f254bd8f88c385bf77b82cc6f177c94df9 (patch) | |
tree | 88f8f4fced9e0c12db5b43dcac6e44bd94eb8b1a /server/controllers | |
parent | 92315d979c3f424d81f8fca3c8831d81e4e2a6d6 (diff) | |
download | PeerTube-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')
-rw-r--r-- | server/controllers/api/users/index.ts | 2 | ||||
-rw-r--r-- | server/controllers/api/video-channel.ts | 7 |
2 files changed, 4 insertions, 5 deletions
diff --git a/server/controllers/api/users/index.ts b/server/controllers/api/users/index.ts index fa0688a9e..3be1d55ae 100644 --- a/server/controllers/api/users/index.ts +++ b/server/controllers/api/users/index.ts | |||
@@ -221,7 +221,7 @@ async function createUser (req: express.Request, res: express.Response) { | |||
221 | id: account.id | 221 | id: account.id |
222 | } | 222 | } |
223 | } | 223 | } |
224 | }).end() | 224 | }) |
225 | } | 225 | } |
226 | 226 | ||
227 | async function registerUser (req: express.Request, res: express.Response) { | 227 | async function registerUser (req: express.Request, res: express.Response) { |
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' | |||
3 | import { getServerActor } from '@server/models/application/application' | 3 | import { getServerActor } from '@server/models/application/application' |
4 | import { MChannelAccountDefault } from '@server/types/models' | 4 | import { MChannelAccountDefault } from '@server/types/models' |
5 | import { VideoChannelCreate, VideoChannelUpdate } from '../../../shared' | 5 | import { VideoChannelCreate, VideoChannelUpdate } from '../../../shared' |
6 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
6 | import { auditLoggerFactory, getAuditIdFromRes, VideoChannelAuditView } from '../../helpers/audit-logger' | 7 | import { auditLoggerFactory, getAuditIdFromRes, VideoChannelAuditView } from '../../helpers/audit-logger' |
7 | import { resetSequelizeInstance } from '../../helpers/database-utils' | 8 | import { resetSequelizeInstance } from '../../helpers/database-utils' |
8 | import { buildNSFWFilter, createReqFiles, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' | 9 | import { buildNSFWFilter, createReqFiles, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' |
@@ -11,7 +12,6 @@ import { getFormattedObjects } from '../../helpers/utils' | |||
11 | import { CONFIG } from '../../initializers/config' | 12 | import { CONFIG } from '../../initializers/config' |
12 | import { MIMETYPES } from '../../initializers/constants' | 13 | import { MIMETYPES } from '../../initializers/constants' |
13 | import { sequelizeTypescript } from '../../initializers/database' | 14 | import { sequelizeTypescript } from '../../initializers/database' |
14 | import { setAsyncActorKeys } from '../../lib/activitypub/actor' | ||
15 | import { sendUpdateActor } from '../../lib/activitypub/send' | 15 | import { sendUpdateActor } from '../../lib/activitypub/send' |
16 | import { deleteLocalActorAvatarFile, updateLocalActorAvatarFile } from '../../lib/avatar' | 16 | import { deleteLocalActorAvatarFile, updateLocalActorAvatarFile } from '../../lib/avatar' |
17 | import { JobQueue } from '../../lib/job-queue' | 17 | import { JobQueue } from '../../lib/job-queue' |
@@ -39,7 +39,6 @@ import { AccountModel } from '../../models/account/account' | |||
39 | import { VideoModel } from '../../models/video/video' | 39 | import { VideoModel } from '../../models/video/video' |
40 | import { VideoChannelModel } from '../../models/video/video-channel' | 40 | import { VideoChannelModel } from '../../models/video/video-channel' |
41 | import { VideoPlaylistModel } from '../../models/video/video-playlist' | 41 | import { VideoPlaylistModel } from '../../models/video/video-playlist' |
42 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
43 | 42 | ||
44 | const auditLogger = auditLoggerFactory('channels') | 43 | const auditLogger = auditLoggerFactory('channels') |
45 | const reqAvatarFile = createReqFiles([ 'avatarfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { avatarfile: CONFIG.STORAGE.TMP_DIR }) | 44 | const 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) |