diff options
-rw-r--r-- | client/src/app/shared/video/video.model.ts | 16 | ||||
-rw-r--r-- | server/models/video/video.ts | 32 | ||||
-rw-r--r-- | server/tests/api/server/follows.ts | 6 | ||||
-rw-r--r-- | server/tests/api/server/handle-down.ts | 6 | ||||
-rw-r--r-- | server/tests/api/users/users.ts | 4 | ||||
-rw-r--r-- | server/tests/api/videos/multiple-servers.ts | 73 | ||||
-rw-r--r-- | server/tests/api/videos/services.ts | 4 | ||||
-rw-r--r-- | server/tests/api/videos/single-server.ts | 42 | ||||
-rw-r--r-- | server/tests/utils/server/servers.ts | 4 | ||||
-rw-r--r-- | server/tests/utils/videos/videos.ts | 16 | ||||
-rw-r--r-- | shared/models/videos/video.model.ts | 11 | ||||
-rw-r--r-- | support/doc/api/openapi.yaml | 11 | ||||
-rw-r--r-- | support/systemd/peertube.service | 2 |
13 files changed, 135 insertions, 92 deletions
diff --git a/client/src/app/shared/video/video.model.ts b/client/src/app/shared/video/video.model.ts index 79351ba2a..8e46ce44b 100644 --- a/client/src/app/shared/video/video.model.ts +++ b/client/src/app/shared/video/video.model.ts | |||
@@ -1,10 +1,10 @@ | |||
1 | import { Account } from '@app/shared/account/account.model' | 1 | import { Account } from '@app/shared/account/account.model' |
2 | import { User } from '../' | 2 | import { User } from '../' |
3 | import { Video as VideoServerModel } from '../../../../../shared' | 3 | import { Video as VideoServerModel } from '../../../../../shared' |
4 | import { Avatar } from '../../../../../shared/models/avatars/avatar.model' | ||
4 | import { getAbsoluteAPIUrl } from '../misc/utils' | 5 | import { getAbsoluteAPIUrl } from '../misc/utils' |
5 | 6 | ||
6 | export class Video implements VideoServerModel { | 7 | export class Video implements VideoServerModel { |
7 | accountName: string | ||
8 | by: string | 8 | by: string |
9 | createdAt: Date | 9 | createdAt: Date |
10 | updatedAt: Date | 10 | updatedAt: Date |
@@ -32,7 +32,14 @@ export class Video implements VideoServerModel { | |||
32 | likes: number | 32 | likes: number |
33 | dislikes: number | 33 | dislikes: number |
34 | nsfw: boolean | 34 | nsfw: boolean |
35 | account: Account | 35 | |
36 | account: { | ||
37 | name: string | ||
38 | displayName: string | ||
39 | url: string | ||
40 | host: string | ||
41 | avatar: Avatar | ||
42 | } | ||
36 | 43 | ||
37 | private static createDurationString (duration: number) { | 44 | private static createDurationString (duration: number) { |
38 | const minutes = Math.floor(duration / 60) | 45 | const minutes = Math.floor(duration / 60) |
@@ -46,7 +53,6 @@ export class Video implements VideoServerModel { | |||
46 | constructor (hash: VideoServerModel) { | 53 | constructor (hash: VideoServerModel) { |
47 | const absoluteAPIUrl = getAbsoluteAPIUrl() | 54 | const absoluteAPIUrl = getAbsoluteAPIUrl() |
48 | 55 | ||
49 | this.accountName = hash.accountName | ||
50 | this.createdAt = new Date(hash.createdAt.toString()) | 56 | this.createdAt = new Date(hash.createdAt.toString()) |
51 | this.categoryLabel = hash.categoryLabel | 57 | this.categoryLabel = hash.categoryLabel |
52 | this.category = hash.category | 58 | this.category = hash.category |
@@ -61,7 +67,6 @@ export class Video implements VideoServerModel { | |||
61 | this.uuid = hash.uuid | 67 | this.uuid = hash.uuid |
62 | this.isLocal = hash.isLocal | 68 | this.isLocal = hash.isLocal |
63 | this.name = hash.name | 69 | this.name = hash.name |
64 | this.serverHost = hash.serverHost | ||
65 | this.thumbnailPath = hash.thumbnailPath | 70 | this.thumbnailPath = hash.thumbnailPath |
66 | this.thumbnailUrl = absoluteAPIUrl + hash.thumbnailPath | 71 | this.thumbnailUrl = absoluteAPIUrl + hash.thumbnailPath |
67 | this.previewPath = hash.previewPath | 72 | this.previewPath = hash.previewPath |
@@ -72,8 +77,9 @@ export class Video implements VideoServerModel { | |||
72 | this.likes = hash.likes | 77 | this.likes = hash.likes |
73 | this.dislikes = hash.dislikes | 78 | this.dislikes = hash.dislikes |
74 | this.nsfw = hash.nsfw | 79 | this.nsfw = hash.nsfw |
80 | this.account = hash.account | ||
75 | 81 | ||
76 | this.by = Account.CREATE_BY_STRING(hash.accountName, hash.serverHost) | 82 | this.by = Account.CREATE_BY_STRING(hash.account.name, hash.account.host) |
77 | } | 83 | } |
78 | 84 | ||
79 | isVideoNSFWForUser (user: User) { | 85 | isVideoNSFWForUser (user: User) { |
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 1b9d68073..0e5dd0d2f 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -40,7 +40,8 @@ import { | |||
40 | isVideoLanguageValid, | 40 | isVideoLanguageValid, |
41 | isVideoLicenceValid, | 41 | isVideoLicenceValid, |
42 | isVideoNameValid, | 42 | isVideoNameValid, |
43 | isVideoPrivacyValid, isVideoSupportValid | 43 | isVideoPrivacyValid, |
44 | isVideoSupportValid | ||
44 | } from '../../helpers/custom-validators/videos' | 45 | } from '../../helpers/custom-validators/videos' |
45 | import { generateImageFromVideoFile, getVideoFileResolution, transcode } from '../../helpers/ffmpeg-utils' | 46 | import { generateImageFromVideoFile, getVideoFileResolution, transcode } from '../../helpers/ffmpeg-utils' |
46 | import { logger } from '../../helpers/logger' | 47 | import { logger } from '../../helpers/logger' |
@@ -125,13 +126,18 @@ enum ScopeNames { | |||
125 | required: true, | 126 | required: true, |
126 | include: [ | 127 | include: [ |
127 | { | 128 | { |
128 | attributes: [ 'serverId' ], | 129 | attributes: [ 'preferredUsername', 'url', 'serverId' ], |
129 | model: ActorModel.unscoped(), | 130 | model: ActorModel.unscoped(), |
130 | required: true, | 131 | required: true, |
131 | include: [ | 132 | include: [ |
132 | { | 133 | { |
133 | attributes: [ 'host' ], | 134 | attributes: [ 'host' ], |
134 | model: ServerModel.unscoped() | 135 | model: ServerModel.unscoped(), |
136 | required: false | ||
137 | }, | ||
138 | { | ||
139 | model: AvatarModel.unscoped(), | ||
140 | required: false | ||
135 | } | 141 | } |
136 | ] | 142 | ] |
137 | } | 143 | } |
@@ -872,14 +878,7 @@ export class VideoModel extends Model<VideoModel> { | |||
872 | } | 878 | } |
873 | 879 | ||
874 | toFormattedJSON (): Video { | 880 | toFormattedJSON (): Video { |
875 | let serverHost | 881 | const formattedAccount = this.VideoChannel.Account.toFormattedJSON() |
876 | |||
877 | if (this.VideoChannel.Account.Actor.Server) { | ||
878 | serverHost = this.VideoChannel.Account.Actor.Server.host | ||
879 | } else { | ||
880 | // It means it's our video | ||
881 | serverHost = CONFIG.WEBSERVER.HOST | ||
882 | } | ||
883 | 882 | ||
884 | return { | 883 | return { |
885 | id: this.id, | 884 | id: this.id, |
@@ -893,9 +892,7 @@ export class VideoModel extends Model<VideoModel> { | |||
893 | languageLabel: this.getLanguageLabel(), | 892 | languageLabel: this.getLanguageLabel(), |
894 | nsfw: this.nsfw, | 893 | nsfw: this.nsfw, |
895 | description: this.getTruncatedDescription(), | 894 | description: this.getTruncatedDescription(), |
896 | serverHost, | ||
897 | isLocal: this.isOwned(), | 895 | isLocal: this.isOwned(), |
898 | accountName: this.VideoChannel.Account.name, | ||
899 | duration: this.duration, | 896 | duration: this.duration, |
900 | views: this.views, | 897 | views: this.views, |
901 | likes: this.likes, | 898 | likes: this.likes, |
@@ -904,7 +901,14 @@ export class VideoModel extends Model<VideoModel> { | |||
904 | previewPath: this.getPreviewPath(), | 901 | previewPath: this.getPreviewPath(), |
905 | embedPath: this.getEmbedPath(), | 902 | embedPath: this.getEmbedPath(), |
906 | createdAt: this.createdAt, | 903 | createdAt: this.createdAt, |
907 | updatedAt: this.updatedAt | 904 | updatedAt: this.updatedAt, |
905 | account: { | ||
906 | name: formattedAccount.name, | ||
907 | displayName: formattedAccount.displayName, | ||
908 | url: formattedAccount.url, | ||
909 | host: formattedAccount.host, | ||
910 | avatar: formattedAccount.avatar | ||
911 | } | ||
908 | } | 912 | } |
909 | } | 913 | } |
910 | 914 | ||
diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.ts index 19b843861..010b488d8 100644 --- a/server/tests/api/server/follows.ts +++ b/server/tests/api/server/follows.ts | |||
@@ -281,8 +281,10 @@ describe('Test follows', function () { | |||
281 | nsfw: true, | 281 | nsfw: true, |
282 | description: 'my super description', | 282 | description: 'my super description', |
283 | support: 'my super support text', | 283 | support: 'my super support text', |
284 | host: 'localhost:9003', | 284 | account: { |
285 | account: 'root', | 285 | name: 'root', |
286 | host: 'localhost:9003' | ||
287 | }, | ||
286 | isLocal, | 288 | isLocal, |
287 | commentsEnabled: true, | 289 | commentsEnabled: true, |
288 | duration: 5, | 290 | duration: 5, |
diff --git a/server/tests/api/server/handle-down.ts b/server/tests/api/server/handle-down.ts index 84153b097..f5ff3e9e5 100644 --- a/server/tests/api/server/handle-down.ts +++ b/server/tests/api/server/handle-down.ts | |||
@@ -53,8 +53,10 @@ describe('Test handle downs', function () { | |||
53 | nsfw: true, | 53 | nsfw: true, |
54 | description: 'my super description for server 1', | 54 | description: 'my super description for server 1', |
55 | support: 'my super support text for server 1', | 55 | support: 'my super support text for server 1', |
56 | host: 'localhost:9001', | 56 | account: { |
57 | account: 'root', | 57 | name: 'root', |
58 | host: 'localhost:9001' | ||
59 | }, | ||
58 | isLocal: false, | 60 | isLocal: false, |
59 | duration: 10, | 61 | duration: 10, |
60 | tags: [ 'tag1p1', 'tag2p1' ], | 62 | tags: [ 'tag1p1', 'tag2p1' ], |
diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts index c650a74f5..b6ab4f660 100644 --- a/server/tests/api/users/users.ts +++ b/server/tests/api/users/users.ts | |||
@@ -94,7 +94,7 @@ describe('Test users', function () { | |||
94 | const res = await getVideosList(server.url) | 94 | const res = await getVideosList(server.url) |
95 | const video = res.body.data[ 0 ] | 95 | const video = res.body.data[ 0 ] |
96 | 96 | ||
97 | expect(video.accountName).to.equal('root') | 97 | expect(video.account.name).to.equal('root') |
98 | videoId = video.id | 98 | videoId = video.id |
99 | }) | 99 | }) |
100 | 100 | ||
@@ -432,7 +432,7 @@ describe('Test users', function () { | |||
432 | expect(res.body.total).to.equal(1) | 432 | expect(res.body.total).to.equal(1) |
433 | 433 | ||
434 | const video = res.body.data[ 0 ] | 434 | const video = res.body.data[ 0 ] |
435 | expect(video.accountName).to.equal('root') | 435 | expect(video.account.name).to.equal('root') |
436 | }) | 436 | }) |
437 | 437 | ||
438 | it('Should register a new user', async function () { | 438 | it('Should register a new user', async function () { |
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts index 27c4c30b8..3f6b82c50 100644 --- a/server/tests/api/videos/multiple-servers.ts +++ b/server/tests/api/videos/multiple-servers.ts | |||
@@ -8,13 +8,35 @@ import { VideoPrivacy } from '../../../../shared/models/videos' | |||
8 | import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model' | 8 | import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model' |
9 | 9 | ||
10 | import { | 10 | import { |
11 | addVideoChannel, checkVideoFilesWereRemoved, completeVideoCheck, createUser, dateIsValid, doubleFollow, flushAndRunMultipleServers, | 11 | addVideoChannel, |
12 | flushTests, getVideo, | 12 | checkVideoFilesWereRemoved, |
13 | getVideoChannelsList, getVideosList, killallServers, rateVideo, removeVideo, ServerInfo, setAccessTokensToServers, testImage, | 13 | completeVideoCheck, |
14 | updateVideo, uploadVideo, userLogin, viewVideo, wait, webtorrentAdd | 14 | createUser, |
15 | dateIsValid, | ||
16 | doubleFollow, | ||
17 | flushAndRunMultipleServers, | ||
18 | flushTests, | ||
19 | getVideo, | ||
20 | getVideoChannelsList, | ||
21 | getVideosList, | ||
22 | killallServers, | ||
23 | rateVideo, | ||
24 | removeVideo, | ||
25 | ServerInfo, | ||
26 | setAccessTokensToServers, | ||
27 | testImage, | ||
28 | updateVideo, | ||
29 | uploadVideo, | ||
30 | userLogin, | ||
31 | viewVideo, | ||
32 | wait, | ||
33 | webtorrentAdd | ||
15 | } from '../../utils' | 34 | } from '../../utils' |
16 | import { | 35 | import { |
17 | addVideoCommentReply, addVideoCommentThread, deleteVideoComment, getVideoCommentThreads, | 36 | addVideoCommentReply, |
37 | addVideoCommentThread, | ||
38 | deleteVideoComment, | ||
39 | getVideoCommentThreads, | ||
18 | getVideoThreadComments | 40 | getVideoThreadComments |
19 | } from '../../utils/videos/video-comments' | 41 | } from '../../utils/videos/video-comments' |
20 | 42 | ||
@@ -90,8 +112,10 @@ describe('Test multiple servers', function () { | |||
90 | nsfw: true, | 112 | nsfw: true, |
91 | description: 'my super description for server 1', | 113 | description: 'my super description for server 1', |
92 | support: 'my super support text for server 1', | 114 | support: 'my super support text for server 1', |
93 | host: 'localhost:9001', | 115 | account: { |
94 | account: 'root', | 116 | name: 'root', |
117 | host: 'localhost:9001' | ||
118 | }, | ||
95 | isLocal, | 119 | isLocal, |
96 | duration: 10, | 120 | duration: 10, |
97 | tags: [ 'tag1p1', 'tag2p1' ], | 121 | tags: [ 'tag1p1', 'tag2p1' ], |
@@ -160,8 +184,10 @@ describe('Test multiple servers', function () { | |||
160 | nsfw: true, | 184 | nsfw: true, |
161 | description: 'my super description for server 2', | 185 | description: 'my super description for server 2', |
162 | support: 'my super support text for server 2', | 186 | support: 'my super support text for server 2', |
163 | host: 'localhost:9002', | 187 | account: { |
164 | account: 'user1', | 188 | name: 'user1', |
189 | host: 'localhost:9002' | ||
190 | }, | ||
165 | isLocal, | 191 | isLocal, |
166 | commentsEnabled: true, | 192 | commentsEnabled: true, |
167 | duration: 5, | 193 | duration: 5, |
@@ -264,8 +290,10 @@ describe('Test multiple servers', function () { | |||
264 | nsfw: true, | 290 | nsfw: true, |
265 | description: 'my super description for server 3', | 291 | description: 'my super description for server 3', |
266 | support: 'my super support text for server 3', | 292 | support: 'my super support text for server 3', |
267 | host: 'localhost:9003', | 293 | account: { |
268 | account: 'root', | 294 | name: 'root', |
295 | host: 'localhost:9003' | ||
296 | }, | ||
269 | isLocal, | 297 | isLocal, |
270 | duration: 5, | 298 | duration: 5, |
271 | commentsEnabled: true, | 299 | commentsEnabled: true, |
@@ -294,8 +322,10 @@ describe('Test multiple servers', function () { | |||
294 | nsfw: false, | 322 | nsfw: false, |
295 | description: 'my super description for server 3-2', | 323 | description: 'my super description for server 3-2', |
296 | support: 'my super support text for server 3-2', | 324 | support: 'my super support text for server 3-2', |
297 | host: 'localhost:9003', | 325 | account: { |
298 | account: 'root', | 326 | name: 'root', |
327 | host: 'localhost:9003' | ||
328 | }, | ||
299 | commentsEnabled: true, | 329 | commentsEnabled: true, |
300 | isLocal, | 330 | isLocal, |
301 | duration: 5, | 331 | duration: 5, |
@@ -570,8 +600,10 @@ describe('Test multiple servers', function () { | |||
570 | nsfw: true, | 600 | nsfw: true, |
571 | description: 'my super description updated', | 601 | description: 'my super description updated', |
572 | support: 'my super support text updated', | 602 | support: 'my super support text updated', |
573 | host: 'localhost:9003', | 603 | account: { |
574 | account: 'root', | 604 | name: 'root', |
605 | host: 'localhost:9003' | ||
606 | }, | ||
575 | isLocal, | 607 | isLocal, |
576 | duration: 5, | 608 | duration: 5, |
577 | commentsEnabled: true, | 609 | commentsEnabled: true, |
@@ -648,7 +680,10 @@ describe('Test multiple servers', function () { | |||
648 | expect(baseVideo.licence).to.equal(video.licence) | 680 | expect(baseVideo.licence).to.equal(video.licence) |
649 | expect(baseVideo.category).to.equal(video.category) | 681 | expect(baseVideo.category).to.equal(video.category) |
650 | expect(baseVideo.nsfw).to.equal(video.nsfw) | 682 | expect(baseVideo.nsfw).to.equal(video.nsfw) |
651 | expect(baseVideo.accountName).to.equal(video.accountName) | 683 | expect(baseVideo.account.name).to.equal(video.account.name) |
684 | expect(baseVideo.account.displayName).to.equal(video.account.displayName) | ||
685 | expect(baseVideo.account.url).to.equal(video.account.url) | ||
686 | expect(baseVideo.account.host).to.equal(video.account.host) | ||
652 | expect(baseVideo.tags).to.deep.equal(video.tags) | 687 | expect(baseVideo.tags).to.deep.equal(video.tags) |
653 | } | 688 | } |
654 | }) | 689 | }) |
@@ -859,8 +894,10 @@ describe('Test multiple servers', function () { | |||
859 | nsfw: false, | 894 | nsfw: false, |
860 | description: null, | 895 | description: null, |
861 | support: null, | 896 | support: null, |
862 | host: 'localhost:9002', | 897 | account: { |
863 | account: 'root', | 898 | name: 'root', |
899 | host: 'localhost:9002' | ||
900 | }, | ||
864 | isLocal, | 901 | isLocal, |
865 | duration: 5, | 902 | duration: 5, |
866 | commentsEnabled: true, | 903 | commentsEnabled: true, |
diff --git a/server/tests/api/videos/services.ts b/server/tests/api/videos/services.ts index e456184cf..45b4a1a81 100644 --- a/server/tests/api/videos/services.ts +++ b/server/tests/api/videos/services.ts | |||
@@ -38,7 +38,7 @@ describe('Test services', function () { | |||
38 | 38 | ||
39 | expect(res.body.html).to.equal(expectedHtml) | 39 | expect(res.body.html).to.equal(expectedHtml) |
40 | expect(res.body.title).to.equal(server.video.name) | 40 | expect(res.body.title).to.equal(server.video.name) |
41 | expect(res.body.author_name).to.equal(server.video.accountName) | 41 | expect(res.body.author_name).to.equal(server.video.account.name) |
42 | expect(res.body.width).to.equal(560) | 42 | expect(res.body.width).to.equal(560) |
43 | expect(res.body.height).to.equal(315) | 43 | expect(res.body.height).to.equal(315) |
44 | expect(res.body.thumbnail_url).to.equal(expectedThumbnailUrl) | 44 | expect(res.body.thumbnail_url).to.equal(expectedThumbnailUrl) |
@@ -58,7 +58,7 @@ describe('Test services', function () { | |||
58 | 58 | ||
59 | expect(res.body.html).to.equal(expectedHtml) | 59 | expect(res.body.html).to.equal(expectedHtml) |
60 | expect(res.body.title).to.equal(server.video.name) | 60 | expect(res.body.title).to.equal(server.video.name) |
61 | expect(res.body.author_name).to.equal(server.video.accountName) | 61 | expect(res.body.author_name).to.equal(server.video.account.name) |
62 | expect(res.body.height).to.equal(50) | 62 | expect(res.body.height).to.equal(50) |
63 | expect(res.body.width).to.equal(50) | 63 | expect(res.body.width).to.equal(50) |
64 | expect(res.body).to.not.have.property('thumbnail_url') | 64 | expect(res.body).to.not.have.property('thumbnail_url') |
diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts index cf2721838..7c4bdf8bc 100644 --- a/server/tests/api/videos/single-server.ts +++ b/server/tests/api/videos/single-server.ts | |||
@@ -27,8 +27,10 @@ describe('Test a single server', function () { | |||
27 | nsfw: true, | 27 | nsfw: true, |
28 | description: 'my super description', | 28 | description: 'my super description', |
29 | support: 'my super support text', | 29 | support: 'my super support text', |
30 | host: 'localhost:9001', | 30 | account: { |
31 | account: 'root', | 31 | name: 'root', |
32 | host: 'localhost:9001' | ||
33 | }, | ||
32 | isLocal: true, | 34 | isLocal: true, |
33 | duration: 5, | 35 | duration: 5, |
34 | tags: [ 'tag1', 'tag2', 'tag3' ], | 36 | tags: [ 'tag1', 'tag2', 'tag3' ], |
@@ -56,8 +58,10 @@ describe('Test a single server', function () { | |||
56 | nsfw: false, | 58 | nsfw: false, |
57 | description: 'my super description updated', | 59 | description: 'my super description updated', |
58 | support: 'my super support text updated', | 60 | support: 'my super support text updated', |
59 | host: 'localhost:9001', | 61 | account: { |
60 | account: 'root', | 62 | name: 'root', |
63 | host: 'localhost:9001' | ||
64 | }, | ||
61 | isLocal: true, | 65 | isLocal: true, |
62 | tags: [ 'tagup1', 'tagup2' ], | 66 | tags: [ 'tagup1', 'tagup2' ], |
63 | privacy: VideoPrivacy.PUBLIC, | 67 | privacy: VideoPrivacy.PUBLIC, |
@@ -205,32 +209,6 @@ describe('Test a single server', function () { | |||
205 | }) | 209 | }) |
206 | 210 | ||
207 | // Not implemented yet | 211 | // Not implemented yet |
208 | // it('Should search the video by serverHost', async function () { | ||
209 | // const res = await videosUtils.searchVideo(server.url, '9001', 'host') | ||
210 | |||
211 | // expect(res.body.total).to.equal(1) | ||
212 | // expect(res.body.data).to.be.an('array') | ||
213 | // expect(res.body.data.length).to.equal(1) | ||
214 | |||
215 | // const video = res.body.data[0] | ||
216 | // expect(video.name).to.equal('my super name') | ||
217 | // expect(video.description).to.equal('my super description') | ||
218 | // expect(video.serverHost).to.equal('localhost:9001') | ||
219 | // expect(video.author).to.equal('root') | ||
220 | // expect(video.isLocal).to.be.true | ||
221 | // expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ]) | ||
222 | // expect(dateIsValid(video.createdAt)).to.be.true | ||
223 | // expect(dateIsValid(video.updatedAt)).to.be.true | ||
224 | |||
225 | // const test = await testVideoImage(server.url, 'video_short.webm', video.thumbnailPath) | ||
226 | // expect(test).to.equal(true) | ||
227 | |||
228 | // done() | ||
229 | // }) | ||
230 | // }) | ||
231 | // }) | ||
232 | |||
233 | // Not implemented yet | ||
234 | // it('Should search the video by tag', async function () { | 212 | // it('Should search the video by tag', async function () { |
235 | // const res = await searchVideo(server.url, 'tag1') | 213 | // const res = await searchVideo(server.url, 'tag1') |
236 | // | 214 | // |
@@ -248,8 +226,8 @@ describe('Test a single server', function () { | |||
248 | // expect(video.languageLabel).to.equal('Mandarin') | 226 | // expect(video.languageLabel).to.equal('Mandarin') |
249 | // expect(video.nsfw).to.be.ok | 227 | // expect(video.nsfw).to.be.ok |
250 | // expect(video.description).to.equal('my super description') | 228 | // expect(video.description).to.equal('my super description') |
251 | // expect(video.serverHost).to.equal('localhost:9001') | 229 | // expect(video.account.name).to.equal('root') |
252 | // expect(video.accountName).to.equal('root') | 230 | // expect(video.account.host).to.equal('localhost:9001') |
253 | // expect(video.isLocal).to.be.true | 231 | // expect(video.isLocal).to.be.true |
254 | // expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ]) | 232 | // expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ]) |
255 | // expect(dateIsValid(video.createdAt)).to.be.true | 233 | // expect(dateIsValid(video.createdAt)).to.be.true |
diff --git a/server/tests/utils/server/servers.ts b/server/tests/utils/server/servers.ts index 878efe91a..8373c73ab 100644 --- a/server/tests/utils/server/servers.ts +++ b/server/tests/utils/server/servers.ts | |||
@@ -24,7 +24,9 @@ interface ServerInfo { | |||
24 | id: number | 24 | id: number |
25 | uuid: string | 25 | uuid: string |
26 | name: string | 26 | name: string |
27 | accountName: string | 27 | account: { |
28 | name: string | ||
29 | } | ||
28 | } | 30 | } |
29 | 31 | ||
30 | remoteVideo?: { | 32 | remoteVideo?: { |
diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts index a06078d40..4b57f24b5 100644 --- a/server/tests/utils/videos/videos.ts +++ b/server/tests/utils/videos/videos.ts | |||
@@ -368,8 +368,10 @@ async function completeVideoCheck ( | |||
368 | commentsEnabled: boolean | 368 | commentsEnabled: boolean |
369 | description: string | 369 | description: string |
370 | support: string | 370 | support: string |
371 | host: string | 371 | account: { |
372 | account: string | 372 | name: string |
373 | host: string | ||
374 | } | ||
373 | isLocal: boolean, | 375 | isLocal: boolean, |
374 | tags: string[], | 376 | tags: string[], |
375 | privacy: number, | 377 | privacy: number, |
@@ -402,8 +404,8 @@ async function completeVideoCheck ( | |||
402 | expect(video.languageLabel).to.equal(VIDEO_LANGUAGES[attributes.language] || 'Unknown') | 404 | expect(video.languageLabel).to.equal(VIDEO_LANGUAGES[attributes.language] || 'Unknown') |
403 | expect(video.nsfw).to.equal(attributes.nsfw) | 405 | expect(video.nsfw).to.equal(attributes.nsfw) |
404 | expect(video.description).to.equal(attributes.description) | 406 | expect(video.description).to.equal(attributes.description) |
405 | expect(video.serverHost).to.equal(attributes.host) | 407 | expect(video.account.host).to.equal(attributes.account.host) |
406 | expect(video.accountName).to.equal(attributes.account) | 408 | expect(video.account.name).to.equal(attributes.account.name) |
407 | expect(video.likes).to.equal(attributes.likes) | 409 | expect(video.likes).to.equal(attributes.likes) |
408 | expect(video.dislikes).to.equal(attributes.dislikes) | 410 | expect(video.dislikes).to.equal(attributes.dislikes) |
409 | expect(video.isLocal).to.equal(attributes.isLocal) | 411 | expect(video.isLocal).to.equal(attributes.isLocal) |
@@ -433,12 +435,12 @@ async function completeVideoCheck ( | |||
433 | 435 | ||
434 | let extension = extname(attributes.fixture) | 436 | let extension = extname(attributes.fixture) |
435 | // Transcoding enabled on server 2, extension will always be .mp4 | 437 | // Transcoding enabled on server 2, extension will always be .mp4 |
436 | if (attributes.host === 'localhost:9002') extension = '.mp4' | 438 | if (attributes.account.host === 'localhost:9002') extension = '.mp4' |
437 | 439 | ||
438 | const magnetUri = file.magnetUri | 440 | const magnetUri = file.magnetUri |
439 | expect(file.magnetUri).to.have.lengthOf.above(2) | 441 | expect(file.magnetUri).to.have.lengthOf.above(2) |
440 | expect(file.torrentUrl).to.equal(`http://${attributes.host}/static/torrents/${videoDetails.uuid}-${file.resolution}.torrent`) | 442 | expect(file.torrentUrl).to.equal(`http://${attributes.account.host}/static/torrents/${videoDetails.uuid}-${file.resolution}.torrent`) |
441 | expect(file.fileUrl).to.equal(`http://${attributes.host}/static/webseed/${videoDetails.uuid}-${file.resolution}${extension}`) | 443 | expect(file.fileUrl).to.equal(`http://${attributes.account.host}/static/webseed/${videoDetails.uuid}-${file.resolution}${extension}`) |
442 | expect(file.resolution).to.equal(attributeFile.resolution) | 444 | expect(file.resolution).to.equal(attributeFile.resolution) |
443 | expect(file.resolutionLabel).to.equal(attributeFile.resolution + 'p') | 445 | expect(file.resolutionLabel).to.equal(attributeFile.resolution + 'p') |
444 | 446 | ||
diff --git a/shared/models/videos/video.model.ts b/shared/models/videos/video.model.ts index deb81da44..707cd42a7 100644 --- a/shared/models/videos/video.model.ts +++ b/shared/models/videos/video.model.ts | |||
@@ -1,4 +1,5 @@ | |||
1 | import { Account } from '../actors' | 1 | import { Account } from '../actors' |
2 | import { Avatar } from '../avatars/avatar.model' | ||
2 | import { VideoChannel } from './video-channel.model' | 3 | import { VideoChannel } from './video-channel.model' |
3 | import { VideoPrivacy } from './video-privacy.enum' | 4 | import { VideoPrivacy } from './video-privacy.enum' |
4 | 5 | ||
@@ -14,7 +15,6 @@ export interface VideoFile { | |||
14 | export interface Video { | 15 | export interface Video { |
15 | id: number | 16 | id: number |
16 | uuid: string | 17 | uuid: string |
17 | accountName: string | ||
18 | createdAt: Date | string | 18 | createdAt: Date | string |
19 | updatedAt: Date | string | 19 | updatedAt: Date | string |
20 | categoryLabel: string | 20 | categoryLabel: string |
@@ -27,7 +27,6 @@ export interface Video { | |||
27 | duration: number | 27 | duration: number |
28 | isLocal: boolean | 28 | isLocal: boolean |
29 | name: string | 29 | name: string |
30 | serverHost: string | ||
31 | thumbnailPath: string | 30 | thumbnailPath: string |
32 | previewPath: string | 31 | previewPath: string |
33 | embedPath: string | 32 | embedPath: string |
@@ -35,6 +34,14 @@ export interface Video { | |||
35 | likes: number | 34 | likes: number |
36 | dislikes: number | 35 | dislikes: number |
37 | nsfw: boolean | 36 | nsfw: boolean |
37 | |||
38 | account: { | ||
39 | name: string | ||
40 | displayName: string | ||
41 | url: string | ||
42 | host: string | ||
43 | avatar: Avatar | ||
44 | } | ||
38 | } | 45 | } |
39 | 46 | ||
40 | export interface VideoDetails extends Video { | 47 | export interface VideoDetails extends Video { |
diff --git a/support/doc/api/openapi.yaml b/support/doc/api/openapi.yaml index e8e593420..c67d8e477 100644 --- a/support/doc/api/openapi.yaml +++ b/support/doc/api/openapi.yaml | |||
@@ -1043,8 +1043,6 @@ definitions: | |||
1043 | type: number | 1043 | type: number |
1044 | uuid: | 1044 | uuid: |
1045 | type: string | 1045 | type: string |
1046 | accountName: | ||
1047 | type: string | ||
1048 | createdAt: | 1046 | createdAt: |
1049 | type: string | 1047 | type: string |
1050 | updatedAt: | 1048 | updatedAt: |
@@ -1069,8 +1067,6 @@ definitions: | |||
1069 | type: boolean | 1067 | type: boolean |
1070 | name: | 1068 | name: |
1071 | type: string | 1069 | type: string |
1072 | serverHost: | ||
1073 | type: string | ||
1074 | thumbnailPath: | 1070 | thumbnailPath: |
1075 | type: string | 1071 | type: string |
1076 | previewPath: | 1072 | previewPath: |
@@ -1085,6 +1081,13 @@ definitions: | |||
1085 | type: number | 1081 | type: number |
1086 | nsfw: | 1082 | nsfw: |
1087 | type: boolean | 1083 | type: boolean |
1084 | account: | ||
1085 | name: string | ||
1086 | displayName: string | ||
1087 | url: string | ||
1088 | host: string | ||
1089 | avatar: | ||
1090 | $ref: "#/definitions/Avatar" | ||
1088 | VideoAbuse: | 1091 | VideoAbuse: |
1089 | properties: | 1092 | properties: |
1090 | id: | 1093 | id: |
diff --git a/support/systemd/peertube.service b/support/systemd/peertube.service index 047ce7e56..346738159 100644 --- a/support/systemd/peertube.service +++ b/support/systemd/peertube.service | |||
@@ -1,6 +1,6 @@ | |||
1 | [Unit] | 1 | [Unit] |
2 | Description=PeerTube daemon | 2 | Description=PeerTube daemon |
3 | After=network.target | 3 | After=network.target postgresql.service |
4 | 4 | ||
5 | [Service] | 5 | [Service] |
6 | Type=simple | 6 | Type=simple |