-import * as cors from 'cors'
-import * as express from 'express'
+import cors from 'cors'
+import express from 'express'
import { getServerActor } from '@server/models/application/application'
import { MAccountId, MActorId, MChannelId, MVideoId } from '@server/types/models'
import { VideoPrivacy, VideoRateType } from '../../../shared/models/videos'
} from '../../lib/activitypub/url'
import {
asyncMiddleware,
+ ensureIsLocalChannel,
executeIfActivityPub,
localAccountValidator,
- localVideoChannelValidator,
+ videoChannelsNameWithHostValidator,
videosCustomGetValidator,
videosShareValidator
} from '../../middlewares'
)
activityPubClientRouter.get(
- [ '/video-channels/:name', '/video-channels/:name/videos', '/c/:name', '/c/:name/videos' ],
+ [ '/video-channels/:nameWithHost', '/video-channels/:nameWithHost/videos', '/c/:nameWithHost', '/c/:nameWithHost/videos' ],
executeIfActivityPub,
- asyncMiddleware(localVideoChannelValidator),
+ asyncMiddleware(videoChannelsNameWithHostValidator),
+ ensureIsLocalChannel,
videoChannelController
)
-activityPubClientRouter.get('/video-channels/:name/followers',
+activityPubClientRouter.get('/video-channels/:nameWithHost/followers',
executeIfActivityPub,
- asyncMiddleware(localVideoChannelValidator),
+ asyncMiddleware(videoChannelsNameWithHostValidator),
+ ensureIsLocalChannel,
asyncMiddleware(videoChannelFollowersController)
)
-activityPubClientRouter.get('/video-channels/:name/following',
+activityPubClientRouter.get('/video-channels/:nameWithHost/following',
executeIfActivityPub,
- asyncMiddleware(localVideoChannelValidator),
+ asyncMiddleware(videoChannelsNameWithHostValidator),
+ ensureIsLocalChannel,
asyncMiddleware(videoChannelFollowingController)
)
-activityPubClientRouter.get('/video-channels/:name/playlists',
+activityPubClientRouter.get('/video-channels/:nameWithHost/playlists',
executeIfActivityPub,
- asyncMiddleware(localVideoChannelValidator),
+ asyncMiddleware(videoChannelsNameWithHostValidator),
+ ensureIsLocalChannel,
asyncMiddleware(videoChannelPlaylistsController)
)
const handler = async (start: number, count: number) => {
const result = await VideoShareModel.listAndCountByVideoId(video.id, start, count)
return {
- total: result.count,
- data: result.rows.map(r => r.url)
+ total: result.total,
+ data: result.data.map(r => r.url)
}
}
const json = await activityPubCollectionPagination(getLocalVideoSharesActivityPubUrl(video), handler, req.query.page)
const handler = async (start: number, count: number) => {
const result = await VideoCommentModel.listAndCountByVideoForAP(video, start, count)
+
return {
- total: result.count,
- data: result.rows.map(r => r.url)
+ total: result.total,
+ data: result.data.map(r => r.url)
}
}
const json = await activityPubCollectionPagination(getLocalVideoCommentsActivityPubUrl(video), handler, req.query.page)
const handler = async (start: number, count: number) => {
const result = await AccountVideoRateModel.listAndCountAccountUrlsByVideoId(rateType, video.id, start, count)
return {
- total: result.count,
- data: result.rows.map(r => r.url)
+ total: result.total,
+ data: result.data.map(r => r.url)
}
}
return activityPubCollectionPagination(url, handler, req.query.page)