diff options
author | Chocobozzz <me@florianbigard.com> | 2022-03-23 14:24:50 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-03-23 14:24:50 +0100 |
commit | 7e98a7df7d04e19ba67163a86c7b876d78d76839 (patch) | |
tree | 080c9bf63d2b00b43dca94e3c67cdc2a768308fc /server/controllers | |
parent | 5302f77d095c2188859ee463128aa59eec20ea88 (diff) | |
download | PeerTube-7e98a7df7d04e19ba67163a86c7b876d78d76839.tar.gz PeerTube-7e98a7df7d04e19ba67163a86c7b876d78d76839.tar.zst PeerTube-7e98a7df7d04e19ba67163a86c7b876d78d76839.zip |
Remove activitypub helper
Put functions in lib/activitypub instead
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/activitypub/client.ts | 9 | ||||
-rw-r--r-- | server/controllers/activitypub/outbox.ts | 3 |
2 files changed, 7 insertions, 5 deletions
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 @@ | |||
1 | import cors from 'cors' | 1 | import cors from 'cors' |
2 | import express from 'express' | 2 | import express from 'express' |
3 | import { activityPubCollectionPagination } from '@server/lib/activitypub/collection' | ||
4 | import { activityPubContextify } from '@server/lib/activitypub/context' | ||
3 | import { getServerActor } from '@server/models/application/application' | 5 | import { getServerActor } from '@server/models/application/application' |
4 | import { MAccountId, MActorId, MChannelId, MVideoId } from '@server/types/models' | 6 | import { MAccountId, MActorId, MChannelId, MVideoId } from '@server/types/models' |
5 | import { VideoPrivacy, VideoRateType } from '../../../shared/models/videos' | 7 | import { VideoPrivacy, VideoRateType } from '../../../shared/models/videos' |
6 | import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/video-playlist-privacy.model' | 8 | import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/video-playlist-privacy.model' |
7 | import { activityPubCollectionPagination, activityPubContextify } from '../../helpers/activitypub' | ||
8 | import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../../initializers/constants' | 9 | import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../../initializers/constants' |
9 | import { audiencify, getAudience } from '../../lib/activitypub/audience' | 10 | import { audiencify, getAudience } from '../../lib/activitypub/audience' |
10 | import { buildAnnounceWithVideoAudience, buildLikeActivity } from '../../lib/activitypub/send' | 11 | import { buildAnnounceWithVideoAudience, buildLikeActivity } from '../../lib/activitypub/send' |
@@ -400,7 +401,7 @@ function videoPlaylistElementController (req: express.Request, res: express.Resp | |||
400 | 401 | ||
401 | // --------------------------------------------------------------------------- | 402 | // --------------------------------------------------------------------------- |
402 | 403 | ||
403 | async function actorFollowing (req: express.Request, actor: MActorId) { | 404 | function actorFollowing (req: express.Request, actor: MActorId) { |
404 | const handler = (start: number, count: number) => { | 405 | const handler = (start: number, count: number) => { |
405 | return ActorFollowModel.listAcceptedFollowingUrlsForApi([ actor.id ], undefined, start, count) | 406 | return ActorFollowModel.listAcceptedFollowingUrlsForApi([ actor.id ], undefined, start, count) |
406 | } | 407 | } |
@@ -408,7 +409,7 @@ async function actorFollowing (req: express.Request, actor: MActorId) { | |||
408 | return activityPubCollectionPagination(WEBSERVER.URL + req.path, handler, req.query.page) | 409 | return activityPubCollectionPagination(WEBSERVER.URL + req.path, handler, req.query.page) |
409 | } | 410 | } |
410 | 411 | ||
411 | async function actorFollowers (req: express.Request, actor: MActorId) { | 412 | function actorFollowers (req: express.Request, actor: MActorId) { |
412 | const handler = (start: number, count: number) => { | 413 | const handler = (start: number, count: number) => { |
413 | return ActorFollowModel.listAcceptedFollowerUrlsForAP([ actor.id ], undefined, start, count) | 414 | return ActorFollowModel.listAcceptedFollowerUrlsForAP([ actor.id ], undefined, start, count) |
414 | } | 415 | } |
@@ -416,7 +417,7 @@ async function actorFollowers (req: express.Request, actor: MActorId) { | |||
416 | return activityPubCollectionPagination(WEBSERVER.URL + req.path, handler, req.query.page) | 417 | return activityPubCollectionPagination(WEBSERVER.URL + req.path, handler, req.query.page) |
417 | } | 418 | } |
418 | 419 | ||
419 | async function actorPlaylists (req: express.Request, options: { account: MAccountId } | { channel: MChannelId }) { | 420 | function actorPlaylists (req: express.Request, options: { account: MAccountId } | { channel: MChannelId }) { |
420 | const handler = (start: number, count: number) => { | 421 | const handler = (start: number, count: number) => { |
421 | return VideoPlaylistModel.listPublicUrlsOfForAP(options, start, count) | 422 | return VideoPlaylistModel.listPublicUrlsOfForAP(options, start, count) |
422 | } | 423 | } |
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 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { activityPubCollectionPagination } from '@server/lib/activitypub/collection' | ||
3 | import { activityPubContextify } from '@server/lib/activitypub/context' | ||
2 | import { MActorLight } from '@server/types/models' | 4 | import { MActorLight } from '@server/types/models' |
3 | import { Activity } from '../../../shared/models/activitypub/activity' | 5 | import { Activity } from '../../../shared/models/activitypub/activity' |
4 | import { VideoPrivacy } from '../../../shared/models/videos' | 6 | import { VideoPrivacy } from '../../../shared/models/videos' |
5 | import { activityPubCollectionPagination, activityPubContextify } from '../../helpers/activitypub' | ||
6 | import { logger } from '../../helpers/logger' | 7 | import { logger } from '../../helpers/logger' |
7 | import { buildAudience } from '../../lib/activitypub/audience' | 8 | import { buildAudience } from '../../lib/activitypub/audience' |
8 | import { buildAnnounceActivity, buildCreateActivity } from '../../lib/activitypub/send' | 9 | import { buildAnnounceActivity, buildCreateActivity } from '../../lib/activitypub/send' |