diff options
author | Chocobozzz <me@florianbigard.com> | 2019-01-10 15:39:51 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-01-10 15:39:51 +0100 |
commit | 5abb9fbbd12e7097e348d6a38622d364b1fa47ed (patch) | |
tree | 8ef483ad15bd76c75876e0e2f34fd3c99b786103 /shared | |
parent | 93f85e90ffa27453e2c909406b62bef65963b8ad (diff) | |
download | PeerTube-5abb9fbbd12e7097e348d6a38622d364b1fa47ed.tar.gz PeerTube-5abb9fbbd12e7097e348d6a38622d364b1fa47ed.tar.zst PeerTube-5abb9fbbd12e7097e348d6a38622d364b1fa47ed.zip |
Add ability to unfederate a local video (on blacklist)
Diffstat (limited to 'shared')
-rw-r--r-- | shared/models/videos/blacklist/video-blacklist-create.model.ts | 1 | ||||
-rw-r--r-- | shared/models/videos/blacklist/video-blacklist.model.ts | 1 | ||||
-rw-r--r-- | shared/utils/server/servers.ts | 4 | ||||
-rw-r--r-- | shared/utils/videos/video-blacklist.ts | 11 |
4 files changed, 15 insertions, 2 deletions
diff --git a/shared/models/videos/blacklist/video-blacklist-create.model.ts b/shared/models/videos/blacklist/video-blacklist-create.model.ts index 89c69cb56..6e7d36421 100644 --- a/shared/models/videos/blacklist/video-blacklist-create.model.ts +++ b/shared/models/videos/blacklist/video-blacklist-create.model.ts | |||
@@ -1,3 +1,4 @@ | |||
1 | export interface VideoBlacklistCreate { | 1 | export interface VideoBlacklistCreate { |
2 | reason?: string | 2 | reason?: string |
3 | unfederate?: boolean | ||
3 | } | 4 | } |
diff --git a/shared/models/videos/blacklist/video-blacklist.model.ts b/shared/models/videos/blacklist/video-blacklist.model.ts index ef4e5e3a2..4bd976190 100644 --- a/shared/models/videos/blacklist/video-blacklist.model.ts +++ b/shared/models/videos/blacklist/video-blacklist.model.ts | |||
@@ -2,6 +2,7 @@ export interface VideoBlacklist { | |||
2 | id: number | 2 | id: number |
3 | createdAt: Date | 3 | createdAt: Date |
4 | updatedAt: Date | 4 | updatedAt: Date |
5 | unfederated: boolean | ||
5 | reason?: string | 6 | reason?: string |
6 | 7 | ||
7 | video: { | 8 | video: { |
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 = []) { | |||
145 | if (dontContinue === true) return | 145 | if (dontContinue === true) return |
146 | 146 | ||
147 | server.app.stdout.removeListener('data', onStdout) | 147 | server.app.stdout.removeListener('data', onStdout) |
148 | |||
149 | process.on('exit', () => process.kill(server.app.pid)) | ||
150 | |||
148 | res(server) | 151 | res(server) |
149 | }) | 152 | }) |
153 | |||
150 | }) | 154 | }) |
151 | } | 155 | } |
152 | 156 | ||
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 @@ | |||
1 | import * as request from 'supertest' | 1 | import * as request from 'supertest' |
2 | 2 | ||
3 | function addVideoToBlacklist (url: string, token: string, videoId: number | string, reason?: string, specialStatus = 204) { | 3 | function addVideoToBlacklist ( |
4 | url: string, | ||
5 | token: string, | ||
6 | videoId: number | string, | ||
7 | reason?: string, | ||
8 | unfederate?: boolean, | ||
9 | specialStatus = 204 | ||
10 | ) { | ||
4 | const path = '/api/v1/videos/' + videoId + '/blacklist' | 11 | const path = '/api/v1/videos/' + videoId + '/blacklist' |
5 | 12 | ||
6 | return request(url) | 13 | return request(url) |
7 | .post(path) | 14 | .post(path) |
8 | .send({ reason }) | 15 | .send({ reason, unfederate }) |
9 | .set('Accept', 'application/json') | 16 | .set('Accept', 'application/json') |
10 | .set('Authorization', 'Bearer ' + token) | 17 | .set('Authorization', 'Bearer ' + token) |
11 | .expect(specialStatus) | 18 | .expect(specialStatus) |