From 8795d6f254bd8f88c385bf77b82cc6f177c94df9 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 26 Feb 2021 14:22:25 +0100 Subject: 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 --- server/controllers/api/users/index.ts | 2 +- server/controllers/api/video-channel.ts | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'server/controllers/api') 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) { id: account.id } } - }).end() + }) } 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' import { getServerActor } from '@server/models/application/application' import { MChannelAccountDefault } from '@server/types/models' import { VideoChannelCreate, VideoChannelUpdate } from '../../../shared' +import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' import { auditLoggerFactory, getAuditIdFromRes, VideoChannelAuditView } from '../../helpers/audit-logger' import { resetSequelizeInstance } from '../../helpers/database-utils' import { buildNSFWFilter, createReqFiles, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' @@ -11,7 +12,6 @@ import { getFormattedObjects } from '../../helpers/utils' import { CONFIG } from '../../initializers/config' import { MIMETYPES } from '../../initializers/constants' import { sequelizeTypescript } from '../../initializers/database' -import { setAsyncActorKeys } from '../../lib/activitypub/actor' import { sendUpdateActor } from '../../lib/activitypub/send' import { deleteLocalActorAvatarFile, updateLocalActorAvatarFile } from '../../lib/avatar' import { JobQueue } from '../../lib/job-queue' @@ -39,7 +39,6 @@ import { AccountModel } from '../../models/account/account' import { VideoModel } from '../../models/video/video' import { VideoChannelModel } from '../../models/video/video-channel' import { VideoPlaylistModel } from '../../models/video/video-playlist' -import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' const auditLogger = auditLoggerFactory('channels') 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) { return createLocalVideoChannel(videoChannelInfo, account, t) }) - setAsyncActorKeys(videoChannelCreated.Actor) - .catch(err => logger.error('Cannot set async actor keys for account %s.', videoChannelCreated.Actor.url, { err })) + const payload = { actorId: videoChannelCreated.actorId } + await JobQueue.Instance.createJobWithPromise({ type: 'actor-keys', payload }) auditLogger.create(getAuditIdFromRes(res), new VideoChannelAuditView(videoChannelCreated.toFormattedJSON())) logger.info('Video channel %s created.', videoChannelCreated.Actor.url) -- cgit v1.2.3