import { sendUpdateActor } from '../../lib/activitypub/send'
import { VideoChannelCreate, VideoChannelUpdate } from '../../../shared'
import { createLocalVideoChannel, federateAllVideosOfChannel } from '../../lib/video-channel'
-import { buildNSFWFilter, createReqFiles, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils'
+import { buildNSFWFilter, createReqFiles, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils'
import { setAsyncActorKeys } from '../../lib/activitypub'
import { AccountModel } from '../../models/account/account'
import { MIMETYPES } from '../../initializers/constants'
import { commonVideoPlaylistFiltersValidator } from '../../middlewares/validators/videos/video-playlists'
import { CONFIG } from '../../initializers/config'
import { sequelizeTypescript } from '../../initializers/database'
+import { MChannelAccountDefault } from '@server/typings/models'
const auditLogger = auditLoggerFactory('channels')
const reqAvatarFile = createReqFiles([ 'avatarfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { avatarfile: CONFIG.STORAGE.TMP_DIR })
}
async function updateVideoChannelAvatar (req: express.Request, res: express.Response) {
- const avatarPhysicalFile = req.files[ 'avatarfile' ][ 0 ]
+ const avatarPhysicalFile = req.files['avatarfile'][0]
const videoChannel = res.locals.videoChannel
const oldVideoChannelAuditKeys = new VideoChannelAuditView(videoChannel.toFormattedJSON())
}
}
- const videoChannelInstanceUpdated = await videoChannelInstance.save(sequelizeOptions)
+ const videoChannelInstanceUpdated = await videoChannelInstance.save(sequelizeOptions) as MChannelAccountDefault
await sendUpdateActor(videoChannelInstanceUpdated, t)
auditLogger.update(
if (videoChannelWithVideos.isOutdated()) {
JobQueue.Instance.createJob({ type: 'activitypub-refresher', payload: { type: 'actor', url: videoChannelWithVideos.Actor.url } })
- .catch(err => logger.error('Cannot create AP refresher job for actor %s.', videoChannelWithVideos.Actor.url, { err }))
}
return res.json(videoChannelWithVideos.toFormattedJSON())
async function listVideoChannelVideos (req: express.Request, res: express.Response) {
const videoChannelInstance = res.locals.videoChannel
const followerActorId = isUserAbleToSearchRemoteURI(res) ? null : undefined
+ const countVideos = getCountVideos(req)
const resultList = await VideoModel.listForApi({
followerActorId,
nsfw: buildNSFWFilter(res, req.query.nsfw),
withFiles: false,
videoChannelId: videoChannelInstance.id,
- user: res.locals.oauth ? res.locals.oauth.token.User : undefined
+ user: res.locals.oauth ? res.locals.oauth.token.User : undefined,
+ countVideos
})
return res.json(getFormattedObjects(resultList.data, resultList.total))