aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared
diff options
context:
space:
mode:
Diffstat (limited to 'shared')
-rw-r--r--shared/core-utils/miscs/miscs.ts17
-rw-r--r--shared/core-utils/miscs/types.ts4
-rw-r--r--shared/core-utils/renderer/html.ts54
-rw-r--r--shared/extra-utils/custom-pages/custom-pages.ts31
-rw-r--r--shared/extra-utils/index.ts20
-rw-r--r--shared/extra-utils/miscs/email-child-process.js27
-rw-r--r--shared/extra-utils/miscs/email.ts39
-rw-r--r--shared/extra-utils/miscs/miscs.ts11
-rw-r--r--shared/extra-utils/plugins/mock-blocklist.ts6
-rw-r--r--shared/extra-utils/requests/requests.ts2
-rw-r--r--shared/extra-utils/search/video-playlists.ts36
-rw-r--r--shared/extra-utils/server/config.ts3
-rw-r--r--shared/extra-utils/server/plugins.ts4
-rw-r--r--shared/extra-utils/server/servers.ts4
-rw-r--r--shared/extra-utils/users/user-notifications.ts2
-rw-r--r--shared/extra-utils/videos/live.ts7
-rw-r--r--shared/extra-utils/videos/videos.ts13
-rw-r--r--shared/models/activitypub/objects/index.ts4
-rw-r--r--shared/models/actors/custom-page.model.ts3
-rw-r--r--shared/models/actors/index.ts1
-rw-r--r--shared/models/common/index.ts1
-rw-r--r--shared/models/common/result-list.model.ts (renamed from shared/models/result-list.model.ts)0
-rw-r--r--shared/models/custom-markup/custom-markup-data.model.ts54
-rw-r--r--shared/models/custom-markup/index.ts1
-rw-r--r--shared/models/index.ts13
-rw-r--r--shared/models/moderation/abuse/abuse-create.model.ts2
-rw-r--r--shared/models/nodeinfo/index.ts1
-rw-r--r--shared/models/nodeinfo/nodeinfo.model.ts (renamed from shared/models/nodeinfo/index.d.ts)0
-rw-r--r--shared/models/overviews/index.ts2
-rw-r--r--shared/models/overviews/videos-overview.model.ts (renamed from shared/models/overviews/videos-overview.ts)0
-rw-r--r--shared/models/plugins/client/client-hook.model.ts (renamed from shared/models/plugins/client-hook.model.ts)13
-rw-r--r--shared/models/plugins/client/index.ts6
-rw-r--r--shared/models/plugins/client/plugin-client-scope.type.ts (renamed from shared/models/plugins/plugin-client-scope.type.ts)0
-rw-r--r--shared/models/plugins/client/plugin-element-placeholder.type.ts (renamed from shared/models/plugins/plugin-element-placeholder.type.ts)0
-rw-r--r--shared/models/plugins/client/register-client-form-field.model.ts (renamed from shared/models/plugins/register-client-form-field.model.ts)0
-rw-r--r--shared/models/plugins/client/register-client-hook.model.ts (renamed from shared/models/plugins/register-client-hook.model.ts)0
-rw-r--r--shared/models/plugins/client/register-client-settings-script.model.ts (renamed from shared/models/plugins/register-client-settings-script.model.ts)2
-rw-r--r--shared/models/plugins/index.ts28
-rw-r--r--shared/models/plugins/plugin-index/index.ts3
-rw-r--r--shared/models/plugins/plugin-index/peertube-plugin-index-list.model.ts (renamed from shared/models/plugins/peertube-plugin-index-list.model.ts)2
-rw-r--r--shared/models/plugins/plugin-index/peertube-plugin-index.model.ts (renamed from shared/models/plugins/peertube-plugin-index.model.ts)0
-rw-r--r--shared/models/plugins/plugin-index/peertube-plugin-latest-version.model.ts (renamed from shared/models/plugins/peertube-plugin-latest-version.model.ts)0
-rw-r--r--shared/models/plugins/plugin-package-json.model.ts2
-rw-r--r--shared/models/plugins/server/api/index.ts3
-rw-r--r--shared/models/plugins/server/api/install-plugin.model.ts (renamed from shared/models/plugins/install-plugin.model.ts)0
-rw-r--r--shared/models/plugins/server/api/manage-plugin.model.ts (renamed from shared/models/plugins/manage-plugin.model.ts)0
-rw-r--r--shared/models/plugins/server/api/peertube-plugin.model.ts (renamed from shared/models/plugins/peertube-plugin.model.ts)2
-rw-r--r--shared/models/plugins/server/index.ts6
-rw-r--r--shared/models/plugins/server/managers/index.ts9
-rw-r--r--shared/models/plugins/server/managers/plugin-playlist-privacy-manager.model.ts (renamed from shared/models/plugins/plugin-playlist-privacy-manager.model.ts)2
-rw-r--r--shared/models/plugins/server/managers/plugin-settings-manager.model.ts (renamed from shared/models/plugins/plugin-settings-manager.model.ts)0
-rw-r--r--shared/models/plugins/server/managers/plugin-storage-manager.model.ts (renamed from shared/models/plugins/plugin-storage-manager.model.ts)0
-rw-r--r--shared/models/plugins/server/managers/plugin-transcoding-manager.model.ts (renamed from shared/models/plugins/plugin-transcoding-manager.model.ts)2
-rw-r--r--shared/models/plugins/server/managers/plugin-video-category-manager.model.ts (renamed from shared/models/plugins/plugin-video-category-manager.model.ts)0
-rw-r--r--shared/models/plugins/server/managers/plugin-video-language-manager.model.ts (renamed from shared/models/plugins/plugin-video-language-manager.model.ts)0
-rw-r--r--shared/models/plugins/server/managers/plugin-video-licence-manager.model.ts (renamed from shared/models/plugins/plugin-video-licence-manager.model.ts)0
-rw-r--r--shared/models/plugins/server/managers/plugin-video-privacy-manager.model.ts (renamed from shared/models/plugins/plugin-video-privacy-manager.model.ts)2
-rw-r--r--shared/models/plugins/server/plugin-translation.model.ts (renamed from shared/models/plugins/plugin-translation.model.ts)0
-rw-r--r--shared/models/plugins/server/register-server-hook.model.ts (renamed from shared/models/plugins/register-server-hook.model.ts)0
-rw-r--r--shared/models/plugins/server/server-hook.model.ts (renamed from shared/models/plugins/server-hook.model.ts)9
-rw-r--r--shared/models/plugins/server/settings/index.ts2
-rw-r--r--shared/models/plugins/server/settings/public-server.setting.ts (renamed from shared/models/plugins/public-server.setting.ts)0
-rw-r--r--shared/models/plugins/server/settings/register-server-setting.model.ts (renamed from shared/models/plugins/register-server-setting.model.ts)2
-rw-r--r--shared/models/redundancy/index.ts3
-rw-r--r--shared/models/search/index.ts3
-rw-r--r--shared/models/search/video-channels-search-query.model.ts2
-rw-r--r--shared/models/search/video-playlists-search-query.model.ts9
-rw-r--r--shared/models/server/custom-config.model.ts1
-rw-r--r--shared/models/server/index.ts1
-rw-r--r--shared/models/server/job.model.ts1
-rw-r--r--shared/models/server/peertube-problem-document.model.ts32
-rw-r--r--shared/models/server/server-config.model.ts7
-rw-r--r--shared/models/server/server-error-code.enum.ts73
-rw-r--r--shared/models/tokens/index.ts1
-rw-r--r--shared/models/tokens/oauth-client-local.model.ts (renamed from shared/models/oauth-client-local.model.ts)0
-rw-r--r--shared/models/users/user-right.enum.ts1
-rw-r--r--shared/models/videos/change-ownership/index.ts3
-rw-r--r--shared/models/videos/change-ownership/video-change-ownership-accept.model.ts (renamed from shared/models/videos/video-change-ownership-accept.model.ts)0
-rw-r--r--shared/models/videos/change-ownership/video-change-ownership-create.model.ts (renamed from shared/models/videos/video-change-ownership-create.model.ts)0
-rw-r--r--shared/models/videos/change-ownership/video-change-ownership.model.ts (renamed from shared/models/videos/video-change-ownership.model.ts)4
-rw-r--r--shared/models/videos/comment/index.ts1
-rw-r--r--shared/models/videos/comment/video-comment.model.ts (renamed from shared/models/videos/video-comment.model.ts)2
-rw-r--r--shared/models/videos/index.ts13
-rw-r--r--shared/models/videos/playlist/index.ts1
-rw-r--r--shared/models/videos/playlist/video-playlist-create-result.model.ts5
-rw-r--r--shared/models/videos/playlist/video-playlist.model.ts6
-rw-r--r--shared/models/videos/video-create-result.model.ts5
-rw-r--r--shared/models/videos/video-file-metadata.model.ts (renamed from shared/models/videos/video-file-metadata.ts)0
-rw-r--r--shared/models/videos/video-file.model.ts2
-rw-r--r--shared/models/videos/video.model.ts2
90 files changed, 492 insertions, 143 deletions
diff --git a/shared/core-utils/miscs/miscs.ts b/shared/core-utils/miscs/miscs.ts
index 71703faac..4780ca922 100644
--- a/shared/core-utils/miscs/miscs.ts
+++ b/shared/core-utils/miscs/miscs.ts
@@ -28,9 +28,24 @@ function isCatchable (value: any) {
28 return value && typeof value.catch === 'function' 28 return value && typeof value.catch === 'function'
29} 29}
30 30
31function sortObjectComparator (key: string, order: 'asc' | 'desc') {
32 return (a: any, b: any) => {
33 if (a[key] < b[key]) {
34 return order === 'asc' ? -1 : 1
35 }
36
37 if (a[key] > b[key]) {
38 return order === 'asc' ? 1 : -1
39 }
40
41 return 0
42 }
43}
44
31export { 45export {
32 randomInt, 46 randomInt,
33 compareSemVer, 47 compareSemVer,
34 isPromise, 48 isPromise,
35 isCatchable 49 isCatchable,
50 sortObjectComparator
36} 51}
diff --git a/shared/core-utils/miscs/types.ts b/shared/core-utils/miscs/types.ts
index bb64dc830..bd2a97b98 100644
--- a/shared/core-utils/miscs/types.ts
+++ b/shared/core-utils/miscs/types.ts
@@ -6,6 +6,10 @@ export type FunctionPropertyNames<T> = {
6 6
7export type FunctionProperties<T> = Pick<T, FunctionPropertyNames<T>> 7export type FunctionProperties<T> = Pick<T, FunctionPropertyNames<T>>
8 8
9export type AttributesOnly<T> = {
10 [K in keyof T]: T[K] extends Function ? never : T[K]
11}
12
9export type PickWith<T, KT extends keyof T, V> = { 13export type PickWith<T, KT extends keyof T, V> = {
10 [P in KT]: T[P] extends V ? V : never 14 [P in KT]: T[P] extends V ? V : never
11} 15}
diff --git a/shared/core-utils/renderer/html.ts b/shared/core-utils/renderer/html.ts
index de4ad47ac..c9757be85 100644
--- a/shared/core-utils/renderer/html.ts
+++ b/shared/core-utils/renderer/html.ts
@@ -1,25 +1,47 @@
1export const SANITIZE_OPTIONS = { 1export function getSanitizeOptions () {
2 allowedTags: [ 'a', 'p', 'span', 'br', 'strong', 'em', 'ul', 'ol', 'li' ], 2 return {
3 allowedSchemes: [ 'http', 'https' ], 3 allowedTags: [ 'a', 'p', 'span', 'br', 'strong', 'em', 'ul', 'ol', 'li' ],
4 allowedAttributes: { 4 allowedSchemes: [ 'http', 'https' ],
5 a: [ 'href', 'class', 'target', 'rel' ] 5 allowedAttributes: {
6 }, 6 'a': [ 'href', 'class', 'target', 'rel' ],
7 transformTags: { 7 '*': [ 'data-*' ]
8 a: (tagName: string, attribs: any) => { 8 },
9 let rel = 'noopener noreferrer' 9 transformTags: {
10 if (attribs.rel === 'me') rel += ' me' 10 a: (tagName: string, attribs: any) => {
11 let rel = 'noopener noreferrer'
12 if (attribs.rel === 'me') rel += ' me'
11 13
12 return { 14 return {
13 tagName, 15 tagName,
14 attribs: Object.assign(attribs, { 16 attribs: Object.assign(attribs, {
15 target: '_blank', 17 target: '_blank',
16 rel 18 rel
17 }) 19 })
20 }
18 } 21 }
19 } 22 }
20 } 23 }
21} 24}
22 25
26export function getCustomMarkupSanitizeOptions (additionalAllowedTags: string[] = []) {
27 const base = getSanitizeOptions()
28
29 return {
30 allowedTags: [
31 ...base.allowedTags,
32 ...additionalAllowedTags,
33 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img'
34 ],
35 allowedSchemes: base.allowedSchemes,
36 allowedAttributes: {
37 ...base.allowedAttributes,
38
39 'img': [ 'src', 'alt' ],
40 '*': [ 'data-*', 'style' ]
41 }
42 }
43}
44
23// Thanks: https://stackoverflow.com/a/12034334 45// Thanks: https://stackoverflow.com/a/12034334
24export function escapeHTML (stringParam: string) { 46export function escapeHTML (stringParam: string) {
25 if (!stringParam) return '' 47 if (!stringParam) return ''
diff --git a/shared/extra-utils/custom-pages/custom-pages.ts b/shared/extra-utils/custom-pages/custom-pages.ts
new file mode 100644
index 000000000..bf2d16c70
--- /dev/null
+++ b/shared/extra-utils/custom-pages/custom-pages.ts
@@ -0,0 +1,31 @@
1import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
2import { makeGetRequest, makePutBodyRequest } from '../requests/requests'
3
4function getInstanceHomepage (url: string, statusCodeExpected = HttpStatusCode.OK_200) {
5 const path = '/api/v1/custom-pages/homepage/instance'
6
7 return makeGetRequest({
8 url,
9 path,
10 statusCodeExpected
11 })
12}
13
14function updateInstanceHomepage (url: string, token: string, content: string) {
15 const path = '/api/v1/custom-pages/homepage/instance'
16
17 return makePutBodyRequest({
18 url,
19 path,
20 token,
21 fields: { content },
22 statusCodeExpected: HttpStatusCode.NO_CONTENT_204
23 })
24}
25
26// ---------------------------------------------------------------------------
27
28export {
29 getInstanceHomepage,
30 updateInstanceHomepage
31}
diff --git a/shared/extra-utils/index.ts b/shared/extra-utils/index.ts
index 898a92d43..87ee8abba 100644
--- a/shared/extra-utils/index.ts
+++ b/shared/extra-utils/index.ts
@@ -1,15 +1,28 @@
1export * from './bulk/bulk' 1export * from './bulk/bulk'
2
2export * from './cli/cli' 3export * from './cli/cli'
4
5export * from './custom-pages/custom-pages'
6
3export * from './feeds/feeds' 7export * from './feeds/feeds'
8
4export * from './mock-servers/mock-instances-index' 9export * from './mock-servers/mock-instances-index'
5export * from './miscs/miscs' 10
11export * from './miscs/email'
6export * from './miscs/sql' 12export * from './miscs/sql'
13export * from './miscs/miscs'
7export * from './miscs/stubs' 14export * from './miscs/stubs'
15
8export * from './moderation/abuses' 16export * from './moderation/abuses'
9export * from './plugins/mock-blocklist' 17export * from './plugins/mock-blocklist'
18
10export * from './requests/check-api-params' 19export * from './requests/check-api-params'
11export * from './requests/requests' 20export * from './requests/requests'
21
22export * from './search/video-channels'
23export * from './search/video-playlists'
12export * from './search/videos' 24export * from './search/videos'
25
13export * from './server/activitypub' 26export * from './server/activitypub'
14export * from './server/clients' 27export * from './server/clients'
15export * from './server/config' 28export * from './server/config'
@@ -18,9 +31,14 @@ export * from './server/follows'
18export * from './server/jobs' 31export * from './server/jobs'
19export * from './server/plugins' 32export * from './server/plugins'
20export * from './server/servers' 33export * from './server/servers'
34
21export * from './users/accounts' 35export * from './users/accounts'
36export * from './users/blocklist'
22export * from './users/login' 37export * from './users/login'
38export * from './users/user-notifications'
39export * from './users/user-subscriptions'
23export * from './users/users' 40export * from './users/users'
41
24export * from './videos/live' 42export * from './videos/live'
25export * from './videos/services' 43export * from './videos/services'
26export * from './videos/video-blacklist' 44export * from './videos/video-blacklist'
diff --git a/shared/extra-utils/miscs/email-child-process.js b/shared/extra-utils/miscs/email-child-process.js
deleted file mode 100644
index 088a5a08c..000000000
--- a/shared/extra-utils/miscs/email-child-process.js
+++ /dev/null
@@ -1,27 +0,0 @@
1const MailDev = require('maildev')
2
3// must run maildev as forked ChildProcess
4// failed instantiation stops main process with exit code 0
5process.on('message', (msg) => {
6 if (msg.start) {
7 const maildev = new MailDev({
8 ip: '127.0.0.1',
9 smtp: msg.port,
10 disableWeb: true,
11 silent: true
12 })
13
14 maildev.on('new', email => {
15 process.send({ email })
16 })
17
18 maildev.listen(err => {
19 if (err) {
20 // cannot send as Error object
21 return process.send({ err: err.message })
22 }
23
24 return process.send({ err: null })
25 })
26 }
27})
diff --git a/shared/extra-utils/miscs/email.ts b/shared/extra-utils/miscs/email.ts
index 758b15b58..9fc9a5ad0 100644
--- a/shared/extra-utils/miscs/email.ts
+++ b/shared/extra-utils/miscs/email.ts
@@ -1,8 +1,9 @@
1import { ChildProcess, fork } from 'child_process' 1import { ChildProcess } from 'child_process'
2import { join } from 'path'
3import { randomInt } from '../../core-utils/miscs/miscs' 2import { randomInt } from '../../core-utils/miscs/miscs'
4import { parallelTests } from '../server/servers' 3import { parallelTests } from '../server/servers'
5 4
5const MailDev = require('maildev')
6
6class MockSmtpServer { 7class MockSmtpServer {
7 8
8 private static instance: MockSmtpServer 9 private static instance: MockSmtpServer
@@ -10,38 +11,32 @@ class MockSmtpServer {
10 private emailChildProcess: ChildProcess 11 private emailChildProcess: ChildProcess
11 private emails: object[] 12 private emails: object[]
12 13
13 private constructor () { 14 private constructor () { }
14 this.emailChildProcess = fork(join(__dirname, 'email-child-process'), [])
15
16 this.emailChildProcess.on('message', (msg: any) => {
17 if (msg.email) {
18 return this.emails.push(msg.email)
19 }
20 })
21
22 process.on('exit', () => this.kill())
23 }
24 15
25 collectEmails (emailsCollection: object[]) { 16 collectEmails (emailsCollection: object[]) {
26 return new Promise<number>((res, rej) => { 17 return new Promise<number>((res, rej) => {
27 const port = parallelTests() ? randomInt(1000, 2000) : 1025 18 const port = parallelTests() ? randomInt(1000, 2000) : 1025
19 this.emails = emailsCollection
28 20
29 if (this.started) { 21 if (this.started) {
30 this.emails = emailsCollection
31 return res(undefined) 22 return res(undefined)
32 } 23 }
33 24
34 // ensure maildev isn't started until 25 const maildev = new MailDev({
35 // unexpected exit can be reported to test runner 26 ip: '127.0.0.1',
36 this.emailChildProcess.send({ start: true, port }) 27 smtp: port,
37 this.emailChildProcess.on('exit', () => { 28 disableWeb: true,
38 return rej(new Error('maildev exited unexpectedly, confirm port not in use')) 29 silent: true
30 })
31
32 maildev.on('new', email => {
33 this.emails.push(email)
39 }) 34 })
40 this.emailChildProcess.on('message', (msg: any) => { 35
41 if (msg.err) return rej(new Error(msg.err)) 36 maildev.listen(err => {
37 if (err) return rej(err)
42 38
43 this.started = true 39 this.started = true
44 this.emails = emailsCollection
45 40
46 return res(port) 41 return res(port)
47 }) 42 })
diff --git a/shared/extra-utils/miscs/miscs.ts b/shared/extra-utils/miscs/miscs.ts
index 1cb1cf440..462b914d4 100644
--- a/shared/extra-utils/miscs/miscs.ts
+++ b/shared/extra-utils/miscs/miscs.ts
@@ -60,8 +60,14 @@ async function testImage (url: string, imageName: string, imagePath: string, ext
60 const minLength = body.length - ((30 * body.length) / 100) 60 const minLength = body.length - ((30 * body.length) / 100)
61 const maxLength = body.length + ((30 * body.length) / 100) 61 const maxLength = body.length + ((30 * body.length) / 100)
62 62
63 expect(data.length).to.be.above(minLength, "the generated image is way smaller than the recorded fixture") 63 expect(data.length).to.be.above(minLength, 'the generated image is way smaller than the recorded fixture')
64 expect(data.length).to.be.below(maxLength, "the generated image is way larger than the recorded fixture") 64 expect(data.length).to.be.below(maxLength, 'the generated image is way larger than the recorded fixture')
65}
66
67async function testFileExistsOrNot (server: { internalServerNumber: number }, directory: string, filePath: string, exist: boolean) {
68 const base = buildServerDirectory(server, directory)
69
70 expect(await pathExists(join(base, filePath))).to.equal(exist)
65} 71}
66 72
67function isGithubCI () { 73function isGithubCI () {
@@ -157,6 +163,7 @@ export {
157 testImage, 163 testImage,
158 isGithubCI, 164 isGithubCI,
159 buildAbsoluteFixturePath, 165 buildAbsoluteFixturePath,
166 testFileExistsOrNot,
160 root, 167 root,
161 generateHighBitrateVideo, 168 generateHighBitrateVideo,
162 generateVideoWithFramerate 169 generateVideoWithFramerate
diff --git a/shared/extra-utils/plugins/mock-blocklist.ts b/shared/extra-utils/plugins/mock-blocklist.ts
index 50e2289f1..d18f8224f 100644
--- a/shared/extra-utils/plugins/mock-blocklist.ts
+++ b/shared/extra-utils/plugins/mock-blocklist.ts
@@ -1,5 +1,6 @@
1import * as express from 'express' 1import * as express from 'express'
2import { Server } from 'http' 2import { Server } from 'http'
3import { randomInt } from '@shared/core-utils'
3 4
4type BlocklistResponse = { 5type BlocklistResponse = {
5 data: { 6 data: {
@@ -14,14 +15,15 @@ export class MockBlocklist {
14 private server: Server 15 private server: Server
15 16
16 initialize () { 17 initialize () {
17 return new Promise<void>(res => { 18 return new Promise<number>(res => {
18 const app = express() 19 const app = express()
19 20
20 app.get('/blocklist', (req: express.Request, res: express.Response) => { 21 app.get('/blocklist', (req: express.Request, res: express.Response) => {
21 return res.json(this.body) 22 return res.json(this.body)
22 }) 23 })
23 24
24 this.server = app.listen(42100, () => res()) 25 const port = 42201 + randomInt(1, 100)
26 this.server = app.listen(port, () => res(port))
25 }) 27 })
26 } 28 }
27 29
diff --git a/shared/extra-utils/requests/requests.ts b/shared/extra-utils/requests/requests.ts
index 8b5cddf4a..38e24d897 100644
--- a/shared/extra-utils/requests/requests.ts
+++ b/shared/extra-utils/requests/requests.ts
@@ -26,6 +26,7 @@ function makeGetRequest (options: {
26 contentType?: string 26 contentType?: string
27 range?: string 27 range?: string
28 redirects?: number 28 redirects?: number
29 accept?: string
29}) { 30}) {
30 if (!options.statusCodeExpected) options.statusCodeExpected = HttpStatusCode.BAD_REQUEST_400 31 if (!options.statusCodeExpected) options.statusCodeExpected = HttpStatusCode.BAD_REQUEST_400
31 if (options.contentType === undefined) options.contentType = 'application/json' 32 if (options.contentType === undefined) options.contentType = 'application/json'
@@ -36,6 +37,7 @@ function makeGetRequest (options: {
36 if (options.token) req.set('Authorization', 'Bearer ' + options.token) 37 if (options.token) req.set('Authorization', 'Bearer ' + options.token)
37 if (options.query) req.query(options.query) 38 if (options.query) req.query(options.query)
38 if (options.range) req.set('Range', options.range) 39 if (options.range) req.set('Range', options.range)
40 if (options.accept) req.set('Accept', options.accept)
39 if (options.redirects) req.redirects(options.redirects) 41 if (options.redirects) req.redirects(options.redirects)
40 42
41 return req.expect(options.statusCodeExpected) 43 return req.expect(options.statusCodeExpected)
diff --git a/shared/extra-utils/search/video-playlists.ts b/shared/extra-utils/search/video-playlists.ts
new file mode 100644
index 000000000..c22831df7
--- /dev/null
+++ b/shared/extra-utils/search/video-playlists.ts
@@ -0,0 +1,36 @@
1import { VideoPlaylistsSearchQuery } from '@shared/models'
2import { HttpStatusCode } from '../../core-utils/miscs/http-error-codes'
3import { makeGetRequest } from '../requests/requests'
4
5function searchVideoPlaylists (url: string, search: string, token?: string, statusCodeExpected = HttpStatusCode.OK_200) {
6 const path = '/api/v1/search/video-playlists'
7
8 return makeGetRequest({
9 url,
10 path,
11 query: {
12 sort: '-createdAt',
13 search
14 },
15 token,
16 statusCodeExpected
17 })
18}
19
20function advancedVideoPlaylistSearch (url: string, search: VideoPlaylistsSearchQuery) {
21 const path = '/api/v1/search/video-playlists'
22
23 return makeGetRequest({
24 url,
25 path,
26 query: search,
27 statusCodeExpected: HttpStatusCode.OK_200
28 })
29}
30
31// ---------------------------------------------------------------------------
32
33export {
34 searchVideoPlaylists,
35 advancedVideoPlaylistSearch
36}
diff --git a/shared/extra-utils/server/config.ts b/shared/extra-utils/server/config.ts
index b70110852..9fcfb31fd 100644
--- a/shared/extra-utils/server/config.ts
+++ b/shared/extra-utils/server/config.ts
@@ -98,7 +98,8 @@ function updateCustomSubConfig (url: string, token: string, newConfig: DeepParti
98 signup: { 98 signup: {
99 enabled: false, 99 enabled: false,
100 limit: 5, 100 limit: 5,
101 requiresEmailVerification: false 101 requiresEmailVerification: false,
102 minimumAge: 16
102 }, 103 },
103 admin: { 104 admin: {
104 email: 'superadmin1@example.com' 105 email: 'superadmin1@example.com'
diff --git a/shared/extra-utils/server/plugins.ts b/shared/extra-utils/server/plugins.ts
index 864954ee7..d53e5b382 100644
--- a/shared/extra-utils/server/plugins.ts
+++ b/shared/extra-utils/server/plugins.ts
@@ -4,12 +4,12 @@ import { expect } from 'chai'
4import { readJSON, writeJSON } from 'fs-extra' 4import { readJSON, writeJSON } from 'fs-extra'
5import { join } from 'path' 5import { join } from 'path'
6import { RegisteredServerSettings } from '@shared/models' 6import { RegisteredServerSettings } from '@shared/models'
7import { PeertubePluginIndexList } from '../../models/plugins/peertube-plugin-index-list.model' 7import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
8import { PeertubePluginIndexList } from '../../models/plugins/plugin-index/peertube-plugin-index-list.model'
8import { PluginType } from '../../models/plugins/plugin.type' 9import { PluginType } from '../../models/plugins/plugin.type'
9import { buildServerDirectory, root } from '../miscs/miscs' 10import { buildServerDirectory, root } from '../miscs/miscs'
10import { makeGetRequest, makePostBodyRequest, makePutBodyRequest } from '../requests/requests' 11import { makeGetRequest, makePostBodyRequest, makePutBodyRequest } from '../requests/requests'
11import { ServerInfo } from './servers' 12import { ServerInfo } from './servers'
12import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
13 13
14function listPlugins (parameters: { 14function listPlugins (parameters: {
15 url: string 15 url: string
diff --git a/shared/extra-utils/server/servers.ts b/shared/extra-utils/server/servers.ts
index 479f08e12..28e431e94 100644
--- a/shared/extra-utils/server/servers.ts
+++ b/shared/extra-utils/server/servers.ts
@@ -43,11 +43,15 @@ interface ServerInfo {
43 video?: { 43 video?: {
44 id: number 44 id: number
45 uuid: string 45 uuid: string
46 shortUUID: string
46 name?: string 47 name?: string
47 url?: string 48 url?: string
49
48 account?: { 50 account?: {
49 name: string 51 name: string
50 } 52 }
53
54 embedPath?: string
51 } 55 }
52 56
53 remoteVideo?: { 57 remoteVideo?: {
diff --git a/shared/extra-utils/users/user-notifications.ts b/shared/extra-utils/users/user-notifications.ts
index 249e82925..844f4442d 100644
--- a/shared/extra-utils/users/user-notifications.ts
+++ b/shared/extra-utils/users/user-notifications.ts
@@ -431,7 +431,7 @@ async function checkNewCommentOnMyVideo (base: CheckerBaseParams, uuid: string,
431 } 431 }
432 } 432 }
433 433
434 const commentUrl = `http://localhost:${base.server.port}/videos/watch/${uuid};threadId=${threadId}` 434 const commentUrl = `http://localhost:${base.server.port}/w/${uuid};threadId=${threadId}`
435 435
436 function emailNotificationFinder (email: object) { 436 function emailNotificationFinder (email: object) {
437 return email['text'].indexOf(commentUrl) !== -1 437 return email['text'].indexOf(commentUrl) !== -1
diff --git a/shared/extra-utils/videos/live.ts b/shared/extra-utils/videos/live.ts
index d3cd974de..c0384769b 100644
--- a/shared/extra-utils/videos/live.ts
+++ b/shared/extra-utils/videos/live.ts
@@ -175,6 +175,12 @@ async function waitUntilLiveSaved (url: string, token: string, videoId: number |
175 } while (video.isLive === true && video.state.id !== VideoState.PUBLISHED) 175 } while (video.isLive === true && video.state.id !== VideoState.PUBLISHED)
176} 176}
177 177
178async function waitUntilLivePublishedOnAllServers (servers: ServerInfo[], videoId: string) {
179 for (const server of servers) {
180 await waitUntilLivePublished(server.url, server.accessToken, videoId)
181 }
182}
183
178async function checkLiveCleanup (server: ServerInfo, videoUUID: string, resolutions: number[] = []) { 184async function checkLiveCleanup (server: ServerInfo, videoUUID: string, resolutions: number[] = []) {
179 const basePath = buildServerDirectory(server, 'streaming-playlists') 185 const basePath = buildServerDirectory(server, 'streaming-playlists')
180 const hlsPath = join(basePath, 'hls', videoUUID) 186 const hlsPath = join(basePath, 'hls', videoUUID)
@@ -226,6 +232,7 @@ export {
226 sendRTMPStreamInVideo, 232 sendRTMPStreamInVideo,
227 waitUntilLiveEnded, 233 waitUntilLiveEnded,
228 waitFfmpegUntilError, 234 waitFfmpegUntilError,
235 waitUntilLivePublishedOnAllServers,
229 sendRTMPStream, 236 sendRTMPStream,
230 testFfmpegStreamError 237 testFfmpegStreamError
231} 238}
diff --git a/shared/extra-utils/videos/videos.ts b/shared/extra-utils/videos/videos.ts
index e88256ac0..469ea4d63 100644
--- a/shared/extra-utils/videos/videos.ts
+++ b/shared/extra-utils/videos/videos.ts
@@ -4,10 +4,11 @@ import { expect } from 'chai'
4import { createReadStream, pathExists, readdir, readFile, stat } from 'fs-extra' 4import { createReadStream, pathExists, readdir, readFile, stat } from 'fs-extra'
5import got, { Response as GotResponse } from 'got/dist/source' 5import got, { Response as GotResponse } from 'got/dist/source'
6import * as parseTorrent from 'parse-torrent' 6import * as parseTorrent from 'parse-torrent'
7import { extname, join } from 'path' 7import { join } from 'path'
8import * as request from 'supertest' 8import * as request from 'supertest'
9import { v4 as uuidv4 } from 'uuid'
10import validator from 'validator' 9import validator from 'validator'
10import { getLowercaseExtension } from '@server/helpers/core-utils'
11import { buildUUID } from '@server/helpers/uuid'
11import { HttpStatusCode } from '@shared/core-utils' 12import { HttpStatusCode } from '@shared/core-utils'
12import { VideosCommonQuery } from '@shared/models' 13import { VideosCommonQuery } from '@shared/models'
13import { loadLanguages, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES } from '../../../server/initializers/constants' 14import { loadLanguages, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES } from '../../../server/initializers/constants'
@@ -738,7 +739,7 @@ async function completeVideoCheck (
738 const file = videoDetails.files.find(f => f.resolution.id === attributeFile.resolution) 739 const file = videoDetails.files.find(f => f.resolution.id === attributeFile.resolution)
739 expect(file).not.to.be.undefined 740 expect(file).not.to.be.undefined
740 741
741 let extension = extname(attributes.fixture) 742 let extension = getLowercaseExtension(attributes.fixture)
742 // Transcoding enabled: extension will always be .mp4 743 // Transcoding enabled: extension will always be .mp4
743 if (attributes.files.length > 1) extension = '.mp4' 744 if (attributes.files.length > 1) extension = '.mp4'
744 745
@@ -774,9 +775,11 @@ async function completeVideoCheck (
774 expect(torrent.files[0].path).to.exist.and.to.not.equal('') 775 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
775 } 776 }
776 777
778 expect(videoDetails.thumbnailPath).to.exist
777 await testImage(url, attributes.thumbnailfile || attributes.fixture, videoDetails.thumbnailPath) 779 await testImage(url, attributes.thumbnailfile || attributes.fixture, videoDetails.thumbnailPath)
778 780
779 if (attributes.previewfile) { 781 if (attributes.previewfile) {
782 expect(videoDetails.previewPath).to.exist
780 await testImage(url, attributes.previewfile, videoDetails.previewPath) 783 await testImage(url, attributes.previewfile, videoDetails.previewPath)
781 } 784 }
782} 785}
@@ -803,7 +806,7 @@ async function uploadVideoAndGetId (options: {
803 806
804 const res = await uploadVideo(options.server.url, options.token || options.server.accessToken, videoAttrs) 807 const res = await uploadVideo(options.server.url, options.token || options.server.accessToken, videoAttrs)
805 808
806 return { id: res.body.video.id, uuid: res.body.video.uuid } 809 return res.body.video as { id: number, uuid: string, shortUUID: string }
807} 810}
808 811
809async function getLocalIdByUUID (url: string, uuid: string) { 812async function getLocalIdByUUID (url: string, uuid: string) {
@@ -824,7 +827,7 @@ async function uploadRandomVideoOnServers (servers: ServerInfo[], serverNumber:
824 827
825async function uploadRandomVideo (server: ServerInfo, wait = true, additionalParams: any = {}) { 828async function uploadRandomVideo (server: ServerInfo, wait = true, additionalParams: any = {}) {
826 const prefixName = additionalParams.prefixName || '' 829 const prefixName = additionalParams.prefixName || ''
827 const name = prefixName + uuidv4() 830 const name = prefixName + buildUUID()
828 831
829 const data = Object.assign({ name }, additionalParams) 832 const data = Object.assign({ name }, additionalParams)
830 const res = await uploadVideo(server.url, server.accessToken, data) 833 const res = await uploadVideo(server.url, server.accessToken, data)
diff --git a/shared/models/activitypub/objects/index.ts b/shared/models/activitypub/objects/index.ts
index a6a20e87a..9e2c6b728 100644
--- a/shared/models/activitypub/objects/index.ts
+++ b/shared/models/activitypub/objects/index.ts
@@ -2,5 +2,9 @@ export * from './abuse-object'
2export * from './cache-file-object' 2export * from './cache-file-object'
3export * from './common-objects' 3export * from './common-objects'
4export * from './dislike-object' 4export * from './dislike-object'
5export * from './object.model'
6export * from './playlist-element-object'
7export * from './playlist-object'
8export * from './video-comment-object'
5export * from './video-torrent-object' 9export * from './video-torrent-object'
6export * from './view-object' 10export * from './view-object'
diff --git a/shared/models/actors/custom-page.model.ts b/shared/models/actors/custom-page.model.ts
new file mode 100644
index 000000000..1e33584c1
--- /dev/null
+++ b/shared/models/actors/custom-page.model.ts
@@ -0,0 +1,3 @@
1export interface CustomPage {
2 content: string
3}
diff --git a/shared/models/actors/index.ts b/shared/models/actors/index.ts
index 156f83248..e03f168cd 100644
--- a/shared/models/actors/index.ts
+++ b/shared/models/actors/index.ts
@@ -2,4 +2,5 @@ export * from './account.model'
2export * from './actor-image.model' 2export * from './actor-image.model'
3export * from './actor-image.type' 3export * from './actor-image.type'
4export * from './actor.model' 4export * from './actor.model'
5export * from './custom-page.model'
5export * from './follow.model' 6export * from './follow.model'
diff --git a/shared/models/common/index.ts b/shared/models/common/index.ts
new file mode 100644
index 000000000..4db85eff2
--- /dev/null
+++ b/shared/models/common/index.ts
@@ -0,0 +1 @@
export * from './result-list.model'
diff --git a/shared/models/result-list.model.ts b/shared/models/common/result-list.model.ts
index fcafcfb2f..fcafcfb2f 100644
--- a/shared/models/result-list.model.ts
+++ b/shared/models/common/result-list.model.ts
diff --git a/shared/models/custom-markup/custom-markup-data.model.ts b/shared/models/custom-markup/custom-markup-data.model.ts
new file mode 100644
index 000000000..8cbe3cfa4
--- /dev/null
+++ b/shared/models/custom-markup/custom-markup-data.model.ts
@@ -0,0 +1,54 @@
1export type EmbedMarkupData = {
2 // Video or playlist uuid
3 uuid: string
4}
5
6export type VideoMiniatureMarkupData = {
7 // Video uuid
8 uuid: string
9
10 onlyDisplayTitle?: string // boolean
11}
12
13export type PlaylistMiniatureMarkupData = {
14 // Playlist uuid
15 uuid: string
16}
17
18export type ChannelMiniatureMarkupData = {
19 // Channel name (username)
20 name: string
21
22 displayLatestVideo?: string // boolean
23 displayDescription?: string // boolean
24}
25
26export type VideosListMarkupData = {
27 onlyDisplayTitle?: string // boolean
28 maxRows?: string // number
29
30 sort?: string
31 count?: string // number
32
33 categoryOneOf?: string // coma separated values, number[]
34 languageOneOf?: string // coma separated values
35
36 channelHandle?: string
37 accountHandle?: string
38
39 onlyLocal?: string // boolean
40}
41
42export type ButtonMarkupData = {
43 theme: 'primary' | 'secondary'
44 href: string
45 label: string
46 blankTarget?: string // boolean
47}
48
49export type ContainerMarkupData = {
50 width?: string
51 title?: string
52 description?: string
53 layout?: 'row' | 'column'
54}
diff --git a/shared/models/custom-markup/index.ts b/shared/models/custom-markup/index.ts
new file mode 100644
index 000000000..2898dfa90
--- /dev/null
+++ b/shared/models/custom-markup/index.ts
@@ -0,0 +1 @@
export * from './custom-markup-data.model'
diff --git a/shared/models/index.ts b/shared/models/index.ts
index dff5fdf0e..5c2bc480e 100644
--- a/shared/models/index.ts
+++ b/shared/models/index.ts
@@ -1,15 +1,16 @@
1export * from './activitypub' 1export * from './activitypub'
2export * from './actors' 2export * from './actors'
3export * from './moderation'
4export * from './bulk' 3export * from './bulk'
5export * from './redundancy' 4export * from './common'
6export * from './users' 5export * from './custom-markup'
7export * from './videos'
8export * from './feeds' 6export * from './feeds'
9export * from './joinpeertube' 7export * from './joinpeertube'
8export * from './moderation'
10export * from './overviews' 9export * from './overviews'
11export * from './plugins' 10export * from './plugins'
11export * from './redundancy'
12export * from './search' 12export * from './search'
13export * from './server' 13export * from './server'
14export * from './oauth-client-local.model' 14export * from './tokens'
15export * from './result-list.model' 15export * from './users'
16export * from './videos'
diff --git a/shared/models/moderation/abuse/abuse-create.model.ts b/shared/models/moderation/abuse/abuse-create.model.ts
index 0e7e9587f..7d35555c3 100644
--- a/shared/models/moderation/abuse/abuse-create.model.ts
+++ b/shared/models/moderation/abuse/abuse-create.model.ts
@@ -10,7 +10,7 @@ export interface AbuseCreate {
10 } 10 }
11 11
12 video?: { 12 video?: {
13 id: number 13 id: number | string
14 startAt?: number 14 startAt?: number
15 endAt?: number 15 endAt?: number
16 } 16 }
diff --git a/shared/models/nodeinfo/index.ts b/shared/models/nodeinfo/index.ts
new file mode 100644
index 000000000..faa64302a
--- /dev/null
+++ b/shared/models/nodeinfo/index.ts
@@ -0,0 +1 @@
export * from './nodeinfo.model'
diff --git a/shared/models/nodeinfo/index.d.ts b/shared/models/nodeinfo/nodeinfo.model.ts
index 336cb66d2..336cb66d2 100644
--- a/shared/models/nodeinfo/index.d.ts
+++ b/shared/models/nodeinfo/nodeinfo.model.ts
diff --git a/shared/models/overviews/index.ts b/shared/models/overviews/index.ts
index 376609efa..468507c6b 100644
--- a/shared/models/overviews/index.ts
+++ b/shared/models/overviews/index.ts
@@ -1 +1 @@
export * from './videos-overview' export * from './videos-overview.model'
diff --git a/shared/models/overviews/videos-overview.ts b/shared/models/overviews/videos-overview.model.ts
index 0f3cb4a52..0f3cb4a52 100644
--- a/shared/models/overviews/videos-overview.ts
+++ b/shared/models/overviews/videos-overview.model.ts
diff --git a/shared/models/plugins/client-hook.model.ts b/shared/models/plugins/client/client-hook.model.ts
index 620651051..cedd1be61 100644
--- a/shared/models/plugins/client-hook.model.ts
+++ b/shared/models/plugins/client/client-hook.model.ts
@@ -37,9 +37,12 @@ export const clientFilterHookObject = {
37 // Filter params/result of the function that fetch videos according to the user search 37 // Filter params/result of the function that fetch videos according to the user search
38 'filter:api.search.videos.list.params': true, 38 'filter:api.search.videos.list.params': true,
39 'filter:api.search.videos.list.result': true, 39 'filter:api.search.videos.list.result': true,
40 // Filter params/result of the function that fetch video-channels according to the user search 40 // Filter params/result of the function that fetch video channels according to the user search
41 'filter:api.search.video-channels.list.params': true, 41 'filter:api.search.video-channels.list.params': true,
42 'filter:api.search.video-channels.list.result': true, 42 'filter:api.search.video-channels.list.result': true,
43 // Filter params/result of the function that fetch video playlists according to the user search
44 'filter:api.search.video-playlists.list.params': true,
45 'filter:api.search.video-playlists.list.result': true,
43 46
44 // Filter form 47 // Filter form
45 'filter:api.signup.registration.create.params': true, 48 'filter:api.signup.registration.create.params': true,
@@ -50,7 +53,13 @@ export const clientFilterHookObject = {
50 53
51 // Filter our SVG icons content 54 // Filter our SVG icons content
52 'filter:internal.common.svg-icons.get-content.params': true, 55 'filter:internal.common.svg-icons.get-content.params': true,
53 'filter:internal.common.svg-icons.get-content.result': true 56 'filter:internal.common.svg-icons.get-content.result': true,
57
58 // Filter left menu links
59 'filter:left-menu.links.create.result': true,
60
61 // Filter videojs options built for PeerTube player
62 'filter:internal.player.videojs.options.result': true
54} 63}
55 64
56export type ClientFilterHookName = keyof typeof clientFilterHookObject 65export type ClientFilterHookName = keyof typeof clientFilterHookObject
diff --git a/shared/models/plugins/client/index.ts b/shared/models/plugins/client/index.ts
new file mode 100644
index 000000000..6dfc6351f
--- /dev/null
+++ b/shared/models/plugins/client/index.ts
@@ -0,0 +1,6 @@
1export * from './client-hook.model'
2export * from './plugin-client-scope.type'
3export * from './plugin-element-placeholder.type'
4export * from './register-client-form-field.model'
5export * from './register-client-hook.model'
6export * from './register-client-settings-script.model'
diff --git a/shared/models/plugins/plugin-client-scope.type.ts b/shared/models/plugins/client/plugin-client-scope.type.ts
index 8cc234ff2..8cc234ff2 100644
--- a/shared/models/plugins/plugin-client-scope.type.ts
+++ b/shared/models/plugins/client/plugin-client-scope.type.ts
diff --git a/shared/models/plugins/plugin-element-placeholder.type.ts b/shared/models/plugins/client/plugin-element-placeholder.type.ts
index 129099c62..129099c62 100644
--- a/shared/models/plugins/plugin-element-placeholder.type.ts
+++ b/shared/models/plugins/client/plugin-element-placeholder.type.ts
diff --git a/shared/models/plugins/register-client-form-field.model.ts b/shared/models/plugins/client/register-client-form-field.model.ts
index 2df071337..2df071337 100644
--- a/shared/models/plugins/register-client-form-field.model.ts
+++ b/shared/models/plugins/client/register-client-form-field.model.ts
diff --git a/shared/models/plugins/register-client-hook.model.ts b/shared/models/plugins/client/register-client-hook.model.ts
index 81047b21d..81047b21d 100644
--- a/shared/models/plugins/register-client-hook.model.ts
+++ b/shared/models/plugins/client/register-client-hook.model.ts
diff --git a/shared/models/plugins/register-client-settings-script.model.ts b/shared/models/plugins/client/register-client-settings-script.model.ts
index ac16af366..481ceef96 100644
--- a/shared/models/plugins/register-client-settings-script.model.ts
+++ b/shared/models/plugins/client/register-client-settings-script.model.ts
@@ -1,4 +1,4 @@
1import { RegisterServerSettingOptions } from "./register-server-setting.model" 1import { RegisterServerSettingOptions } from '../server'
2 2
3export interface RegisterClientSettingsScript { 3export interface RegisterClientSettingsScript {
4 isSettingHidden (options: { 4 isSettingHidden (options: {
diff --git a/shared/models/plugins/index.ts b/shared/models/plugins/index.ts
index 03b27f907..cbbe4916e 100644
--- a/shared/models/plugins/index.ts
+++ b/shared/models/plugins/index.ts
@@ -1,28 +1,6 @@
1export * from './client-hook.model' 1export * from './client'
2export * from './plugin-index'
3export * from './server'
2export * from './hook-type.enum' 4export * from './hook-type.enum'
3export * from './install-plugin.model'
4export * from './manage-plugin.model'
5export * from './peertube-plugin-index-list.model'
6export * from './peertube-plugin-index.model'
7export * from './peertube-plugin-latest-version.model'
8export * from './peertube-plugin.model'
9export * from './plugin-client-scope.type'
10export * from './plugin-element-placeholder.type'
11export * from './plugin-package-json.model' 5export * from './plugin-package-json.model'
12export * from './plugin-playlist-privacy-manager.model'
13export * from './plugin-settings-manager.model'
14export * from './plugin-storage-manager.model'
15export * from './plugin-transcoding-manager.model'
16export * from './plugin-translation.model'
17export * from './plugin-video-category-manager.model'
18export * from './plugin-video-language-manager.model'
19export * from './plugin-video-licence-manager.model'
20export * from './plugin-video-privacy-manager.model'
21export * from './plugin.type' 6export * from './plugin.type'
22export * from './public-server.setting'
23export * from './register-client-hook.model'
24export * from './register-client-settings-script.model'
25export * from './register-client-form-field.model'
26export * from './register-server-hook.model'
27export * from './register-server-setting.model'
28export * from './server-hook.model'
diff --git a/shared/models/plugins/plugin-index/index.ts b/shared/models/plugins/plugin-index/index.ts
new file mode 100644
index 000000000..913846638
--- /dev/null
+++ b/shared/models/plugins/plugin-index/index.ts
@@ -0,0 +1,3 @@
1export * from './peertube-plugin-index-list.model'
2export * from './peertube-plugin-index.model'
3export * from './peertube-plugin-latest-version.model'
diff --git a/shared/models/plugins/peertube-plugin-index-list.model.ts b/shared/models/plugins/plugin-index/peertube-plugin-index-list.model.ts
index 817bac31e..ecb46482e 100644
--- a/shared/models/plugins/peertube-plugin-index-list.model.ts
+++ b/shared/models/plugins/plugin-index/peertube-plugin-index-list.model.ts
@@ -1,4 +1,4 @@
1import { PluginType } from './plugin.type' 1import { PluginType } from '../plugin.type'
2 2
3export interface PeertubePluginIndexList { 3export interface PeertubePluginIndexList {
4 start: number 4 start: number
diff --git a/shared/models/plugins/peertube-plugin-index.model.ts b/shared/models/plugins/plugin-index/peertube-plugin-index.model.ts
index e91c8b4dc..e91c8b4dc 100644
--- a/shared/models/plugins/peertube-plugin-index.model.ts
+++ b/shared/models/plugins/plugin-index/peertube-plugin-index.model.ts
diff --git a/shared/models/plugins/peertube-plugin-latest-version.model.ts b/shared/models/plugins/plugin-index/peertube-plugin-latest-version.model.ts
index 811a64429..811a64429 100644
--- a/shared/models/plugins/peertube-plugin-latest-version.model.ts
+++ b/shared/models/plugins/plugin-index/peertube-plugin-latest-version.model.ts
diff --git a/shared/models/plugins/plugin-package-json.model.ts b/shared/models/plugins/plugin-package-json.model.ts
index c26e9ae5b..b2f92af80 100644
--- a/shared/models/plugins/plugin-package-json.model.ts
+++ b/shared/models/plugins/plugin-package-json.model.ts
@@ -1,4 +1,4 @@
1import { PluginClientScope } from './plugin-client-scope.type' 1import { PluginClientScope } from './client/plugin-client-scope.type'
2 2
3export type PluginTranslationPaths = { 3export type PluginTranslationPaths = {
4 [ locale: string ]: string 4 [ locale: string ]: string
diff --git a/shared/models/plugins/server/api/index.ts b/shared/models/plugins/server/api/index.ts
new file mode 100644
index 000000000..eb59a03f0
--- /dev/null
+++ b/shared/models/plugins/server/api/index.ts
@@ -0,0 +1,3 @@
1export * from './install-plugin.model'
2export * from './manage-plugin.model'
3export * from './peertube-plugin.model'
diff --git a/shared/models/plugins/install-plugin.model.ts b/shared/models/plugins/server/api/install-plugin.model.ts
index 5a268ebe1..5a268ebe1 100644
--- a/shared/models/plugins/install-plugin.model.ts
+++ b/shared/models/plugins/server/api/install-plugin.model.ts
diff --git a/shared/models/plugins/manage-plugin.model.ts b/shared/models/plugins/server/api/manage-plugin.model.ts
index 612b3056c..612b3056c 100644
--- a/shared/models/plugins/manage-plugin.model.ts
+++ b/shared/models/plugins/server/api/manage-plugin.model.ts
diff --git a/shared/models/plugins/peertube-plugin.model.ts b/shared/models/plugins/server/api/peertube-plugin.model.ts
index 2b0bb8cfa..54c383f57 100644
--- a/shared/models/plugins/peertube-plugin.model.ts
+++ b/shared/models/plugins/server/api/peertube-plugin.model.ts
@@ -1,4 +1,4 @@
1import { PluginType } from './plugin.type' 1import { PluginType } from '../../plugin.type'
2 2
3export interface PeerTubePlugin { 3export interface PeerTubePlugin {
4 name: string 4 name: string
diff --git a/shared/models/plugins/server/index.ts b/shared/models/plugins/server/index.ts
new file mode 100644
index 000000000..d3ff49d3b
--- /dev/null
+++ b/shared/models/plugins/server/index.ts
@@ -0,0 +1,6 @@
1export * from './api'
2export * from './managers'
3export * from './settings'
4export * from './plugin-translation.model'
5export * from './register-server-hook.model'
6export * from './server-hook.model'
diff --git a/shared/models/plugins/server/managers/index.ts b/shared/models/plugins/server/managers/index.ts
new file mode 100644
index 000000000..49365a854
--- /dev/null
+++ b/shared/models/plugins/server/managers/index.ts
@@ -0,0 +1,9 @@
1
2export * from './plugin-playlist-privacy-manager.model'
3export * from './plugin-settings-manager.model'
4export * from './plugin-storage-manager.model'
5export * from './plugin-transcoding-manager.model'
6export * from './plugin-video-category-manager.model'
7export * from './plugin-video-language-manager.model'
8export * from './plugin-video-licence-manager.model'
9export * from './plugin-video-privacy-manager.model'
diff --git a/shared/models/plugins/plugin-playlist-privacy-manager.model.ts b/shared/models/plugins/server/managers/plugin-playlist-privacy-manager.model.ts
index d1823ef4e..4703c0a8b 100644
--- a/shared/models/plugins/plugin-playlist-privacy-manager.model.ts
+++ b/shared/models/plugins/server/managers/plugin-playlist-privacy-manager.model.ts
@@ -1,4 +1,4 @@
1import { VideoPlaylistPrivacy } from '../videos/playlist/video-playlist-privacy.model' 1import { VideoPlaylistPrivacy } from '../../../videos/playlist/video-playlist-privacy.model'
2 2
3export interface PluginPlaylistPrivacyManager { 3export interface PluginPlaylistPrivacyManager {
4 // PUBLIC = 1, 4 // PUBLIC = 1,
diff --git a/shared/models/plugins/plugin-settings-manager.model.ts b/shared/models/plugins/server/managers/plugin-settings-manager.model.ts
index 3c28c0565..3c28c0565 100644
--- a/shared/models/plugins/plugin-settings-manager.model.ts
+++ b/shared/models/plugins/server/managers/plugin-settings-manager.model.ts
diff --git a/shared/models/plugins/plugin-storage-manager.model.ts b/shared/models/plugins/server/managers/plugin-storage-manager.model.ts
index 51567044a..51567044a 100644
--- a/shared/models/plugins/plugin-storage-manager.model.ts
+++ b/shared/models/plugins/server/managers/plugin-storage-manager.model.ts
diff --git a/shared/models/plugins/plugin-transcoding-manager.model.ts b/shared/models/plugins/server/managers/plugin-transcoding-manager.model.ts
index 8babccd4e..a0422a460 100644
--- a/shared/models/plugins/plugin-transcoding-manager.model.ts
+++ b/shared/models/plugins/server/managers/plugin-transcoding-manager.model.ts
@@ -1,4 +1,4 @@
1import { EncoderOptionsBuilder } from '../videos/video-transcoding.model' 1import { EncoderOptionsBuilder } from '../../../videos/video-transcoding.model'
2 2
3export interface PluginTranscodingManager { 3export interface PluginTranscodingManager {
4 addLiveProfile (encoder: string, profile: string, builder: EncoderOptionsBuilder): boolean 4 addLiveProfile (encoder: string, profile: string, builder: EncoderOptionsBuilder): boolean
diff --git a/shared/models/plugins/plugin-video-category-manager.model.ts b/shared/models/plugins/server/managers/plugin-video-category-manager.model.ts
index 201bfa979..201bfa979 100644
--- a/shared/models/plugins/plugin-video-category-manager.model.ts
+++ b/shared/models/plugins/server/managers/plugin-video-category-manager.model.ts
diff --git a/shared/models/plugins/plugin-video-language-manager.model.ts b/shared/models/plugins/server/managers/plugin-video-language-manager.model.ts
index 3fd577a79..3fd577a79 100644
--- a/shared/models/plugins/plugin-video-language-manager.model.ts
+++ b/shared/models/plugins/server/managers/plugin-video-language-manager.model.ts
diff --git a/shared/models/plugins/plugin-video-licence-manager.model.ts b/shared/models/plugins/server/managers/plugin-video-licence-manager.model.ts
index 82a634d3a..82a634d3a 100644
--- a/shared/models/plugins/plugin-video-licence-manager.model.ts
+++ b/shared/models/plugins/server/managers/plugin-video-licence-manager.model.ts
diff --git a/shared/models/plugins/plugin-video-privacy-manager.model.ts b/shared/models/plugins/server/managers/plugin-video-privacy-manager.model.ts
index 3ada99608..7717115e3 100644
--- a/shared/models/plugins/plugin-video-privacy-manager.model.ts
+++ b/shared/models/plugins/server/managers/plugin-video-privacy-manager.model.ts
@@ -1,4 +1,4 @@
1import { VideoPrivacy } from '../videos/video-privacy.enum' 1import { VideoPrivacy } from '../../../videos/video-privacy.enum'
2 2
3export interface PluginVideoPrivacyManager { 3export interface PluginVideoPrivacyManager {
4 // PUBLIC = 1 4 // PUBLIC = 1
diff --git a/shared/models/plugins/plugin-translation.model.ts b/shared/models/plugins/server/plugin-translation.model.ts
index a2dd8e560..a2dd8e560 100644
--- a/shared/models/plugins/plugin-translation.model.ts
+++ b/shared/models/plugins/server/plugin-translation.model.ts
diff --git a/shared/models/plugins/register-server-hook.model.ts b/shared/models/plugins/server/register-server-hook.model.ts
index 746fdc329..746fdc329 100644
--- a/shared/models/plugins/register-server-hook.model.ts
+++ b/shared/models/plugins/server/register-server-hook.model.ts
diff --git a/shared/models/plugins/server-hook.model.ts b/shared/models/plugins/server/server-hook.model.ts
index 88277af5a..5f29534b5 100644
--- a/shared/models/plugins/server-hook.model.ts
+++ b/shared/models/plugins/server/server-hook.model.ts
@@ -27,6 +27,10 @@ export const serverFilterHookObject = {
27 'filter:api.search.video-channels.local.list.result': true, 27 'filter:api.search.video-channels.local.list.result': true,
28 'filter:api.search.video-channels.index.list.params': true, 28 'filter:api.search.video-channels.index.list.params': true,
29 'filter:api.search.video-channels.index.list.result': true, 29 'filter:api.search.video-channels.index.list.result': true,
30 'filter:api.search.video-playlists.local.list.params': true,
31 'filter:api.search.video-playlists.local.list.result': true,
32 'filter:api.search.video-playlists.index.list.params': true,
33 'filter:api.search.video-playlists.index.list.result': true,
30 34
31 // Filter the result of the get function 35 // Filter the result of the get function
32 // Used to get detailed video information (video watch page for example) 36 // Used to get detailed video information (video watch page for example)
@@ -110,7 +114,10 @@ export const serverActionHookObject = {
110 'action:api.user.updated': true, 114 'action:api.user.updated': true,
111 115
112 // Fired when a user got a new oauth2 token 116 // Fired when a user got a new oauth2 token
113 'action:api.user.oauth2-got-token': true 117 'action:api.user.oauth2-got-token': true,
118
119 // Fired when a video is added to a playlist
120 'action:api.video-playlist-element.created': true
114} 121}
115 122
116export type ServerActionHookName = keyof typeof serverActionHookObject 123export type ServerActionHookName = keyof typeof serverActionHookObject
diff --git a/shared/models/plugins/server/settings/index.ts b/shared/models/plugins/server/settings/index.ts
new file mode 100644
index 000000000..b456de019
--- /dev/null
+++ b/shared/models/plugins/server/settings/index.ts
@@ -0,0 +1,2 @@
1export * from './public-server.setting'
2export * from './register-server-setting.model'
diff --git a/shared/models/plugins/public-server.setting.ts b/shared/models/plugins/server/settings/public-server.setting.ts
index 9802c4d7d..9802c4d7d 100644
--- a/shared/models/plugins/public-server.setting.ts
+++ b/shared/models/plugins/server/settings/public-server.setting.ts
diff --git a/shared/models/plugins/register-server-setting.model.ts b/shared/models/plugins/server/settings/register-server-setting.model.ts
index 9f45c3c37..d9a798cac 100644
--- a/shared/models/plugins/register-server-setting.model.ts
+++ b/shared/models/plugins/server/settings/register-server-setting.model.ts
@@ -1,4 +1,4 @@
1import { RegisterClientFormFieldOptions } from './register-client-form-field.model' 1import { RegisterClientFormFieldOptions } from '../../client'
2 2
3export type RegisterServerSettingOptions = RegisterClientFormFieldOptions & { 3export type RegisterServerSettingOptions = RegisterClientFormFieldOptions & {
4 // If the setting is not private, anyone can view its value (client code included) 4 // If the setting is not private, anyone can view its value (client code included)
diff --git a/shared/models/redundancy/index.ts b/shared/models/redundancy/index.ts
index 649cc489f..641a5d625 100644
--- a/shared/models/redundancy/index.ts
+++ b/shared/models/redundancy/index.ts
@@ -1,3 +1,4 @@
1export * from './videos-redundancy-strategy.model'
2export * from './video-redundancies-filters.model' 1export * from './video-redundancies-filters.model'
2export * from './video-redundancy-config-filter.type'
3export * from './video-redundancy.model' 3export * from './video-redundancy.model'
4export * from './videos-redundancy-strategy.model'
diff --git a/shared/models/search/index.ts b/shared/models/search/index.ts
index 697ceccb1..50aeeddc8 100644
--- a/shared/models/search/index.ts
+++ b/shared/models/search/index.ts
@@ -1,5 +1,6 @@
1export * from './boolean-both-query.model' 1export * from './boolean-both-query.model'
2export * from './search-target-query.model' 2export * from './search-target-query.model'
3export * from './videos-common-query.model' 3export * from './videos-common-query.model'
4export * from './videos-search-query.model'
5export * from './video-channels-search-query.model' 4export * from './video-channels-search-query.model'
5export * from './video-playlists-search-query.model'
6export * from './videos-search-query.model'
diff --git a/shared/models/search/video-channels-search-query.model.ts b/shared/models/search/video-channels-search-query.model.ts
index c96aa8c1d..8f93c4bd5 100644
--- a/shared/models/search/video-channels-search-query.model.ts
+++ b/shared/models/search/video-channels-search-query.model.ts
@@ -1,4 +1,4 @@
1import { SearchTargetQuery } from "./search-target-query.model" 1import { SearchTargetQuery } from './search-target-query.model'
2 2
3export interface VideoChannelsSearchQuery extends SearchTargetQuery { 3export interface VideoChannelsSearchQuery extends SearchTargetQuery {
4 search: string 4 search: string
diff --git a/shared/models/search/video-playlists-search-query.model.ts b/shared/models/search/video-playlists-search-query.model.ts
new file mode 100644
index 000000000..31f05218e
--- /dev/null
+++ b/shared/models/search/video-playlists-search-query.model.ts
@@ -0,0 +1,9 @@
1import { SearchTargetQuery } from './search-target-query.model'
2
3export interface VideoPlaylistsSearchQuery extends SearchTargetQuery {
4 search: string
5
6 start?: number
7 count?: number
8 sort?: string
9}
diff --git a/shared/models/server/custom-config.model.ts b/shared/models/server/custom-config.model.ts
index 0bccd63e3..75d04423a 100644
--- a/shared/models/server/custom-config.model.ts
+++ b/shared/models/server/custom-config.model.ts
@@ -69,6 +69,7 @@ export interface CustomConfig {
69 enabled: boolean 69 enabled: boolean
70 limit: number 70 limit: number
71 requiresEmailVerification: boolean 71 requiresEmailVerification: boolean
72 minimumAge: number
72 } 73 }
73 74
74 admin: { 75 admin: {
diff --git a/shared/models/server/index.ts b/shared/models/server/index.ts
index b5163954a..06bf5c599 100644
--- a/shared/models/server/index.ts
+++ b/shared/models/server/index.ts
@@ -6,6 +6,7 @@ export * from './debug.model'
6export * from './emailer.model' 6export * from './emailer.model'
7export * from './job.model' 7export * from './job.model'
8export * from './log-level.type' 8export * from './log-level.type'
9export * from './peertube-problem-document.model'
9export * from './server-config.model' 10export * from './server-config.model'
10export * from './server-debug.model' 11export * from './server-debug.model'
11export * from './server-error-code.enum' 12export * from './server-error-code.enum'
diff --git a/shared/models/server/job.model.ts b/shared/models/server/job.model.ts
index e4acfee8d..4ab249e0b 100644
--- a/shared/models/server/job.model.ts
+++ b/shared/models/server/job.model.ts
@@ -53,7 +53,6 @@ export type ActivitypubHttpFetcherPayload = {
53 uri: string 53 uri: string
54 type: FetchType 54 type: FetchType
55 videoId?: number 55 videoId?: number
56 accountId?: number
57} 56}
58 57
59export type ActivitypubHttpUnicastPayload = { 58export type ActivitypubHttpUnicastPayload = {
diff --git a/shared/models/server/peertube-problem-document.model.ts b/shared/models/server/peertube-problem-document.model.ts
new file mode 100644
index 000000000..e391d5aad
--- /dev/null
+++ b/shared/models/server/peertube-problem-document.model.ts
@@ -0,0 +1,32 @@
1import { HttpStatusCode } from '../../core-utils'
2import { OAuth2ErrorCode, ServerErrorCode } from './server-error-code.enum'
3
4export interface PeerTubeProblemDocumentData {
5 'invalid-params'?: Record<string, Object>
6
7 originUrl?: string
8
9 keyId?: string
10
11 targetUrl?: string
12
13 actorUrl?: string
14
15 // Feeds
16 format?: string
17 url?: string
18}
19
20export interface PeerTubeProblemDocument extends PeerTubeProblemDocumentData {
21 type: string
22 title: string
23
24 detail: string
25 // Compat PeerTube <= 3.2
26 error: string
27
28 status: HttpStatusCode
29
30 docs?: string
31 code?: ServerErrorCode | OAuth2ErrorCode
32}
diff --git a/shared/models/server/server-config.model.ts b/shared/models/server/server-config.model.ts
index 85d84af44..585e99aca 100644
--- a/shared/models/server/server-config.model.ts
+++ b/shared/models/server/server-config.model.ts
@@ -84,6 +84,7 @@ export interface ServerConfig {
84 allowed: boolean 84 allowed: boolean
85 allowedForCurrentIP: boolean 85 allowedForCurrentIP: boolean
86 requiresEmailVerification: boolean 86 requiresEmailVerification: boolean
87 minimumAge: number
87 } 88 }
88 89
89 transcoding: { 90 transcoding: {
@@ -214,4 +215,10 @@ export interface ServerConfig {
214 level: BroadcastMessageLevel 215 level: BroadcastMessageLevel
215 dismissable: boolean 216 dismissable: boolean
216 } 217 }
218
219 homepage: {
220 enabled: boolean
221 }
217} 222}
223
224export type HTMLServerConfig = Omit<ServerConfig, 'signup'>
diff --git a/shared/models/server/server-error-code.enum.ts b/shared/models/server/server-error-code.enum.ts
index c02b0e6c7..115421d4d 100644
--- a/shared/models/server/server-error-code.enum.ts
+++ b/shared/models/server/server-error-code.enum.ts
@@ -1,5 +1,72 @@
1export const enum ServerErrorCode { 1export const enum ServerErrorCode {
2 DOES_NOT_RESPECT_FOLLOW_CONSTRAINTS = 1, 2 /**
3 MAX_INSTANCE_LIVES_LIMIT_REACHED = 2, 3 * The simplest form of payload too large: when the file size is over the
4 MAX_USER_LIVES_LIMIT_REACHED = 3, 4 * global file size limit
5 */
6 MAX_FILE_SIZE_REACHED = 'max_file_size_reached',
7
8 /**
9 * The payload is too large for the user quota set
10 */
11 QUOTA_REACHED = 'quota_reached',
12
13 /**
14 * Error yielded upon trying to access a video that is not federated, nor can
15 * be. This may be due to: remote videos on instances that are not followed by
16 * yours, and with your instance disallowing unknown instances being accessed.
17 */
18 DOES_NOT_RESPECT_FOLLOW_CONSTRAINTS = 'does_not_respect_follow_constraints',
19
20 LIVE_NOT_ENABLED = 'live_not_enabled',
21 LIVE_NOT_ALLOWING_REPLAY = 'live_not_allowing_replay',
22 LIVE_CONFLICTING_PERMANENT_AND_SAVE_REPLAY = 'live_conflicting_permanent_and_save_replay',
23 /**
24 * Pretty self-explanatory: the set maximum number of simultaneous lives was
25 * reached, and this error is typically there to inform the user trying to
26 * broadcast one.
27 */
28 MAX_INSTANCE_LIVES_LIMIT_REACHED = 'max_instance_lives_limit_reached',
29 /**
30 * Pretty self-explanatory: the set maximum number of simultaneous lives FOR
31 * THIS USER was reached, and this error is typically there to inform the user
32 * trying to broadcast one.
33 */
34 MAX_USER_LIVES_LIMIT_REACHED = 'max_user_lives_limit_reached',
35
36 /**
37 * A torrent should have at most one correct video file. Any more and we will
38 * not be able to choose automatically.
39 */
40 INCORRECT_FILES_IN_TORRENT = 'incorrect_files_in_torrent'
41}
42
43/**
44 * oauthjs/oauth2-server error codes
45 * @see https://datatracker.ietf.org/doc/html/rfc6749#section-5.2
46 **/
47export const enum OAuth2ErrorCode {
48 /**
49 * The provided authorization grant (e.g., authorization code, resource owner
50 * credentials) or refresh token is invalid, expired, revoked, does not match
51 * the redirection URI used in the authorization request, or was issued to
52 * another client.
53 *
54 * @see https://github.com/oauthjs/node-oauth2-server/blob/master/lib/errors/invalid-grant-error.js
55 */
56 INVALID_GRANT = 'invalid_grant',
57
58 /**
59 * Client authentication failed (e.g., unknown client, no client authentication
60 * included, or unsupported authentication method).
61 *
62 * @see https://github.com/oauthjs/node-oauth2-server/blob/master/lib/errors/invalid-client-error.js
63 */
64 INVALID_CLIENT = 'invalid_client',
65
66 /**
67 * The access token provided is expired, revoked, malformed, or invalid for other reasons
68 *
69 * @see https://github.com/oauthjs/node-oauth2-server/blob/master/lib/errors/invalid-token-error.js
70 */
71 INVALID_TOKEN = 'invalid_token',
5} 72}
diff --git a/shared/models/tokens/index.ts b/shared/models/tokens/index.ts
new file mode 100644
index 000000000..fe130f153
--- /dev/null
+++ b/shared/models/tokens/index.ts
@@ -0,0 +1 @@
export * from './oauth-client-local.model'
diff --git a/shared/models/oauth-client-local.model.ts b/shared/models/tokens/oauth-client-local.model.ts
index 0c6ce6c5d..0c6ce6c5d 100644
--- a/shared/models/oauth-client-local.model.ts
+++ b/shared/models/tokens/oauth-client-local.model.ts
diff --git a/shared/models/users/user-right.enum.ts b/shared/models/users/user-right.enum.ts
index bbedc9f00..950b22bad 100644
--- a/shared/models/users/user-right.enum.ts
+++ b/shared/models/users/user-right.enum.ts
@@ -16,6 +16,7 @@ export const enum UserRight {
16 MANAGE_JOBS, 16 MANAGE_JOBS,
17 17
18 MANAGE_CONFIGURATION, 18 MANAGE_CONFIGURATION,
19 MANAGE_INSTANCE_CUSTOM_PAGE,
19 20
20 MANAGE_ACCOUNTS_BLOCKLIST, 21 MANAGE_ACCOUNTS_BLOCKLIST,
21 MANAGE_SERVERS_BLOCKLIST, 22 MANAGE_SERVERS_BLOCKLIST,
diff --git a/shared/models/videos/change-ownership/index.ts b/shared/models/videos/change-ownership/index.ts
new file mode 100644
index 000000000..a942fb2cd
--- /dev/null
+++ b/shared/models/videos/change-ownership/index.ts
@@ -0,0 +1,3 @@
1export * from './video-change-ownership-accept.model'
2export * from './video-change-ownership-create.model'
3export * from './video-change-ownership.model'
diff --git a/shared/models/videos/video-change-ownership-accept.model.ts b/shared/models/videos/change-ownership/video-change-ownership-accept.model.ts
index f27247633..f27247633 100644
--- a/shared/models/videos/video-change-ownership-accept.model.ts
+++ b/shared/models/videos/change-ownership/video-change-ownership-accept.model.ts
diff --git a/shared/models/videos/video-change-ownership-create.model.ts b/shared/models/videos/change-ownership/video-change-ownership-create.model.ts
index 40fcca285..40fcca285 100644
--- a/shared/models/videos/video-change-ownership-create.model.ts
+++ b/shared/models/videos/change-ownership/video-change-ownership-create.model.ts
diff --git a/shared/models/videos/video-change-ownership.model.ts b/shared/models/videos/change-ownership/video-change-ownership.model.ts
index 669c7f3e7..3d31cad0a 100644
--- a/shared/models/videos/video-change-ownership.model.ts
+++ b/shared/models/videos/change-ownership/video-change-ownership.model.ts
@@ -1,5 +1,5 @@
1import { Account } from '../actors' 1import { Account } from '../../actors'
2import { Video } from './video.model' 2import { Video } from '../video.model'
3 3
4export interface VideoChangeOwnership { 4export interface VideoChangeOwnership {
5 id: number 5 id: number
diff --git a/shared/models/videos/comment/index.ts b/shared/models/videos/comment/index.ts
new file mode 100644
index 000000000..7b9261a36
--- /dev/null
+++ b/shared/models/videos/comment/index.ts
@@ -0,0 +1 @@
export * from './video-comment.model'
diff --git a/shared/models/videos/video-comment.model.ts b/shared/models/videos/comment/video-comment.model.ts
index 9730a3f76..79c0e4c0a 100644
--- a/shared/models/videos/video-comment.model.ts
+++ b/shared/models/videos/comment/video-comment.model.ts
@@ -1,4 +1,4 @@
1import { Account } from '../actors' 1import { Account } from '../../actors'
2 2
3export interface VideoComment { 3export interface VideoComment {
4 id: number 4 id: number
diff --git a/shared/models/videos/index.ts b/shared/models/videos/index.ts
index fac3e0b2f..faa9b9868 100644
--- a/shared/models/videos/index.ts
+++ b/shared/models/videos/index.ts
@@ -1,6 +1,8 @@
1export * from './blacklist' 1export * from './blacklist'
2export * from './caption' 2export * from './caption'
3export * from './change-ownership'
3export * from './channel' 4export * from './channel'
5export * from './comment'
4export * from './live' 6export * from './live'
5export * from './import' 7export * from './import'
6export * from './playlist' 8export * from './playlist'
@@ -10,17 +12,11 @@ export * from './nsfw-policy.type'
10 12
11export * from './thumbnail.type' 13export * from './thumbnail.type'
12 14
13export * from './video-change-ownership-accept.model'
14export * from './video-change-ownership-create.model'
15export * from './video-change-ownership.model'
16
17export * from './video-comment.model'
18export * from './video-constant.model' 15export * from './video-constant.model'
19export * from './video-create.model' 16export * from './video-create.model'
20export * from './video-file-metadata'
21export * from './video-file.model'
22 17
23export * from './live/live-video.model' 18export * from './video-file-metadata.model'
19export * from './video-file.model'
24 20
25export * from './video-privacy.enum' 21export * from './video-privacy.enum'
26export * from './video-query.type' 22export * from './video-query.type'
@@ -39,3 +35,4 @@ export * from './video-transcoding-fps.model'
39 35
40export * from './video-update.model' 36export * from './video-update.model'
41export * from './video.model' 37export * from './video.model'
38export * from './video-create-result.model'
diff --git a/shared/models/videos/playlist/index.ts b/shared/models/videos/playlist/index.ts
index 99f7e9bab..f11a4bd28 100644
--- a/shared/models/videos/playlist/index.ts
+++ b/shared/models/videos/playlist/index.ts
@@ -1,4 +1,5 @@
1export * from './video-exist-in-playlist.model' 1export * from './video-exist-in-playlist.model'
2export * from './video-playlist-create-result.model'
2export * from './video-playlist-create.model' 3export * from './video-playlist-create.model'
3export * from './video-playlist-element-create.model' 4export * from './video-playlist-element-create.model'
4export * from './video-playlist-element-update.model' 5export * from './video-playlist-element-update.model'
diff --git a/shared/models/videos/playlist/video-playlist-create-result.model.ts b/shared/models/videos/playlist/video-playlist-create-result.model.ts
new file mode 100644
index 000000000..cd9b170ae
--- /dev/null
+++ b/shared/models/videos/playlist/video-playlist-create-result.model.ts
@@ -0,0 +1,5 @@
1export interface VideoPlaylistCreateResult {
2 id: number
3 uuid: string
4 shortUUID: string
5}
diff --git a/shared/models/videos/playlist/video-playlist.model.ts b/shared/models/videos/playlist/video-playlist.model.ts
index f45d0ff88..b8a9955d9 100644
--- a/shared/models/videos/playlist/video-playlist.model.ts
+++ b/shared/models/videos/playlist/video-playlist.model.ts
@@ -6,19 +6,25 @@ import { VideoPlaylistType } from './video-playlist-type.model'
6export interface VideoPlaylist { 6export interface VideoPlaylist {
7 id: number 7 id: number
8 uuid: string 8 uuid: string
9 shortUUID: string
10
9 isLocal: boolean 11 isLocal: boolean
10 12
13 url: string
14
11 displayName: string 15 displayName: string
12 description: string 16 description: string
13 privacy: VideoConstant<VideoPlaylistPrivacy> 17 privacy: VideoConstant<VideoPlaylistPrivacy>
14 18
15 thumbnailPath: string 19 thumbnailPath: string
20 thumbnailUrl?: string
16 21
17 videosLength: number 22 videosLength: number
18 23
19 type: VideoConstant<VideoPlaylistType> 24 type: VideoConstant<VideoPlaylistType>
20 25
21 embedPath: string 26 embedPath: string
27 embedUrl?: string
22 28
23 createdAt: Date | string 29 createdAt: Date | string
24 updatedAt: Date | string 30 updatedAt: Date | string
diff --git a/shared/models/videos/video-create-result.model.ts b/shared/models/videos/video-create-result.model.ts
new file mode 100644
index 000000000..a9f8e25a0
--- /dev/null
+++ b/shared/models/videos/video-create-result.model.ts
@@ -0,0 +1,5 @@
1export interface VideoCreateResult {
2 id: number
3 uuid: string
4 shortUUID: string
5}
diff --git a/shared/models/videos/video-file-metadata.ts b/shared/models/videos/video-file-metadata.model.ts
index 8f527c0a7..8f527c0a7 100644
--- a/shared/models/videos/video-file-metadata.ts
+++ b/shared/models/videos/video-file-metadata.model.ts
diff --git a/shared/models/videos/video-file.model.ts b/shared/models/videos/video-file.model.ts
index 1e830b19c..28fce0aaf 100644
--- a/shared/models/videos/video-file.model.ts
+++ b/shared/models/videos/video-file.model.ts
@@ -1,5 +1,5 @@
1import { VideoConstant } from './video-constant.model' 1import { VideoConstant } from './video-constant.model'
2import { VideoFileMetadata } from './video-file-metadata' 2import { VideoFileMetadata } from './video-file-metadata.model'
3import { VideoResolution } from './video-resolution.enum' 3import { VideoResolution } from './video-resolution.enum'
4 4
5export interface VideoFile { 5export interface VideoFile {
diff --git a/shared/models/videos/video.model.ts b/shared/models/videos/video.model.ts
index caefeff82..0e3e89f43 100644
--- a/shared/models/videos/video.model.ts
+++ b/shared/models/videos/video.model.ts
@@ -10,6 +10,8 @@ import { VideoStreamingPlaylist } from './video-streaming-playlist.model'
10export interface Video { 10export interface Video {
11 id: number 11 id: number
12 uuid: string 12 uuid: string
13 shortUUID: string
14
13 createdAt: Date | string 15 createdAt: Date | string
14 updatedAt: Date | string 16 updatedAt: Date | string
15 publishedAt: Date | string 17 publishedAt: Date | string