From 7e98a7df7d04e19ba67163a86c7b876d78d76839 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 23 Mar 2022 14:24:50 +0100 Subject: Remove activitypub helper Put functions in lib/activitypub instead --- server/controllers/activitypub/client.ts | 9 +++++---- server/controllers/activitypub/outbox.ts | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'server/controllers') diff --git a/server/controllers/activitypub/client.ts b/server/controllers/activitypub/client.ts index fc27ebbe8..99637dbab 100644 --- a/server/controllers/activitypub/client.ts +++ b/server/controllers/activitypub/client.ts @@ -1,10 +1,11 @@ import cors from 'cors' import express from 'express' +import { activityPubCollectionPagination } from '@server/lib/activitypub/collection' +import { activityPubContextify } from '@server/lib/activitypub/context' import { getServerActor } from '@server/models/application/application' import { MAccountId, MActorId, MChannelId, MVideoId } from '@server/types/models' import { VideoPrivacy, VideoRateType } from '../../../shared/models/videos' import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/video-playlist-privacy.model' -import { activityPubCollectionPagination, activityPubContextify } from '../../helpers/activitypub' import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../../initializers/constants' import { audiencify, getAudience } from '../../lib/activitypub/audience' import { buildAnnounceWithVideoAudience, buildLikeActivity } from '../../lib/activitypub/send' @@ -400,7 +401,7 @@ function videoPlaylistElementController (req: express.Request, res: express.Resp // --------------------------------------------------------------------------- -async function actorFollowing (req: express.Request, actor: MActorId) { +function actorFollowing (req: express.Request, actor: MActorId) { const handler = (start: number, count: number) => { return ActorFollowModel.listAcceptedFollowingUrlsForApi([ actor.id ], undefined, start, count) } @@ -408,7 +409,7 @@ async function actorFollowing (req: express.Request, actor: MActorId) { return activityPubCollectionPagination(WEBSERVER.URL + req.path, handler, req.query.page) } -async function actorFollowers (req: express.Request, actor: MActorId) { +function actorFollowers (req: express.Request, actor: MActorId) { const handler = (start: number, count: number) => { return ActorFollowModel.listAcceptedFollowerUrlsForAP([ actor.id ], undefined, start, count) } @@ -416,7 +417,7 @@ async function actorFollowers (req: express.Request, actor: MActorId) { return activityPubCollectionPagination(WEBSERVER.URL + req.path, handler, req.query.page) } -async function actorPlaylists (req: express.Request, options: { account: MAccountId } | { channel: MChannelId }) { +function actorPlaylists (req: express.Request, options: { account: MAccountId } | { channel: MChannelId }) { const handler = (start: number, count: number) => { return VideoPlaylistModel.listPublicUrlsOfForAP(options, start, count) } diff --git a/server/controllers/activitypub/outbox.ts b/server/controllers/activitypub/outbox.ts index cdef8e969..4e7a3afeb 100644 --- a/server/controllers/activitypub/outbox.ts +++ b/server/controllers/activitypub/outbox.ts @@ -1,8 +1,9 @@ import express from 'express' +import { activityPubCollectionPagination } from '@server/lib/activitypub/collection' +import { activityPubContextify } from '@server/lib/activitypub/context' import { MActorLight } from '@server/types/models' import { Activity } from '../../../shared/models/activitypub/activity' import { VideoPrivacy } from '../../../shared/models/videos' -import { activityPubCollectionPagination, activityPubContextify } from '../../helpers/activitypub' import { logger } from '../../helpers/logger' import { buildAudience } from '../../lib/activitypub/audience' import { buildAnnounceActivity, buildCreateActivity } from '../../lib/activitypub/send' -- cgit v1.2.3