aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-03-23 14:24:50 +0100
committerChocobozzz <me@florianbigard.com>2022-03-23 14:24:50 +0100
commit7e98a7df7d04e19ba67163a86c7b876d78d76839 (patch)
tree080c9bf63d2b00b43dca94e3c67cdc2a768308fc /server/controllers
parent5302f77d095c2188859ee463128aa59eec20ea88 (diff)
downloadPeerTube-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.ts9
-rw-r--r--server/controllers/activitypub/outbox.ts3
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 @@
1import cors from 'cors' 1import cors from 'cors'
2import express from 'express' 2import express from 'express'
3import { activityPubCollectionPagination } from '@server/lib/activitypub/collection'
4import { activityPubContextify } from '@server/lib/activitypub/context'
3import { getServerActor } from '@server/models/application/application' 5import { getServerActor } from '@server/models/application/application'
4import { MAccountId, MActorId, MChannelId, MVideoId } from '@server/types/models' 6import { MAccountId, MActorId, MChannelId, MVideoId } from '@server/types/models'
5import { VideoPrivacy, VideoRateType } from '../../../shared/models/videos' 7import { VideoPrivacy, VideoRateType } from '../../../shared/models/videos'
6import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/video-playlist-privacy.model' 8import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/video-playlist-privacy.model'
7import { activityPubCollectionPagination, activityPubContextify } from '../../helpers/activitypub'
8import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../../initializers/constants' 9import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../../initializers/constants'
9import { audiencify, getAudience } from '../../lib/activitypub/audience' 10import { audiencify, getAudience } from '../../lib/activitypub/audience'
10import { buildAnnounceWithVideoAudience, buildLikeActivity } from '../../lib/activitypub/send' 11import { buildAnnounceWithVideoAudience, buildLikeActivity } from '../../lib/activitypub/send'
@@ -400,7 +401,7 @@ function videoPlaylistElementController (req: express.Request, res: express.Resp
400 401
401// --------------------------------------------------------------------------- 402// ---------------------------------------------------------------------------
402 403
403async function actorFollowing (req: express.Request, actor: MActorId) { 404function 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
411async function actorFollowers (req: express.Request, actor: MActorId) { 412function 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
419async function actorPlaylists (req: express.Request, options: { account: MAccountId } | { channel: MChannelId }) { 420function 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 @@
1import express from 'express' 1import express from 'express'
2import { activityPubCollectionPagination } from '@server/lib/activitypub/collection'
3import { activityPubContextify } from '@server/lib/activitypub/context'
2import { MActorLight } from '@server/types/models' 4import { MActorLight } from '@server/types/models'
3import { Activity } from '../../../shared/models/activitypub/activity' 5import { Activity } from '../../../shared/models/activitypub/activity'
4import { VideoPrivacy } from '../../../shared/models/videos' 6import { VideoPrivacy } from '../../../shared/models/videos'
5import { activityPubCollectionPagination, activityPubContextify } from '../../helpers/activitypub'
6import { logger } from '../../helpers/logger' 7import { logger } from '../../helpers/logger'
7import { buildAudience } from '../../lib/activitypub/audience' 8import { buildAudience } from '../../lib/activitypub/audience'
8import { buildAnnounceActivity, buildCreateActivity } from '../../lib/activitypub/send' 9import { buildAnnounceActivity, buildCreateActivity } from '../../lib/activitypub/send'