From 5abb9fbbd12e7097e348d6a38622d364b1fa47ed Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 10 Jan 2019 15:39:51 +0100 Subject: Add ability to unfederate a local video (on blacklist) --- shared/utils/server/servers.ts | 4 ++++ shared/utils/videos/video-blacklist.ts | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'shared/utils') diff --git a/shared/utils/server/servers.ts b/shared/utils/server/servers.ts index 568385a41..1e9c83c72 100644 --- a/shared/utils/server/servers.ts +++ b/shared/utils/server/servers.ts @@ -145,8 +145,12 @@ function runServer (serverNumber: number, configOverride?: Object, args = []) { if (dontContinue === true) return server.app.stdout.removeListener('data', onStdout) + + process.on('exit', () => process.kill(server.app.pid)) + res(server) }) + }) } diff --git a/shared/utils/videos/video-blacklist.ts b/shared/utils/videos/video-blacklist.ts index 2c176fde0..f2ae0ed26 100644 --- a/shared/utils/videos/video-blacklist.ts +++ b/shared/utils/videos/video-blacklist.ts @@ -1,11 +1,18 @@ import * as request from 'supertest' -function addVideoToBlacklist (url: string, token: string, videoId: number | string, reason?: string, specialStatus = 204) { +function addVideoToBlacklist ( + url: string, + token: string, + videoId: number | string, + reason?: string, + unfederate?: boolean, + specialStatus = 204 +) { const path = '/api/v1/videos/' + videoId + '/blacklist' return request(url) .post(path) - .send({ reason }) + .send({ reason, unfederate }) .set('Accept', 'application/json') .set('Authorization', 'Bearer ' + token) .expect(specialStatus) -- cgit v1.2.3