Add subscriptions endpoints to REST API
This commit is contained in:
parent
4bda2e47bb
commit
06a05d5f47
36 changed files with 1039 additions and 94 deletions
|
@ -5,11 +5,12 @@ import { activityPubCollectionPagination, activityPubContextify } from '../../he
|
|||
import { logger } from '../../helpers/logger'
|
||||
import { announceActivityData, createActivityData } from '../../lib/activitypub/send'
|
||||
import { buildAudience } from '../../lib/activitypub/audience'
|
||||
import { asyncMiddleware, localAccountValidator } from '../../middlewares'
|
||||
import { asyncMiddleware, localAccountValidator, localVideoChannelValidator } from '../../middlewares'
|
||||
import { AccountModel } from '../../models/account/account'
|
||||
import { ActorModel } from '../../models/activitypub/actor'
|
||||
import { VideoModel } from '../../models/video/video'
|
||||
import { activityPubResponse } from './utils'
|
||||
import { VideoChannelModel } from '../../models/video/video-channel'
|
||||
|
||||
const outboxRouter = express.Router()
|
||||
|
||||
|
@ -18,6 +19,11 @@ outboxRouter.get('/accounts/:name/outbox',
|
|||
asyncMiddleware(outboxController)
|
||||
)
|
||||
|
||||
outboxRouter.get('/video-channels/:name/outbox',
|
||||
localVideoChannelValidator,
|
||||
asyncMiddleware(outboxController)
|
||||
)
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export {
|
||||
|
@ -27,9 +33,9 @@ export {
|
|||
// ---------------------------------------------------------------------------
|
||||
|
||||
async function outboxController (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
const account: AccountModel = res.locals.account
|
||||
const actor = account.Actor
|
||||
const actorOutboxUrl = account.Actor.url + '/outbox'
|
||||
const accountOrVideoChannel: AccountModel | VideoChannelModel = res.locals.account || res.locals.videoChannel
|
||||
const actor = accountOrVideoChannel.Actor
|
||||
const actorOutboxUrl = actor.url + '/outbox'
|
||||
|
||||
logger.info('Receiving outbox request for %s.', actorOutboxUrl)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue