2020-01-31 16:56:52 +01:00
|
|
|
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
|
2019-07-19 10:37:35 +02:00
|
|
|
|
2022-08-17 15:44:32 +02:00
|
|
|
import { expect } from 'chai'
|
2021-12-17 11:58:15 +01:00
|
|
|
import { HttpStatusCode, VideoDetails, VideoImportState, VideoPlaylist, VideoPlaylistPrivacy, VideoPrivacy } from '@shared/models'
|
2019-07-19 17:30:41 +02:00
|
|
|
import {
|
2021-07-06 15:22:51 +02:00
|
|
|
cleanupTests,
|
2021-07-16 09:47:51 +02:00
|
|
|
createMultipleServers,
|
2021-07-16 10:19:16 +02:00
|
|
|
doubleFollow,
|
2022-10-12 16:09:02 +02:00
|
|
|
makeGetRequest,
|
2021-03-23 11:54:08 +01:00
|
|
|
makeRawRequest,
|
2021-07-16 09:47:51 +02:00
|
|
|
PeerTubeServer,
|
2021-07-16 10:19:16 +02:00
|
|
|
PluginsCommand,
|
2020-01-31 16:56:52 +01:00
|
|
|
setAccessTokensToServers,
|
2019-07-22 11:14:58 +02:00
|
|
|
setDefaultVideoChannel,
|
2021-07-13 09:43:59 +02:00
|
|
|
waitJobs
|
2021-12-17 09:29:23 +01:00
|
|
|
} from '@shared/server-commands'
|
2021-12-17 11:58:15 +01:00
|
|
|
import { FIXTURE_URLS } from '../shared'
|
2019-07-19 10:37:35 +02:00
|
|
|
|
|
|
|
describe('Test plugin filter hooks', function () {
|
2021-07-16 09:47:51 +02:00
|
|
|
let servers: PeerTubeServer[]
|
2019-07-19 17:30:41 +02:00
|
|
|
let videoUUID: string
|
|
|
|
let threadId: number
|
2022-02-15 08:24:22 +01:00
|
|
|
let videoPlaylistUUID: string
|
2019-07-19 10:37:35 +02:00
|
|
|
|
|
|
|
before(async function () {
|
2021-05-07 15:17:43 +02:00
|
|
|
this.timeout(60000)
|
2019-07-19 10:37:35 +02:00
|
|
|
|
2021-07-16 09:47:51 +02:00
|
|
|
servers = await createMultipleServers(2)
|
2019-07-19 17:30:41 +02:00
|
|
|
await setAccessTokensToServers(servers)
|
2019-07-22 11:14:58 +02:00
|
|
|
await setDefaultVideoChannel(servers)
|
|
|
|
await doubleFollow(servers[0], servers[1])
|
2019-07-19 17:30:41 +02:00
|
|
|
|
2021-07-16 09:04:35 +02:00
|
|
|
await servers[0].plugins.install({ path: PluginsCommand.getPluginTestPath() })
|
|
|
|
await servers[0].plugins.install({ path: PluginsCommand.getPluginTestPath('-filter-translations') })
|
2022-02-15 08:24:22 +01:00
|
|
|
{
|
|
|
|
({ uuid: videoPlaylistUUID } = await servers[0].playlists.create({
|
|
|
|
attributes: {
|
|
|
|
displayName: 'my super playlist',
|
|
|
|
privacy: VideoPlaylistPrivacy.PUBLIC,
|
|
|
|
description: 'my super description',
|
|
|
|
videoChannelId: servers[0].store.channel.id
|
|
|
|
}
|
|
|
|
}))
|
|
|
|
}
|
2019-07-19 17:30:41 +02:00
|
|
|
|
|
|
|
for (let i = 0; i < 10; i++) {
|
2022-02-15 08:24:22 +01:00
|
|
|
const video = await servers[0].videos.upload({ attributes: { name: 'default video ' + i } })
|
|
|
|
await servers[0].playlists.addElement({ playlistId: videoPlaylistUUID, attributes: { videoId: video.id } })
|
2019-07-19 17:30:41 +02:00
|
|
|
}
|
|
|
|
|
2021-07-16 09:04:35 +02:00
|
|
|
const { data } = await servers[0].videos.list()
|
2021-07-15 10:02:54 +02:00
|
|
|
videoUUID = data[0].uuid
|
2020-11-06 13:59:50 +01:00
|
|
|
|
2021-07-16 09:04:35 +02:00
|
|
|
await servers[0].config.updateCustomSubConfig({
|
2021-07-07 11:51:09 +02:00
|
|
|
newConfig: {
|
|
|
|
live: { enabled: true },
|
|
|
|
signup: { enabled: true },
|
|
|
|
import: {
|
|
|
|
videos: {
|
|
|
|
http: { enabled: true },
|
|
|
|
torrent: { enabled: true }
|
|
|
|
}
|
2020-11-06 13:59:50 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
2019-07-19 10:37:35 +02:00
|
|
|
})
|
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
describe('Videos', function () {
|
2019-07-19 17:30:41 +02:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
it('Should run filter:api.videos.list.params', async function () {
|
|
|
|
const { data } = await servers[0].videos.list({ start: 0, count: 2 })
|
2019-07-19 17:30:41 +02:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
// 2 plugins do +1 to the count parameter
|
|
|
|
expect(data).to.have.lengthOf(4)
|
|
|
|
})
|
2019-07-19 17:30:41 +02:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
it('Should run filter:api.videos.list.result', async function () {
|
|
|
|
const { total } = await servers[0].videos.list({ start: 0, count: 0 })
|
2019-07-19 17:30:41 +02:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
// Plugin do +1 to the total result
|
|
|
|
expect(total).to.equal(11)
|
2022-02-15 08:24:22 +01:00
|
|
|
})
|
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
it('Should run filter:api.video-playlist.videos.list.params', async function () {
|
|
|
|
const { data } = await servers[0].playlists.listVideos({
|
|
|
|
count: 2,
|
|
|
|
playlistId: videoPlaylistUUID
|
|
|
|
})
|
2022-02-15 08:24:22 +01:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
// 1 plugin do +1 to the count parameter
|
|
|
|
expect(data).to.have.lengthOf(3)
|
2022-02-15 08:24:22 +01:00
|
|
|
})
|
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
it('Should run filter:api.video-playlist.videos.list.result', async function () {
|
|
|
|
const { total } = await servers[0].playlists.listVideos({
|
|
|
|
count: 0,
|
|
|
|
playlistId: videoPlaylistUUID
|
|
|
|
})
|
2022-02-15 08:24:22 +01:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
// Plugin do +1 to the total result
|
|
|
|
expect(total).to.equal(11)
|
|
|
|
})
|
2020-12-08 10:30:33 +01:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
it('Should run filter:api.accounts.videos.list.params', async function () {
|
|
|
|
const { data } = await servers[0].videos.listByAccount({ handle: 'root', start: 0, count: 2 })
|
2020-12-08 10:30:33 +01:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
// 1 plugin do +1 to the count parameter
|
|
|
|
expect(data).to.have.lengthOf(3)
|
|
|
|
})
|
2020-12-08 10:30:33 +01:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
it('Should run filter:api.accounts.videos.list.result', async function () {
|
|
|
|
const { total } = await servers[0].videos.listByAccount({ handle: 'root', start: 0, count: 2 })
|
2020-12-08 10:30:33 +01:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
// Plugin do +2 to the total result
|
|
|
|
expect(total).to.equal(12)
|
|
|
|
})
|
2020-12-08 10:30:33 +01:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
it('Should run filter:api.video-channels.videos.list.params', async function () {
|
|
|
|
const { data } = await servers[0].videos.listByChannel({ handle: 'root_channel', start: 0, count: 2 })
|
2020-12-08 10:30:33 +01:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
// 1 plugin do +3 to the count parameter
|
|
|
|
expect(data).to.have.lengthOf(5)
|
|
|
|
})
|
2020-12-08 10:30:33 +01:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
it('Should run filter:api.video-channels.videos.list.result', async function () {
|
|
|
|
const { total } = await servers[0].videos.listByChannel({ handle: 'root_channel', start: 0, count: 2 })
|
2020-12-08 10:30:33 +01:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
// Plugin do +3 to the total result
|
|
|
|
expect(total).to.equal(13)
|
|
|
|
})
|
2021-01-20 15:28:34 +01:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
it('Should run filter:api.user.me.videos.list.params', async function () {
|
|
|
|
const { data } = await servers[0].videos.listMyVideos({ start: 0, count: 2 })
|
2021-01-20 15:28:34 +01:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
// 1 plugin do +4 to the count parameter
|
|
|
|
expect(data).to.have.lengthOf(6)
|
|
|
|
})
|
2021-01-20 15:28:34 +01:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
it('Should run filter:api.user.me.videos.list.result', async function () {
|
|
|
|
const { total } = await servers[0].videos.listMyVideos({ start: 0, count: 2 })
|
2021-01-20 15:28:34 +01:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
// Plugin do +4 to the total result
|
|
|
|
expect(total).to.equal(14)
|
|
|
|
})
|
2019-07-19 10:37:35 +02:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
it('Should run filter:api.video.get.result', async function () {
|
|
|
|
const video = await servers[0].videos.get({ id: videoUUID })
|
|
|
|
expect(video.name).to.contain('<3')
|
|
|
|
})
|
2019-07-22 11:14:58 +02:00
|
|
|
})
|
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
describe('Video/live/import accept', function () {
|
2020-11-06 13:59:50 +01:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
it('Should run filter:api.video.upload.accept.result', async function () {
|
|
|
|
await servers[0].videos.upload({ attributes: { name: 'video with bad word' }, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
|
|
|
|
})
|
2020-05-14 11:10:26 +02:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
it('Should run filter:api.live-video.create.accept.result', async function () {
|
|
|
|
const attributes = {
|
|
|
|
name: 'video with bad word',
|
|
|
|
privacy: VideoPrivacy.PUBLIC,
|
|
|
|
channelId: servers[0].store.channel.id
|
|
|
|
}
|
2020-05-14 11:10:26 +02:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
await servers[0].live.create({ fields: attributes, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
|
|
|
|
})
|
2020-05-14 11:10:26 +02:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
it('Should run filter:api.video.pre-import-url.accept.result', async function () {
|
|
|
|
const attributes = {
|
|
|
|
name: 'normal title',
|
|
|
|
privacy: VideoPrivacy.PUBLIC,
|
|
|
|
channelId: servers[0].store.channel.id,
|
|
|
|
targetUrl: FIXTURE_URLS.goodVideo + 'bad'
|
|
|
|
}
|
|
|
|
await servers[0].imports.importVideo({ attributes, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
|
|
|
|
})
|
2020-05-14 11:10:26 +02:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
it('Should run filter:api.video.pre-import-torrent.accept.result', async function () {
|
2021-07-08 16:49:51 +02:00
|
|
|
const attributes = {
|
2022-09-23 11:38:18 +02:00
|
|
|
name: 'bad torrent',
|
2020-05-14 11:10:26 +02:00
|
|
|
privacy: VideoPrivacy.PUBLIC,
|
2021-07-16 09:04:35 +02:00
|
|
|
channelId: servers[0].store.channel.id,
|
2022-09-23 11:38:18 +02:00
|
|
|
torrentfile: 'video-720p.torrent' as any
|
2020-05-14 11:10:26 +02:00
|
|
|
}
|
2022-09-23 11:38:18 +02:00
|
|
|
await servers[0].imports.importVideo({ attributes, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
|
|
|
|
})
|
2020-05-14 11:10:26 +02:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
it('Should run filter:api.video.post-import-url.accept.result', async function () {
|
|
|
|
this.timeout(60000)
|
2020-05-14 11:10:26 +02:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
let videoImportId: number
|
2020-05-14 11:10:26 +02:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
{
|
|
|
|
const attributes = {
|
|
|
|
name: 'title with bad word',
|
|
|
|
privacy: VideoPrivacy.PUBLIC,
|
|
|
|
channelId: servers[0].store.channel.id,
|
|
|
|
targetUrl: FIXTURE_URLS.goodVideo
|
|
|
|
}
|
|
|
|
const body = await servers[0].imports.importVideo({ attributes })
|
|
|
|
videoImportId = body.id
|
|
|
|
}
|
2020-05-14 11:10:26 +02:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
await waitJobs(servers)
|
2020-05-14 11:10:26 +02:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
{
|
|
|
|
const body = await servers[0].imports.getMyVideoImports()
|
|
|
|
const videoImports = body.data
|
2020-05-14 11:10:26 +02:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
const videoImport = videoImports.find(i => i.id === videoImportId)
|
2020-05-14 11:10:26 +02:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
expect(videoImport.state.id).to.equal(VideoImportState.REJECTED)
|
|
|
|
expect(videoImport.state.label).to.equal('Rejected')
|
2020-05-14 11:10:26 +02:00
|
|
|
}
|
2022-09-23 11:38:18 +02:00
|
|
|
})
|
2020-05-14 11:10:26 +02:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
it('Should run filter:api.video.post-import-torrent.accept.result', async function () {
|
|
|
|
this.timeout(60000)
|
2020-05-14 11:10:26 +02:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
let videoImportId: number
|
2020-05-14 11:10:26 +02:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
{
|
|
|
|
const attributes = {
|
|
|
|
name: 'title with bad word',
|
|
|
|
privacy: VideoPrivacy.PUBLIC,
|
|
|
|
channelId: servers[0].store.channel.id,
|
|
|
|
torrentfile: 'video-720p.torrent' as any
|
|
|
|
}
|
|
|
|
const body = await servers[0].imports.importVideo({ attributes })
|
|
|
|
videoImportId = body.id
|
|
|
|
}
|
2020-05-14 11:10:26 +02:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
await waitJobs(servers)
|
|
|
|
|
|
|
|
{
|
|
|
|
const { data: videoImports } = await servers[0].imports.getMyVideoImports()
|
|
|
|
|
|
|
|
const videoImport = videoImports.find(i => i.id === videoImportId)
|
2020-05-14 11:10:26 +02:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
expect(videoImport.state.id).to.equal(VideoImportState.REJECTED)
|
|
|
|
expect(videoImport.state.label).to.equal('Rejected')
|
|
|
|
}
|
2021-07-09 14:15:11 +02:00
|
|
|
})
|
2019-07-22 11:14:58 +02:00
|
|
|
})
|
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
describe('Video comments accept', function () {
|
2021-07-09 14:15:11 +02:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
it('Should run filter:api.video-thread.create.accept.result', async function () {
|
|
|
|
await servers[0].comments.createThread({
|
|
|
|
videoId: videoUUID,
|
|
|
|
text: 'comment with bad word',
|
|
|
|
expectedStatus: HttpStatusCode.FORBIDDEN_403
|
|
|
|
})
|
2021-07-09 14:15:11 +02:00
|
|
|
})
|
2022-09-23 11:38:18 +02:00
|
|
|
|
|
|
|
it('Should run filter:api.video-comment-reply.create.accept.result', async function () {
|
|
|
|
const created = await servers[0].comments.createThread({ videoId: videoUUID, text: 'thread' })
|
|
|
|
threadId = created.id
|
|
|
|
|
|
|
|
await servers[0].comments.addReply({
|
|
|
|
videoId: videoUUID,
|
|
|
|
toCommentId: threadId,
|
|
|
|
text: 'comment with bad word',
|
|
|
|
expectedStatus: HttpStatusCode.FORBIDDEN_403
|
|
|
|
})
|
|
|
|
await servers[0].comments.addReply({
|
|
|
|
videoId: videoUUID,
|
|
|
|
toCommentId: threadId,
|
|
|
|
text: 'comment with good word',
|
|
|
|
expectedStatus: HttpStatusCode.OK_200
|
|
|
|
})
|
2021-07-09 14:15:11 +02:00
|
|
|
})
|
2019-07-22 11:14:58 +02:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
it('Should run filter:activity-pub.remote-video-comment.create.accept.result on a thread creation', async function () {
|
|
|
|
this.timeout(30000)
|
2019-07-22 11:14:58 +02:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
await servers[1].comments.createThread({ videoId: videoUUID, text: 'comment with bad word' })
|
2019-07-22 11:14:58 +02:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
await waitJobs(servers)
|
2019-07-22 11:14:58 +02:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
{
|
|
|
|
const thread = await servers[0].comments.listThreads({ videoId: videoUUID })
|
|
|
|
expect(thread.data).to.have.lengthOf(1)
|
|
|
|
expect(thread.data[0].text).to.not.include(' bad ')
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
const thread = await servers[1].comments.listThreads({ videoId: videoUUID })
|
|
|
|
expect(thread.data).to.have.lengthOf(2)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should run filter:activity-pub.remote-video-comment.create.accept.result on a reply creation', async function () {
|
|
|
|
this.timeout(30000)
|
|
|
|
|
|
|
|
const { data } = await servers[1].comments.listThreads({ videoId: videoUUID })
|
|
|
|
const threadIdServer2 = data.find(t => t.text === 'thread').id
|
2019-07-22 11:14:58 +02:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
await servers[1].comments.addReply({
|
|
|
|
videoId: videoUUID,
|
|
|
|
toCommentId: threadIdServer2,
|
|
|
|
text: 'comment with bad word'
|
|
|
|
})
|
2019-07-22 11:14:58 +02:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
await waitJobs(servers)
|
2019-07-22 11:14:58 +02:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
{
|
|
|
|
const tree = await servers[0].comments.getThread({ videoId: videoUUID, threadId })
|
|
|
|
expect(tree.children).to.have.lengthOf(1)
|
|
|
|
expect(tree.children[0].comment.text).to.not.include(' bad ')
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
const tree = await servers[1].comments.getThread({ videoId: videoUUID, threadId: threadIdServer2 })
|
|
|
|
expect(tree.children).to.have.lengthOf(2)
|
|
|
|
}
|
|
|
|
})
|
2019-07-22 11:14:58 +02:00
|
|
|
})
|
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
describe('Video comments', function () {
|
|
|
|
|
|
|
|
it('Should run filter:api.video-threads.list.params', async function () {
|
|
|
|
const { data } = await servers[0].comments.listThreads({ videoId: videoUUID, start: 0, count: 0 })
|
2021-07-21 16:13:20 +02:00
|
|
|
|
2022-09-23 11:38:18 +02:00
|
|
|
// our plugin do +1 to the count parameter
|
|
|
|
expect(data).to.have.lengthOf(1)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should run filter:api.video-threads.list.result', async function () {
|
|
|
|
const { total } = await servers[0].comments.listThreads({ videoId: videoUUID, start: 0, count: 0 })
|
|
|
|
|
|
|
|
// Plugin do +1 to the total result
|
|
|
|
expect(total).to.equal(2)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should run filter:api.video-thread-comments.list.params')
|
|
|
|
|
|
|
|
it('Should run filter:api.video-thread-comments.list.result', async function () {
|
|
|
|
const thread = await servers[0].comments.getThread({ videoId: videoUUID, threadId })
|
|
|
|
|
|
|
|
expect(thread.comment.text.endsWith(' <3')).to.be.true
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should run filter:api.overviews.videos.list.{params,result}', async function () {
|
|
|
|
await servers[0].overviews.getVideos({ page: 1 })
|
|
|
|
|
|
|
|
// 3 because we get 3 samples per page
|
|
|
|
await servers[0].servers.waitUntilLog('Run hook filter:api.overviews.videos.list.params', 3)
|
|
|
|
await servers[0].servers.waitUntilLog('Run hook filter:api.overviews.videos.list.result', 3)
|
|
|
|
})
|
2021-07-21 16:13:20 +02:00
|
|
|
})
|
|
|
|
|
2022-08-03 11:17:57 +02:00
|
|
|
describe('filter:video.auto-blacklist.result', function () {
|
2019-07-22 11:14:58 +02:00
|
|
|
|
2021-07-08 16:49:51 +02:00
|
|
|
async function checkIsBlacklisted (id: number | string, value: boolean) {
|
2021-07-16 09:04:35 +02:00
|
|
|
const video = await servers[0].videos.getWithToken({ id })
|
2019-07-22 11:14:58 +02:00
|
|
|
expect(video.blacklisted).to.equal(value)
|
|
|
|
}
|
|
|
|
|
|
|
|
it('Should blacklist on upload', async function () {
|
2021-07-16 09:04:35 +02:00
|
|
|
const { uuid } = await servers[0].videos.upload({ attributes: { name: 'video please blacklist me' } })
|
2021-07-15 10:02:54 +02:00
|
|
|
await checkIsBlacklisted(uuid, true)
|
2019-07-22 11:14:58 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
it('Should blacklist on import', async function () {
|
2020-01-23 11:09:25 +01:00
|
|
|
this.timeout(15000)
|
|
|
|
|
2019-07-22 11:14:58 +02:00
|
|
|
const attributes = {
|
|
|
|
name: 'video please blacklist me',
|
2021-07-16 10:19:16 +02:00
|
|
|
targetUrl: FIXTURE_URLS.goodVideo,
|
2021-07-16 09:04:35 +02:00
|
|
|
channelId: servers[0].store.channel.id
|
2019-07-22 11:14:58 +02:00
|
|
|
}
|
2021-07-16 09:04:35 +02:00
|
|
|
const body = await servers[0].imports.importVideo({ attributes })
|
2021-07-08 16:49:51 +02:00
|
|
|
await checkIsBlacklisted(body.video.uuid, true)
|
2019-07-22 11:14:58 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
it('Should blacklist on update', async function () {
|
2021-07-16 09:04:35 +02:00
|
|
|
const { uuid } = await servers[0].videos.upload({ attributes: { name: 'video' } })
|
2021-07-15 10:02:54 +02:00
|
|
|
await checkIsBlacklisted(uuid, false)
|
2019-07-22 11:14:58 +02:00
|
|
|
|
2021-07-16 09:04:35 +02:00
|
|
|
await servers[0].videos.update({ id: uuid, attributes: { name: 'please blacklist me' } })
|
2021-07-15 10:02:54 +02:00
|
|
|
await checkIsBlacklisted(uuid, true)
|
2019-07-22 11:14:58 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
it('Should blacklist on remote upload', async function () {
|
2021-06-14 16:52:22 +02:00
|
|
|
this.timeout(120000)
|
2019-07-22 11:14:58 +02:00
|
|
|
|
2021-07-16 09:04:35 +02:00
|
|
|
const { uuid } = await servers[1].videos.upload({ attributes: { name: 'remote please blacklist me' } })
|
2019-07-22 11:14:58 +02:00
|
|
|
await waitJobs(servers)
|
|
|
|
|
2021-07-15 10:02:54 +02:00
|
|
|
await checkIsBlacklisted(uuid, true)
|
2019-07-22 11:14:58 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
it('Should blacklist on remote update', async function () {
|
2021-06-14 16:52:22 +02:00
|
|
|
this.timeout(120000)
|
2019-07-22 11:14:58 +02:00
|
|
|
|
2021-07-16 09:04:35 +02:00
|
|
|
const { uuid } = await servers[1].videos.upload({ attributes: { name: 'video' } })
|
2019-07-22 11:14:58 +02:00
|
|
|
await waitJobs(servers)
|
|
|
|
|
2021-07-15 10:02:54 +02:00
|
|
|
await checkIsBlacklisted(uuid, false)
|
2019-07-22 11:14:58 +02:00
|
|
|
|
2021-07-16 09:04:35 +02:00
|
|
|
await servers[1].videos.update({ id: uuid, attributes: { name: 'please blacklist me' } })
|
2019-07-22 11:14:58 +02:00
|
|
|
await waitJobs(servers)
|
|
|
|
|
2021-07-15 10:02:54 +02:00
|
|
|
await checkIsBlacklisted(uuid, true)
|
2019-07-22 11:14:58 +02:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2019-10-25 13:54:32 +02:00
|
|
|
describe('Should run filter:api.user.signup.allowed.result', function () {
|
|
|
|
|
|
|
|
it('Should run on config endpoint', async function () {
|
2021-07-16 09:04:35 +02:00
|
|
|
const body = await servers[0].config.getConfig()
|
2021-07-07 11:51:09 +02:00
|
|
|
expect(body.signup.allowed).to.be.true
|
2019-10-25 13:54:32 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
it('Should allow a signup', async function () {
|
2021-07-16 09:04:35 +02:00
|
|
|
await servers[0].users.register({ username: 'john', password: 'password' })
|
2019-10-25 13:54:32 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
it('Should not allow a signup', async function () {
|
2021-07-16 09:04:35 +02:00
|
|
|
const res = await servers[0].users.register({
|
2021-07-13 14:23:01 +02:00
|
|
|
username: 'jma',
|
|
|
|
password: 'password',
|
|
|
|
expectedStatus: HttpStatusCode.FORBIDDEN_403
|
|
|
|
})
|
2019-10-25 13:54:32 +02:00
|
|
|
|
|
|
|
expect(res.body.error).to.equal('No jma')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2021-03-23 11:54:08 +01:00
|
|
|
describe('Download hooks', function () {
|
|
|
|
const downloadVideos: VideoDetails[] = []
|
|
|
|
|
|
|
|
before(async function () {
|
2021-06-15 08:21:39 +02:00
|
|
|
this.timeout(120000)
|
2021-03-23 11:54:08 +01:00
|
|
|
|
2021-07-16 09:04:35 +02:00
|
|
|
await servers[0].config.updateCustomSubConfig({
|
2021-07-07 11:51:09 +02:00
|
|
|
newConfig: {
|
|
|
|
transcoding: {
|
|
|
|
webtorrent: {
|
|
|
|
enabled: true
|
|
|
|
},
|
|
|
|
hls: {
|
|
|
|
enabled: true
|
|
|
|
}
|
2021-03-23 11:54:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
const uuids: string[] = []
|
|
|
|
|
|
|
|
for (const name of [ 'bad torrent', 'bad file', 'bad playlist file' ]) {
|
2022-07-13 11:58:01 +02:00
|
|
|
const uuid = (await servers[0].videos.quickUpload({ name })).uuid
|
2021-03-23 11:54:08 +01:00
|
|
|
uuids.push(uuid)
|
|
|
|
}
|
|
|
|
|
|
|
|
await waitJobs(servers)
|
|
|
|
|
|
|
|
for (const uuid of uuids) {
|
2021-07-16 09:04:35 +02:00
|
|
|
downloadVideos.push(await servers[0].videos.get({ id: uuid }))
|
2021-03-23 11:54:08 +01:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should run filter:api.download.torrent.allowed.result', async function () {
|
2022-10-12 16:09:02 +02:00
|
|
|
const res = await makeRawRequest({ url: downloadVideos[0].files[0].torrentDownloadUrl, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
|
2021-03-23 11:54:08 +01:00
|
|
|
expect(res.body.error).to.equal('Liu Bei')
|
|
|
|
|
2022-10-12 16:09:02 +02:00
|
|
|
await makeRawRequest({ url: downloadVideos[1].files[0].torrentDownloadUrl, expectedStatus: HttpStatusCode.OK_200 })
|
|
|
|
await makeRawRequest({ url: downloadVideos[2].files[0].torrentDownloadUrl, expectedStatus: HttpStatusCode.OK_200 })
|
2021-03-23 11:54:08 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
it('Should run filter:api.download.video.allowed.result', async function () {
|
|
|
|
{
|
2022-10-12 16:09:02 +02:00
|
|
|
const res = await makeRawRequest({ url: downloadVideos[1].files[0].fileDownloadUrl, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
|
2021-03-23 11:54:08 +01:00
|
|
|
expect(res.body.error).to.equal('Cao Cao')
|
|
|
|
|
2022-10-12 16:09:02 +02:00
|
|
|
await makeRawRequest({ url: downloadVideos[0].files[0].fileDownloadUrl, expectedStatus: HttpStatusCode.OK_200 })
|
|
|
|
await makeRawRequest({ url: downloadVideos[2].files[0].fileDownloadUrl, expectedStatus: HttpStatusCode.OK_200 })
|
2021-03-23 11:54:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2022-10-12 16:09:02 +02:00
|
|
|
const res = await makeRawRequest({
|
|
|
|
url: downloadVideos[2].streamingPlaylists[0].files[0].fileDownloadUrl,
|
|
|
|
expectedStatus: HttpStatusCode.FORBIDDEN_403
|
|
|
|
})
|
|
|
|
|
2021-03-23 11:54:08 +01:00
|
|
|
expect(res.body.error).to.equal('Sun Jian')
|
|
|
|
|
2022-10-12 16:09:02 +02:00
|
|
|
await makeRawRequest({ url: downloadVideos[2].files[0].fileDownloadUrl, expectedStatus: HttpStatusCode.OK_200 })
|
|
|
|
|
|
|
|
await makeRawRequest({
|
|
|
|
url: downloadVideos[0].streamingPlaylists[0].files[0].fileDownloadUrl,
|
|
|
|
expectedStatus: HttpStatusCode.OK_200
|
|
|
|
})
|
2021-03-23 11:54:08 +01:00
|
|
|
|
2022-10-12 16:09:02 +02:00
|
|
|
await makeRawRequest({
|
|
|
|
url: downloadVideos[1].streamingPlaylists[0].files[0].fileDownloadUrl,
|
|
|
|
expectedStatus: HttpStatusCode.OK_200
|
|
|
|
})
|
2021-03-23 11:54:08 +01:00
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2021-03-23 17:18:18 +01:00
|
|
|
describe('Embed filters', function () {
|
|
|
|
const embedVideos: VideoDetails[] = []
|
|
|
|
const embedPlaylists: VideoPlaylist[] = []
|
|
|
|
|
|
|
|
before(async function () {
|
|
|
|
this.timeout(60000)
|
|
|
|
|
2022-02-11 10:51:33 +01:00
|
|
|
await servers[0].config.disableTranscoding()
|
2021-03-23 17:18:18 +01:00
|
|
|
|
|
|
|
for (const name of [ 'bad embed', 'good embed' ]) {
|
|
|
|
{
|
2022-07-13 11:58:01 +02:00
|
|
|
const uuid = (await servers[0].videos.quickUpload({ name })).uuid
|
2021-07-16 09:04:35 +02:00
|
|
|
embedVideos.push(await servers[0].videos.get({ id: uuid }))
|
2021-03-23 17:18:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2021-07-16 09:04:35 +02:00
|
|
|
const attributes = { displayName: name, videoChannelId: servers[0].store.channel.id, privacy: VideoPlaylistPrivacy.PUBLIC }
|
|
|
|
const { id } = await servers[0].playlists.create({ attributes })
|
2021-03-23 17:18:18 +01:00
|
|
|
|
2021-07-16 09:04:35 +02:00
|
|
|
const playlist = await servers[0].playlists.get({ playlistId: id })
|
2021-07-08 15:54:39 +02:00
|
|
|
embedPlaylists.push(playlist)
|
2021-03-23 17:18:18 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should run filter:html.embed.video.allowed.result', async function () {
|
2022-10-12 16:09:02 +02:00
|
|
|
const res = await makeGetRequest({ url: servers[0].url, path: embedVideos[0].embedPath, expectedStatus: HttpStatusCode.OK_200 })
|
2021-03-23 17:18:18 +01:00
|
|
|
expect(res.text).to.equal('Lu Bu')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should run filter:html.embed.video-playlist.allowed.result', async function () {
|
2022-10-12 16:09:02 +02:00
|
|
|
const res = await makeGetRequest({ url: servers[0].url, path: embedPlaylists[0].embedPath, expectedStatus: HttpStatusCode.OK_200 })
|
2021-03-23 17:18:18 +01:00
|
|
|
expect(res.text).to.equal('Diao Chan')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2021-03-24 09:16:48 +01:00
|
|
|
describe('Search filters', function () {
|
|
|
|
|
|
|
|
before(async function () {
|
2021-07-16 09:04:35 +02:00
|
|
|
await servers[0].config.updateCustomSubConfig({
|
2021-07-07 11:51:09 +02:00
|
|
|
newConfig: {
|
|
|
|
search: {
|
|
|
|
searchIndex: {
|
|
|
|
enabled: true,
|
|
|
|
isDefaultSearch: false,
|
|
|
|
disableLocalSearch: false
|
|
|
|
}
|
2021-03-24 09:16:48 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should run filter:api.search.videos.local.list.{params,result}', async function () {
|
2021-07-16 09:04:35 +02:00
|
|
|
await servers[0].search.advancedVideoSearch({
|
2021-07-06 15:22:51 +02:00
|
|
|
search: {
|
|
|
|
search: 'Sun Quan'
|
|
|
|
}
|
2021-03-24 09:16:48 +01:00
|
|
|
})
|
|
|
|
|
2021-07-16 09:04:35 +02:00
|
|
|
await servers[0].servers.waitUntilLog('Run hook filter:api.search.videos.local.list.params', 1)
|
|
|
|
await servers[0].servers.waitUntilLog('Run hook filter:api.search.videos.local.list.result', 1)
|
2021-03-24 09:16:48 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
it('Should run filter:api.search.videos.index.list.{params,result}', async function () {
|
2021-07-16 09:04:35 +02:00
|
|
|
await servers[0].search.advancedVideoSearch({
|
2021-07-06 15:22:51 +02:00
|
|
|
search: {
|
|
|
|
search: 'Sun Quan',
|
|
|
|
searchTarget: 'search-index'
|
|
|
|
}
|
2021-03-24 09:16:48 +01:00
|
|
|
})
|
|
|
|
|
2021-07-16 09:04:35 +02:00
|
|
|
await servers[0].servers.waitUntilLog('Run hook filter:api.search.videos.local.list.params', 1)
|
|
|
|
await servers[0].servers.waitUntilLog('Run hook filter:api.search.videos.local.list.result', 1)
|
|
|
|
await servers[0].servers.waitUntilLog('Run hook filter:api.search.videos.index.list.params', 1)
|
|
|
|
await servers[0].servers.waitUntilLog('Run hook filter:api.search.videos.index.list.result', 1)
|
2021-03-24 09:16:48 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
it('Should run filter:api.search.video-channels.local.list.{params,result}', async function () {
|
2021-07-16 09:04:35 +02:00
|
|
|
await servers[0].search.advancedChannelSearch({
|
2021-07-06 15:22:51 +02:00
|
|
|
search: {
|
|
|
|
search: 'Sun Ce'
|
|
|
|
}
|
2021-03-24 09:16:48 +01:00
|
|
|
})
|
|
|
|
|
2021-07-16 09:04:35 +02:00
|
|
|
await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-channels.local.list.params', 1)
|
|
|
|
await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-channels.local.list.result', 1)
|
2021-03-24 09:16:48 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
it('Should run filter:api.search.video-channels.index.list.{params,result}', async function () {
|
2021-07-16 09:04:35 +02:00
|
|
|
await servers[0].search.advancedChannelSearch({
|
2021-07-06 15:22:51 +02:00
|
|
|
search: {
|
|
|
|
search: 'Sun Ce',
|
|
|
|
searchTarget: 'search-index'
|
|
|
|
}
|
2021-03-24 09:16:48 +01:00
|
|
|
})
|
|
|
|
|
2021-07-16 09:04:35 +02:00
|
|
|
await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-channels.local.list.params', 1)
|
|
|
|
await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-channels.local.list.result', 1)
|
|
|
|
await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-channels.index.list.params', 1)
|
|
|
|
await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-channels.index.list.result', 1)
|
2021-03-24 09:16:48 +01:00
|
|
|
})
|
2021-06-17 16:02:38 +02:00
|
|
|
|
|
|
|
it('Should run filter:api.search.video-playlists.local.list.{params,result}', async function () {
|
2021-07-16 09:04:35 +02:00
|
|
|
await servers[0].search.advancedPlaylistSearch({
|
2021-07-06 15:22:51 +02:00
|
|
|
search: {
|
|
|
|
search: 'Sun Jian'
|
|
|
|
}
|
2021-06-17 16:02:38 +02:00
|
|
|
})
|
|
|
|
|
2021-07-16 09:04:35 +02:00
|
|
|
await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-playlists.local.list.params', 1)
|
|
|
|
await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-playlists.local.list.result', 1)
|
2021-06-17 16:02:38 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
it('Should run filter:api.search.video-playlists.index.list.{params,result}', async function () {
|
2021-07-16 09:04:35 +02:00
|
|
|
await servers[0].search.advancedPlaylistSearch({
|
2021-07-06 15:22:51 +02:00
|
|
|
search: {
|
|
|
|
search: 'Sun Jian',
|
|
|
|
searchTarget: 'search-index'
|
|
|
|
}
|
2021-06-17 16:02:38 +02:00
|
|
|
})
|
|
|
|
|
2021-07-16 09:04:35 +02:00
|
|
|
await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-playlists.local.list.params', 1)
|
|
|
|
await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-playlists.local.list.result', 1)
|
|
|
|
await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-playlists.index.list.params', 1)
|
|
|
|
await servers[0].servers.waitUntilLog('Run hook filter:api.search.video-playlists.index.list.result', 1)
|
2021-06-17 16:02:38 +02:00
|
|
|
})
|
2021-03-24 09:16:48 +01:00
|
|
|
})
|
|
|
|
|
2021-12-10 13:49:19 +01:00
|
|
|
describe('Upload/import/live attributes filters', function () {
|
|
|
|
|
|
|
|
before(async function () {
|
|
|
|
await servers[0].config.enableLive({ transcoding: false, allowReplay: false })
|
|
|
|
await servers[0].config.enableImports()
|
|
|
|
await servers[0].config.disableTranscoding()
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should run filter:api.video.upload.video-attribute.result', async function () {
|
|
|
|
for (const mode of [ 'legacy' as 'legacy', 'resumable' as 'resumable' ]) {
|
|
|
|
const { id } = await servers[0].videos.upload({ attributes: { name: 'video', description: 'upload' }, mode })
|
|
|
|
|
|
|
|
const video = await servers[0].videos.get({ id })
|
|
|
|
expect(video.description).to.equal('upload - filter:api.video.upload.video-attribute.result')
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should run filter:api.video.import-url.video-attribute.result', async function () {
|
|
|
|
const attributes = {
|
|
|
|
name: 'video',
|
|
|
|
description: 'import url',
|
|
|
|
channelId: servers[0].store.channel.id,
|
|
|
|
targetUrl: FIXTURE_URLS.goodVideo,
|
|
|
|
privacy: VideoPrivacy.PUBLIC
|
|
|
|
}
|
|
|
|
const { video: { id } } = await servers[0].imports.importVideo({ attributes })
|
|
|
|
|
|
|
|
const video = await servers[0].videos.get({ id })
|
|
|
|
expect(video.description).to.equal('import url - filter:api.video.import-url.video-attribute.result')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should run filter:api.video.import-torrent.video-attribute.result', async function () {
|
|
|
|
const attributes = {
|
|
|
|
name: 'video',
|
|
|
|
description: 'import torrent',
|
|
|
|
channelId: servers[0].store.channel.id,
|
|
|
|
magnetUri: FIXTURE_URLS.magnet,
|
|
|
|
privacy: VideoPrivacy.PUBLIC
|
|
|
|
}
|
|
|
|
const { video: { id } } = await servers[0].imports.importVideo({ attributes })
|
|
|
|
|
|
|
|
const video = await servers[0].videos.get({ id })
|
|
|
|
expect(video.description).to.equal('import torrent - filter:api.video.import-torrent.video-attribute.result')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should run filter:api.video.live.video-attribute.result', async function () {
|
|
|
|
const fields = {
|
|
|
|
name: 'live',
|
|
|
|
description: 'live',
|
|
|
|
channelId: servers[0].store.channel.id,
|
|
|
|
privacy: VideoPrivacy.PUBLIC
|
|
|
|
}
|
|
|
|
const { id } = await servers[0].live.create({ fields })
|
|
|
|
|
|
|
|
const video = await servers[0].videos.get({ id })
|
|
|
|
expect(video.description).to.equal('live - filter:api.video.live.video-attribute.result')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2021-12-09 14:05:21 +01:00
|
|
|
describe('Stats filters', function () {
|
|
|
|
|
|
|
|
it('Should run filter:api.server.stats.get.result', async function () {
|
|
|
|
const data = await servers[0].stats.get()
|
|
|
|
|
|
|
|
expect((data as any).customStats).to.equal(14)
|
|
|
|
})
|
|
|
|
|
|
|
|
})
|
|
|
|
|
2022-08-02 15:29:00 +02:00
|
|
|
describe('Job queue filters', function () {
|
|
|
|
let videoUUID: string
|
|
|
|
|
|
|
|
before(async function () {
|
|
|
|
this.timeout(120_000)
|
|
|
|
|
2022-08-02 16:15:37 +02:00
|
|
|
await servers[0].config.enableMinimumTranscoding()
|
2022-08-02 15:29:00 +02:00
|
|
|
const { uuid } = await servers[0].videos.quickUpload({ name: 'studio' })
|
|
|
|
|
|
|
|
const video = await servers[0].videos.get({ id: uuid })
|
|
|
|
expect(video.duration).at.least(2)
|
|
|
|
videoUUID = video.uuid
|
|
|
|
|
|
|
|
await waitJobs(servers)
|
|
|
|
|
|
|
|
await servers[0].config.enableStudio()
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should run filter:job-queue.process.params', async function () {
|
|
|
|
this.timeout(120_000)
|
|
|
|
|
|
|
|
await servers[0].videoStudio.createEditionTasks({
|
|
|
|
videoId: videoUUID,
|
|
|
|
tasks: [
|
|
|
|
{
|
|
|
|
name: 'add-intro',
|
|
|
|
options: {
|
|
|
|
file: 'video_very_short_240p.mp4'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
})
|
|
|
|
|
|
|
|
await waitJobs(servers)
|
|
|
|
|
|
|
|
await servers[0].servers.waitUntilLog('Run hook filter:job-queue.process.params', 1, false)
|
|
|
|
|
|
|
|
const video = await servers[0].videos.get({ id: videoUUID })
|
|
|
|
expect(video.duration).at.most(2)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should run filter:job-queue.process.result', async function () {
|
|
|
|
await servers[0].servers.waitUntilLog('Run hook filter:job-queue.process.result', 1, false)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2022-08-02 16:05:44 +02:00
|
|
|
describe('Transcoding filters', async function () {
|
|
|
|
|
2022-08-05 13:40:56 +02:00
|
|
|
it('Should run filter:transcoding.auto.resolutions-to-transcode.result', async function () {
|
2022-08-02 16:05:44 +02:00
|
|
|
const { uuid } = await servers[0].videos.quickUpload({ name: 'transcode-filter' })
|
|
|
|
|
|
|
|
await waitJobs(servers)
|
|
|
|
|
|
|
|
const video = await servers[0].videos.get({ id: uuid })
|
|
|
|
expect(video.files).to.have.lengthOf(2)
|
|
|
|
expect(video.files.find(f => f.resolution.id === 100 as any)).to.exist
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2022-08-03 11:17:57 +02:00
|
|
|
describe('Video channel filters', async function () {
|
|
|
|
|
|
|
|
it('Should run filter:api.video-channels.list.params', async function () {
|
|
|
|
const { data } = await servers[0].channels.list({ start: 0, count: 0 })
|
|
|
|
|
|
|
|
// plugin do +1 to the count parameter
|
|
|
|
expect(data).to.have.lengthOf(1)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should run filter:api.video-channels.list.result', async function () {
|
|
|
|
const { total } = await servers[0].channels.list({ start: 0, count: 1 })
|
|
|
|
|
|
|
|
// plugin do +1 to the total parameter
|
|
|
|
expect(total).to.equal(4)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should run filter:api.video-channel.get.result', async function () {
|
|
|
|
const channel = await servers[0].channels.get({ channelName: 'root_channel' })
|
|
|
|
expect(channel.displayName).to.equal('Main root channel <3')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2019-07-19 10:37:35 +02:00
|
|
|
after(async function () {
|
2019-07-19 17:30:41 +02:00
|
|
|
await cleanupTests(servers)
|
2019-07-19 10:37:35 +02:00
|
|
|
})
|
|
|
|
})
|