diff options
Diffstat (limited to 'shared')
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 | ||
31 | function 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 | |||
31 | export { | 45 | export { |
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 | ||
7 | export type FunctionProperties<T> = Pick<T, FunctionPropertyNames<T>> | 7 | export type FunctionProperties<T> = Pick<T, FunctionPropertyNames<T>> |
8 | 8 | ||
9 | export type AttributesOnly<T> = { | ||
10 | [K in keyof T]: T[K] extends Function ? never : T[K] | ||
11 | } | ||
12 | |||
9 | export type PickWith<T, KT extends keyof T, V> = { | 13 | export 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 @@ | |||
1 | export const SANITIZE_OPTIONS = { | 1 | export 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 | ||
26 | export 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 |
24 | export function escapeHTML (stringParam: string) { | 46 | export 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 @@ | |||
1 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
2 | import { makeGetRequest, makePutBodyRequest } from '../requests/requests' | ||
3 | |||
4 | function 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 | |||
14 | function 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 | |||
28 | export { | ||
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 @@ | |||
1 | export * from './bulk/bulk' | 1 | export * from './bulk/bulk' |
2 | |||
2 | export * from './cli/cli' | 3 | export * from './cli/cli' |
4 | |||
5 | export * from './custom-pages/custom-pages' | ||
6 | |||
3 | export * from './feeds/feeds' | 7 | export * from './feeds/feeds' |
8 | |||
4 | export * from './mock-servers/mock-instances-index' | 9 | export * from './mock-servers/mock-instances-index' |
5 | export * from './miscs/miscs' | 10 | |
11 | export * from './miscs/email' | ||
6 | export * from './miscs/sql' | 12 | export * from './miscs/sql' |
13 | export * from './miscs/miscs' | ||
7 | export * from './miscs/stubs' | 14 | export * from './miscs/stubs' |
15 | |||
8 | export * from './moderation/abuses' | 16 | export * from './moderation/abuses' |
9 | export * from './plugins/mock-blocklist' | 17 | export * from './plugins/mock-blocklist' |
18 | |||
10 | export * from './requests/check-api-params' | 19 | export * from './requests/check-api-params' |
11 | export * from './requests/requests' | 20 | export * from './requests/requests' |
21 | |||
22 | export * from './search/video-channels' | ||
23 | export * from './search/video-playlists' | ||
12 | export * from './search/videos' | 24 | export * from './search/videos' |
25 | |||
13 | export * from './server/activitypub' | 26 | export * from './server/activitypub' |
14 | export * from './server/clients' | 27 | export * from './server/clients' |
15 | export * from './server/config' | 28 | export * from './server/config' |
@@ -18,9 +31,14 @@ export * from './server/follows' | |||
18 | export * from './server/jobs' | 31 | export * from './server/jobs' |
19 | export * from './server/plugins' | 32 | export * from './server/plugins' |
20 | export * from './server/servers' | 33 | export * from './server/servers' |
34 | |||
21 | export * from './users/accounts' | 35 | export * from './users/accounts' |
36 | export * from './users/blocklist' | ||
22 | export * from './users/login' | 37 | export * from './users/login' |
38 | export * from './users/user-notifications' | ||
39 | export * from './users/user-subscriptions' | ||
23 | export * from './users/users' | 40 | export * from './users/users' |
41 | |||
24 | export * from './videos/live' | 42 | export * from './videos/live' |
25 | export * from './videos/services' | 43 | export * from './videos/services' |
26 | export * from './videos/video-blacklist' | 44 | export * 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 @@ | |||
1 | const MailDev = require('maildev') | ||
2 | |||
3 | // must run maildev as forked ChildProcess | ||
4 | // failed instantiation stops main process with exit code 0 | ||
5 | process.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 @@ | |||
1 | import { ChildProcess, fork } from 'child_process' | 1 | import { ChildProcess } from 'child_process' |
2 | import { join } from 'path' | ||
3 | import { randomInt } from '../../core-utils/miscs/miscs' | 2 | import { randomInt } from '../../core-utils/miscs/miscs' |
4 | import { parallelTests } from '../server/servers' | 3 | import { parallelTests } from '../server/servers' |
5 | 4 | ||
5 | const MailDev = require('maildev') | ||
6 | |||
6 | class MockSmtpServer { | 7 | class 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 | |||
67 | async 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 | ||
67 | function isGithubCI () { | 73 | function 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 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { Server } from 'http' | 2 | import { Server } from 'http' |
3 | import { randomInt } from '@shared/core-utils' | ||
3 | 4 | ||
4 | type BlocklistResponse = { | 5 | type 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 @@ | |||
1 | import { VideoPlaylistsSearchQuery } from '@shared/models' | ||
2 | import { HttpStatusCode } from '../../core-utils/miscs/http-error-codes' | ||
3 | import { makeGetRequest } from '../requests/requests' | ||
4 | |||
5 | function 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 | |||
20 | function 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 | |||
33 | export { | ||
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' | |||
4 | import { readJSON, writeJSON } from 'fs-extra' | 4 | import { readJSON, writeJSON } from 'fs-extra' |
5 | import { join } from 'path' | 5 | import { join } from 'path' |
6 | import { RegisteredServerSettings } from '@shared/models' | 6 | import { RegisteredServerSettings } from '@shared/models' |
7 | import { PeertubePluginIndexList } from '../../models/plugins/peertube-plugin-index-list.model' | 7 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' |
8 | import { PeertubePluginIndexList } from '../../models/plugins/plugin-index/peertube-plugin-index-list.model' | ||
8 | import { PluginType } from '../../models/plugins/plugin.type' | 9 | import { PluginType } from '../../models/plugins/plugin.type' |
9 | import { buildServerDirectory, root } from '../miscs/miscs' | 10 | import { buildServerDirectory, root } from '../miscs/miscs' |
10 | import { makeGetRequest, makePostBodyRequest, makePutBodyRequest } from '../requests/requests' | 11 | import { makeGetRequest, makePostBodyRequest, makePutBodyRequest } from '../requests/requests' |
11 | import { ServerInfo } from './servers' | 12 | import { ServerInfo } from './servers' |
12 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
13 | 13 | ||
14 | function listPlugins (parameters: { | 14 | function 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 | ||
178 | async function waitUntilLivePublishedOnAllServers (servers: ServerInfo[], videoId: string) { | ||
179 | for (const server of servers) { | ||
180 | await waitUntilLivePublished(server.url, server.accessToken, videoId) | ||
181 | } | ||
182 | } | ||
183 | |||
178 | async function checkLiveCleanup (server: ServerInfo, videoUUID: string, resolutions: number[] = []) { | 184 | async 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' | |||
4 | import { createReadStream, pathExists, readdir, readFile, stat } from 'fs-extra' | 4 | import { createReadStream, pathExists, readdir, readFile, stat } from 'fs-extra' |
5 | import got, { Response as GotResponse } from 'got/dist/source' | 5 | import got, { Response as GotResponse } from 'got/dist/source' |
6 | import * as parseTorrent from 'parse-torrent' | 6 | import * as parseTorrent from 'parse-torrent' |
7 | import { extname, join } from 'path' | 7 | import { join } from 'path' |
8 | import * as request from 'supertest' | 8 | import * as request from 'supertest' |
9 | import { v4 as uuidv4 } from 'uuid' | ||
10 | import validator from 'validator' | 9 | import validator from 'validator' |
10 | import { getLowercaseExtension } from '@server/helpers/core-utils' | ||
11 | import { buildUUID } from '@server/helpers/uuid' | ||
11 | import { HttpStatusCode } from '@shared/core-utils' | 12 | import { HttpStatusCode } from '@shared/core-utils' |
12 | import { VideosCommonQuery } from '@shared/models' | 13 | import { VideosCommonQuery } from '@shared/models' |
13 | import { loadLanguages, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES } from '../../../server/initializers/constants' | 14 | import { 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 | ||
809 | async function getLocalIdByUUID (url: string, uuid: string) { | 812 | async function getLocalIdByUUID (url: string, uuid: string) { |
@@ -824,7 +827,7 @@ async function uploadRandomVideoOnServers (servers: ServerInfo[], serverNumber: | |||
824 | 827 | ||
825 | async function uploadRandomVideo (server: ServerInfo, wait = true, additionalParams: any = {}) { | 828 | async 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' | |||
2 | export * from './cache-file-object' | 2 | export * from './cache-file-object' |
3 | export * from './common-objects' | 3 | export * from './common-objects' |
4 | export * from './dislike-object' | 4 | export * from './dislike-object' |
5 | export * from './object.model' | ||
6 | export * from './playlist-element-object' | ||
7 | export * from './playlist-object' | ||
8 | export * from './video-comment-object' | ||
5 | export * from './video-torrent-object' | 9 | export * from './video-torrent-object' |
6 | export * from './view-object' | 10 | export * 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 @@ | |||
1 | export 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' | |||
2 | export * from './actor-image.model' | 2 | export * from './actor-image.model' |
3 | export * from './actor-image.type' | 3 | export * from './actor-image.type' |
4 | export * from './actor.model' | 4 | export * from './actor.model' |
5 | export * from './custom-page.model' | ||
5 | export * from './follow.model' | 6 | export * 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 @@ | |||
1 | export type EmbedMarkupData = { | ||
2 | // Video or playlist uuid | ||
3 | uuid: string | ||
4 | } | ||
5 | |||
6 | export type VideoMiniatureMarkupData = { | ||
7 | // Video uuid | ||
8 | uuid: string | ||
9 | |||
10 | onlyDisplayTitle?: string // boolean | ||
11 | } | ||
12 | |||
13 | export type PlaylistMiniatureMarkupData = { | ||
14 | // Playlist uuid | ||
15 | uuid: string | ||
16 | } | ||
17 | |||
18 | export type ChannelMiniatureMarkupData = { | ||
19 | // Channel name (username) | ||
20 | name: string | ||
21 | |||
22 | displayLatestVideo?: string // boolean | ||
23 | displayDescription?: string // boolean | ||
24 | } | ||
25 | |||
26 | export 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 | |||
42 | export type ButtonMarkupData = { | ||
43 | theme: 'primary' | 'secondary' | ||
44 | href: string | ||
45 | label: string | ||
46 | blankTarget?: string // boolean | ||
47 | } | ||
48 | |||
49 | export 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 @@ | |||
1 | export * from './activitypub' | 1 | export * from './activitypub' |
2 | export * from './actors' | 2 | export * from './actors' |
3 | export * from './moderation' | ||
4 | export * from './bulk' | 3 | export * from './bulk' |
5 | export * from './redundancy' | 4 | export * from './common' |
6 | export * from './users' | 5 | export * from './custom-markup' |
7 | export * from './videos' | ||
8 | export * from './feeds' | 6 | export * from './feeds' |
9 | export * from './joinpeertube' | 7 | export * from './joinpeertube' |
8 | export * from './moderation' | ||
10 | export * from './overviews' | 9 | export * from './overviews' |
11 | export * from './plugins' | 10 | export * from './plugins' |
11 | export * from './redundancy' | ||
12 | export * from './search' | 12 | export * from './search' |
13 | export * from './server' | 13 | export * from './server' |
14 | export * from './oauth-client-local.model' | 14 | export * from './tokens' |
15 | export * from './result-list.model' | 15 | export * from './users' |
16 | export * 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 | ||
56 | export type ClientFilterHookName = keyof typeof clientFilterHookObject | 65 | export 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 @@ | |||
1 | export * from './client-hook.model' | ||
2 | export * from './plugin-client-scope.type' | ||
3 | export * from './plugin-element-placeholder.type' | ||
4 | export * from './register-client-form-field.model' | ||
5 | export * from './register-client-hook.model' | ||
6 | export * 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 @@ | |||
1 | import { RegisterServerSettingOptions } from "./register-server-setting.model" | 1 | import { RegisterServerSettingOptions } from '../server' |
2 | 2 | ||
3 | export interface RegisterClientSettingsScript { | 3 | export 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 @@ | |||
1 | export * from './client-hook.model' | 1 | export * from './client' |
2 | export * from './plugin-index' | ||
3 | export * from './server' | ||
2 | export * from './hook-type.enum' | 4 | export * from './hook-type.enum' |
3 | export * from './install-plugin.model' | ||
4 | export * from './manage-plugin.model' | ||
5 | export * from './peertube-plugin-index-list.model' | ||
6 | export * from './peertube-plugin-index.model' | ||
7 | export * from './peertube-plugin-latest-version.model' | ||
8 | export * from './peertube-plugin.model' | ||
9 | export * from './plugin-client-scope.type' | ||
10 | export * from './plugin-element-placeholder.type' | ||
11 | export * from './plugin-package-json.model' | 5 | export * from './plugin-package-json.model' |
12 | export * from './plugin-playlist-privacy-manager.model' | ||
13 | export * from './plugin-settings-manager.model' | ||
14 | export * from './plugin-storage-manager.model' | ||
15 | export * from './plugin-transcoding-manager.model' | ||
16 | export * from './plugin-translation.model' | ||
17 | export * from './plugin-video-category-manager.model' | ||
18 | export * from './plugin-video-language-manager.model' | ||
19 | export * from './plugin-video-licence-manager.model' | ||
20 | export * from './plugin-video-privacy-manager.model' | ||
21 | export * from './plugin.type' | 6 | export * from './plugin.type' |
22 | export * from './public-server.setting' | ||
23 | export * from './register-client-hook.model' | ||
24 | export * from './register-client-settings-script.model' | ||
25 | export * from './register-client-form-field.model' | ||
26 | export * from './register-server-hook.model' | ||
27 | export * from './register-server-setting.model' | ||
28 | export * 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 @@ | |||
1 | export * from './peertube-plugin-index-list.model' | ||
2 | export * from './peertube-plugin-index.model' | ||
3 | export * 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 @@ | |||
1 | import { PluginType } from './plugin.type' | 1 | import { PluginType } from '../plugin.type' |
2 | 2 | ||
3 | export interface PeertubePluginIndexList { | 3 | export 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 @@ | |||
1 | import { PluginClientScope } from './plugin-client-scope.type' | 1 | import { PluginClientScope } from './client/plugin-client-scope.type' |
2 | 2 | ||
3 | export type PluginTranslationPaths = { | 3 | export 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 @@ | |||
1 | export * from './install-plugin.model' | ||
2 | export * from './manage-plugin.model' | ||
3 | export * 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 @@ | |||
1 | import { PluginType } from './plugin.type' | 1 | import { PluginType } from '../../plugin.type' |
2 | 2 | ||
3 | export interface PeerTubePlugin { | 3 | export 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 @@ | |||
1 | export * from './api' | ||
2 | export * from './managers' | ||
3 | export * from './settings' | ||
4 | export * from './plugin-translation.model' | ||
5 | export * from './register-server-hook.model' | ||
6 | export * 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 | |||
2 | export * from './plugin-playlist-privacy-manager.model' | ||
3 | export * from './plugin-settings-manager.model' | ||
4 | export * from './plugin-storage-manager.model' | ||
5 | export * from './plugin-transcoding-manager.model' | ||
6 | export * from './plugin-video-category-manager.model' | ||
7 | export * from './plugin-video-language-manager.model' | ||
8 | export * from './plugin-video-licence-manager.model' | ||
9 | export * 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 @@ | |||
1 | import { VideoPlaylistPrivacy } from '../videos/playlist/video-playlist-privacy.model' | 1 | import { VideoPlaylistPrivacy } from '../../../videos/playlist/video-playlist-privacy.model' |
2 | 2 | ||
3 | export interface PluginPlaylistPrivacyManager { | 3 | export 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 @@ | |||
1 | import { EncoderOptionsBuilder } from '../videos/video-transcoding.model' | 1 | import { EncoderOptionsBuilder } from '../../../videos/video-transcoding.model' |
2 | 2 | ||
3 | export interface PluginTranscodingManager { | 3 | export 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 @@ | |||
1 | import { VideoPrivacy } from '../videos/video-privacy.enum' | 1 | import { VideoPrivacy } from '../../../videos/video-privacy.enum' |
2 | 2 | ||
3 | export interface PluginVideoPrivacyManager { | 3 | export 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 | ||
116 | export type ServerActionHookName = keyof typeof serverActionHookObject | 123 | export 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 @@ | |||
1 | export * from './public-server.setting' | ||
2 | export * 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 @@ | |||
1 | import { RegisterClientFormFieldOptions } from './register-client-form-field.model' | 1 | import { RegisterClientFormFieldOptions } from '../../client' |
2 | 2 | ||
3 | export type RegisterServerSettingOptions = RegisterClientFormFieldOptions & { | 3 | export 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 @@ | |||
1 | export * from './videos-redundancy-strategy.model' | ||
2 | export * from './video-redundancies-filters.model' | 1 | export * from './video-redundancies-filters.model' |
2 | export * from './video-redundancy-config-filter.type' | ||
3 | export * from './video-redundancy.model' | 3 | export * from './video-redundancy.model' |
4 | export * 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 @@ | |||
1 | export * from './boolean-both-query.model' | 1 | export * from './boolean-both-query.model' |
2 | export * from './search-target-query.model' | 2 | export * from './search-target-query.model' |
3 | export * from './videos-common-query.model' | 3 | export * from './videos-common-query.model' |
4 | export * from './videos-search-query.model' | ||
5 | export * from './video-channels-search-query.model' | 4 | export * from './video-channels-search-query.model' |
5 | export * from './video-playlists-search-query.model' | ||
6 | export * 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 @@ | |||
1 | import { SearchTargetQuery } from "./search-target-query.model" | 1 | import { SearchTargetQuery } from './search-target-query.model' |
2 | 2 | ||
3 | export interface VideoChannelsSearchQuery extends SearchTargetQuery { | 3 | export 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 @@ | |||
1 | import { SearchTargetQuery } from './search-target-query.model' | ||
2 | |||
3 | export 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' | |||
6 | export * from './emailer.model' | 6 | export * from './emailer.model' |
7 | export * from './job.model' | 7 | export * from './job.model' |
8 | export * from './log-level.type' | 8 | export * from './log-level.type' |
9 | export * from './peertube-problem-document.model' | ||
9 | export * from './server-config.model' | 10 | export * from './server-config.model' |
10 | export * from './server-debug.model' | 11 | export * from './server-debug.model' |
11 | export * from './server-error-code.enum' | 12 | export * 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 | ||
59 | export type ActivitypubHttpUnicastPayload = { | 58 | export 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 @@ | |||
1 | import { HttpStatusCode } from '../../core-utils' | ||
2 | import { OAuth2ErrorCode, ServerErrorCode } from './server-error-code.enum' | ||
3 | |||
4 | export 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 | |||
20 | export 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 | |||
224 | export 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 @@ | |||
1 | export const enum ServerErrorCode { | 1 | export 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 | **/ | ||
47 | export 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 @@ | |||
1 | export * from './video-change-ownership-accept.model' | ||
2 | export * from './video-change-ownership-create.model' | ||
3 | export * 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 @@ | |||
1 | import { Account } from '../actors' | 1 | import { Account } from '../../actors' |
2 | import { Video } from './video.model' | 2 | import { Video } from '../video.model' |
3 | 3 | ||
4 | export interface VideoChangeOwnership { | 4 | export 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 @@ | |||
1 | import { Account } from '../actors' | 1 | import { Account } from '../../actors' |
2 | 2 | ||
3 | export interface VideoComment { | 3 | export 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 @@ | |||
1 | export * from './blacklist' | 1 | export * from './blacklist' |
2 | export * from './caption' | 2 | export * from './caption' |
3 | export * from './change-ownership' | ||
3 | export * from './channel' | 4 | export * from './channel' |
5 | export * from './comment' | ||
4 | export * from './live' | 6 | export * from './live' |
5 | export * from './import' | 7 | export * from './import' |
6 | export * from './playlist' | 8 | export * from './playlist' |
@@ -10,17 +12,11 @@ export * from './nsfw-policy.type' | |||
10 | 12 | ||
11 | export * from './thumbnail.type' | 13 | export * from './thumbnail.type' |
12 | 14 | ||
13 | export * from './video-change-ownership-accept.model' | ||
14 | export * from './video-change-ownership-create.model' | ||
15 | export * from './video-change-ownership.model' | ||
16 | |||
17 | export * from './video-comment.model' | ||
18 | export * from './video-constant.model' | 15 | export * from './video-constant.model' |
19 | export * from './video-create.model' | 16 | export * from './video-create.model' |
20 | export * from './video-file-metadata' | ||
21 | export * from './video-file.model' | ||
22 | 17 | ||
23 | export * from './live/live-video.model' | 18 | export * from './video-file-metadata.model' |
19 | export * from './video-file.model' | ||
24 | 20 | ||
25 | export * from './video-privacy.enum' | 21 | export * from './video-privacy.enum' |
26 | export * from './video-query.type' | 22 | export * from './video-query.type' |
@@ -39,3 +35,4 @@ export * from './video-transcoding-fps.model' | |||
39 | 35 | ||
40 | export * from './video-update.model' | 36 | export * from './video-update.model' |
41 | export * from './video.model' | 37 | export * from './video.model' |
38 | export * 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 @@ | |||
1 | export * from './video-exist-in-playlist.model' | 1 | export * from './video-exist-in-playlist.model' |
2 | export * from './video-playlist-create-result.model' | ||
2 | export * from './video-playlist-create.model' | 3 | export * from './video-playlist-create.model' |
3 | export * from './video-playlist-element-create.model' | 4 | export * from './video-playlist-element-create.model' |
4 | export * from './video-playlist-element-update.model' | 5 | export * 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 @@ | |||
1 | export 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' | |||
6 | export interface VideoPlaylist { | 6 | export 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 @@ | |||
1 | export 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 @@ | |||
1 | import { VideoConstant } from './video-constant.model' | 1 | import { VideoConstant } from './video-constant.model' |
2 | import { VideoFileMetadata } from './video-file-metadata' | 2 | import { VideoFileMetadata } from './video-file-metadata.model' |
3 | import { VideoResolution } from './video-resolution.enum' | 3 | import { VideoResolution } from './video-resolution.enum' |
4 | 4 | ||
5 | export interface VideoFile { | 5 | export 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' | |||
10 | export interface Video { | 10 | export 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 |