diff options
Diffstat (limited to 'shared/models')
22 files changed, 122 insertions, 15 deletions
diff --git a/shared/models/http/http-error-codes.ts b/shared/models/http/http-error-codes.ts index b2fbdfc5a..5ebff1cb5 100644 --- a/shared/models/http/http-error-codes.ts +++ b/shared/models/http/http-error-codes.ts | |||
@@ -4,7 +4,7 @@ | |||
4 | * | 4 | * |
5 | * WebDAV and other codes useless with regards to PeerTube are not listed. | 5 | * WebDAV and other codes useless with regards to PeerTube are not listed. |
6 | */ | 6 | */ |
7 | export enum HttpStatusCode { | 7 | export const enum HttpStatusCode { |
8 | 8 | ||
9 | /** | 9 | /** |
10 | * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.2.1 | 10 | * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.2.1 |
diff --git a/shared/models/http/http-methods.ts b/shared/models/http/http-methods.ts index 1cfa458b9..3f4adafe2 100644 --- a/shared/models/http/http-methods.ts +++ b/shared/models/http/http-methods.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | /** HTTP request method to indicate the desired action to be performed for a given resource. */ | 1 | /** HTTP request method to indicate the desired action to be performed for a given resource. */ |
2 | export enum HttpMethod { | 2 | export const enum HttpMethod { |
3 | /** The CONNECT method establishes a tunnel to the server identified by the target resource. */ | 3 | /** The CONNECT method establishes a tunnel to the server identified by the target resource. */ |
4 | CONNECT = 'CONNECT', | 4 | CONNECT = 'CONNECT', |
5 | /** The DELETE method deletes the specified resource. */ | 5 | /** The DELETE method deletes the specified resource. */ |
diff --git a/shared/models/moderation/block-status.model.ts b/shared/models/moderation/block-status.model.ts new file mode 100644 index 000000000..597312757 --- /dev/null +++ b/shared/models/moderation/block-status.model.ts | |||
@@ -0,0 +1,15 @@ | |||
1 | export interface BlockStatus { | ||
2 | accounts: { | ||
3 | [ handle: string ]: { | ||
4 | blockedByServer: boolean | ||
5 | blockedByUser?: boolean | ||
6 | } | ||
7 | } | ||
8 | |||
9 | hosts: { | ||
10 | [ host: string ]: { | ||
11 | blockedByServer: boolean | ||
12 | blockedByUser?: boolean | ||
13 | } | ||
14 | } | ||
15 | } | ||
diff --git a/shared/models/moderation/index.ts b/shared/models/moderation/index.ts index 8b6042e97..f8e6d351c 100644 --- a/shared/models/moderation/index.ts +++ b/shared/models/moderation/index.ts | |||
@@ -1,3 +1,4 @@ | |||
1 | export * from './abuse' | 1 | export * from './abuse' |
2 | export * from './block-status.model' | ||
2 | export * from './account-block.model' | 3 | export * from './account-block.model' |
3 | export * from './server-block.model' | 4 | export * from './server-block.model' |
diff --git a/shared/models/plugins/client/index.ts b/shared/models/plugins/client/index.ts index c500185c9..f3e3fcbcf 100644 --- a/shared/models/plugins/client/index.ts +++ b/shared/models/plugins/client/index.ts | |||
@@ -4,4 +4,5 @@ export * from './plugin-element-placeholder.type' | |||
4 | export * from './plugin-selector-id.type' | 4 | export * from './plugin-selector-id.type' |
5 | export * from './register-client-form-field.model' | 5 | export * from './register-client-form-field.model' |
6 | export * from './register-client-hook.model' | 6 | export * from './register-client-hook.model' |
7 | export * from './register-client-route.model' | ||
7 | export * from './register-client-settings-script.model' | 8 | export * from './register-client-settings-script.model' |
diff --git a/shared/models/plugins/client/plugin-selector-id.type.ts b/shared/models/plugins/client/plugin-selector-id.type.ts index b74dffbef..8d23314b5 100644 --- a/shared/models/plugins/client/plugin-selector-id.type.ts +++ b/shared/models/plugins/client/plugin-selector-id.type.ts | |||
@@ -1 +1,10 @@ | |||
1 | export type PluginSelectorId = 'login-form' | 1 | export type PluginSelectorId = |
2 | 'login-form' | | ||
3 | 'menu-user-dropdown-language-item' | | ||
4 | 'about-instance-features' | | ||
5 | 'about-instance-statistics' | | ||
6 | 'about-instance-moderation' | | ||
7 | 'about-menu-instance' | | ||
8 | 'about-menu-peertube' | | ||
9 | 'about-menu-network' | | ||
10 | 'about-instance-other-information' | ||
diff --git a/shared/models/plugins/client/register-client-form-field.model.ts b/shared/models/plugins/client/register-client-form-field.model.ts index 2df071337..153c4a6ea 100644 --- a/shared/models/plugins/client/register-client-form-field.model.ts +++ b/shared/models/plugins/client/register-client-form-field.model.ts | |||
@@ -16,8 +16,15 @@ export type RegisterClientFormFieldOptions = { | |||
16 | 16 | ||
17 | // Not supported by plugin setting registration, use registerSettingsScript instead | 17 | // Not supported by plugin setting registration, use registerSettingsScript instead |
18 | hidden?: (options: any) => boolean | 18 | hidden?: (options: any) => boolean |
19 | |||
20 | // Return undefined | null if there is no error or return a string with the detailed error | ||
21 | // Not supported by plugin setting registration | ||
22 | error?: (options: any) => Promise<{ error: boolean, text?: string }> | ||
19 | } | 23 | } |
20 | 24 | ||
21 | export interface RegisterClientVideoFieldOptions { | 25 | export interface RegisterClientVideoFieldOptions { |
22 | type: 'update' | 'upload' | 'import-url' | 'import-torrent' | 'go-live' | 26 | type: 'update' | 'upload' | 'import-url' | 'import-torrent' | 'go-live' |
27 | |||
28 | // Default to 'plugin-settings' | ||
29 | tab?: 'main' | 'plugin-settings' | ||
23 | } | 30 | } |
diff --git a/shared/models/plugins/client/register-client-route.model.ts b/shared/models/plugins/client/register-client-route.model.ts new file mode 100644 index 000000000..271b67834 --- /dev/null +++ b/shared/models/plugins/client/register-client-route.model.ts | |||
@@ -0,0 +1,7 @@ | |||
1 | export interface RegisterClientRouteOptions { | ||
2 | route: string | ||
3 | |||
4 | onMount (options: { | ||
5 | rootEl: HTMLElement | ||
6 | }): void | ||
7 | } | ||
diff --git a/shared/models/plugins/client/register-client-settings-script.model.ts b/shared/models/plugins/client/register-client-settings-script.model.ts index 481ceef96..117ca4739 100644 --- a/shared/models/plugins/client/register-client-settings-script.model.ts +++ b/shared/models/plugins/client/register-client-settings-script.model.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { RegisterServerSettingOptions } from '../server' | 1 | import { RegisterServerSettingOptions } from '../server' |
2 | 2 | ||
3 | export interface RegisterClientSettingsScript { | 3 | export interface RegisterClientSettingsScriptOptions { |
4 | isSettingHidden (options: { | 4 | isSettingHidden (options: { |
5 | setting: RegisterServerSettingOptions | 5 | setting: RegisterServerSettingOptions |
6 | formValues: { [name: string]: any } | 6 | formValues: { [name: string]: any } |
diff --git a/shared/models/plugins/plugin-index/peertube-plugin-index.model.ts b/shared/models/plugins/plugin-index/peertube-plugin-index.model.ts index e91c8b4dc..36dfef943 100644 --- a/shared/models/plugins/plugin-index/peertube-plugin-index.model.ts +++ b/shared/models/plugins/plugin-index/peertube-plugin-index.model.ts | |||
@@ -9,6 +9,8 @@ export interface PeerTubePluginIndex { | |||
9 | 9 | ||
10 | latestVersion: string | 10 | latestVersion: string |
11 | 11 | ||
12 | official: boolean | ||
13 | |||
12 | name?: string | 14 | name?: string |
13 | installed?: boolean | 15 | installed?: boolean |
14 | } | 16 | } |
diff --git a/shared/models/plugins/plugin-package-json.model.ts b/shared/models/plugins/plugin-package-json.model.ts index b2f92af80..7ce968ff2 100644 --- a/shared/models/plugins/plugin-package-json.model.ts +++ b/shared/models/plugins/plugin-package-json.model.ts | |||
@@ -1,15 +1,15 @@ | |||
1 | import { PluginClientScope } from './client/plugin-client-scope.type' | 1 | import { PluginClientScope } from './client/plugin-client-scope.type' |
2 | 2 | ||
3 | export type PluginTranslationPaths = { | 3 | export type PluginTranslationPathsJSON = { |
4 | [ locale: string ]: string | 4 | [ locale: string ]: string |
5 | } | 5 | } |
6 | 6 | ||
7 | export type ClientScript = { | 7 | export type ClientScriptJSON = { |
8 | script: string | 8 | script: string |
9 | scopes: PluginClientScope[] | 9 | scopes: PluginClientScope[] |
10 | } | 10 | } |
11 | 11 | ||
12 | export type PluginPackageJson = { | 12 | export type PluginPackageJSON = { |
13 | name: string | 13 | name: string |
14 | version: string | 14 | version: string |
15 | description: string | 15 | description: string |
@@ -23,7 +23,7 @@ export type PluginPackageJson = { | |||
23 | staticDirs: { [ name: string ]: string } | 23 | staticDirs: { [ name: string ]: string } |
24 | css: string[] | 24 | css: string[] |
25 | 25 | ||
26 | clientScripts: ClientScript[] | 26 | clientScripts: ClientScriptJSON[] |
27 | 27 | ||
28 | translations: PluginTranslationPaths | 28 | translations: PluginTranslationPathsJSON |
29 | } | 29 | } |
diff --git a/shared/models/plugins/plugin.type.ts b/shared/models/plugins/plugin.type.ts index b6766821a..016219ceb 100644 --- a/shared/models/plugins/plugin.type.ts +++ b/shared/models/plugins/plugin.type.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | export enum PluginType { | 1 | export const enum PluginType { |
2 | PLUGIN = 1, | 2 | PLUGIN = 1, |
3 | THEME = 2 | 3 | THEME = 2 |
4 | } | 4 | } |
diff --git a/shared/models/plugins/server/api/install-plugin.model.ts b/shared/models/plugins/server/api/install-plugin.model.ts index 5a268ebe1..a1d009a00 100644 --- a/shared/models/plugins/server/api/install-plugin.model.ts +++ b/shared/models/plugins/server/api/install-plugin.model.ts | |||
@@ -1,4 +1,5 @@ | |||
1 | export interface InstallOrUpdatePlugin { | 1 | export interface InstallOrUpdatePlugin { |
2 | npmName?: string | 2 | npmName?: string |
3 | pluginVersion?: string | ||
3 | path?: string | 4 | path?: string |
4 | } | 5 | } |
diff --git a/shared/models/plugins/server/server-hook.model.ts b/shared/models/plugins/server/server-hook.model.ts index 3ab910197..bd2b27da5 100644 --- a/shared/models/plugins/server/server-hook.model.ts +++ b/shared/models/plugins/server/server-hook.model.ts | |||
@@ -53,6 +53,12 @@ export const serverFilterHookObject = { | |||
53 | 'filter:api.video-thread.create.accept.result': true, | 53 | 'filter:api.video-thread.create.accept.result': true, |
54 | 'filter:api.video-comment-reply.create.accept.result': true, | 54 | 'filter:api.video-comment-reply.create.accept.result': true, |
55 | 55 | ||
56 | // Filter attributes when creating video object | ||
57 | 'filter:api.video.upload.video-attribute.result': true, | ||
58 | 'filter:api.video.import-url.video-attribute.result': true, | ||
59 | 'filter:api.video.import-torrent.video-attribute.result': true, | ||
60 | 'filter:api.video.live.video-attribute.result': true, | ||
61 | |||
56 | // Filter params/result used to list threads of a specific video | 62 | // Filter params/result used to list threads of a specific video |
57 | // (used by the video watch page) | 63 | // (used by the video watch page) |
58 | 'filter:api.video-threads.list.params': true, | 64 | 'filter:api.video-threads.list.params': true, |
@@ -63,6 +69,9 @@ export const serverFilterHookObject = { | |||
63 | 'filter:api.video-thread-comments.list.params': true, | 69 | 'filter:api.video-thread-comments.list.params': true, |
64 | 'filter:api.video-thread-comments.list.result': true, | 70 | 'filter:api.video-thread-comments.list.result': true, |
65 | 71 | ||
72 | // Filter get stats result | ||
73 | 'filter:api.server.stats.get.result': true, | ||
74 | |||
66 | // Filter result used to check if we need to auto blacklist a video | 75 | // Filter result used to check if we need to auto blacklist a video |
67 | // (fired when a local or remote video is created or updated) | 76 | // (fired when a local or remote video is created or updated) |
68 | 'filter:video.auto-blacklist.result': true, | 77 | 'filter:video.auto-blacklist.result': true, |
@@ -106,6 +115,11 @@ export const serverActionHookObject = { | |||
106 | // Fired when a comment (thread or reply) is deleted | 115 | // Fired when a comment (thread or reply) is deleted |
107 | 'action:api.video-comment.deleted': true, | 116 | 'action:api.video-comment.deleted': true, |
108 | 117 | ||
118 | // Fired when a caption is created | ||
119 | 'action:api.video-caption.created': true, | ||
120 | // Fired when a caption is deleted | ||
121 | 'action:api.video-caption.deleted': true, | ||
122 | |||
109 | // Fired when a user is blocked (banned) | 123 | // Fired when a user is blocked (banned) |
110 | 'action:api.user.blocked': true, | 124 | 'action:api.user.blocked': true, |
111 | // Fired when a user is unblocked (unbanned) | 125 | // Fired when a user is unblocked (unbanned) |
diff --git a/shared/models/server/custom-config.model.ts b/shared/models/server/custom-config.model.ts index 3ed932494..52d3d9588 100644 --- a/shared/models/server/custom-config.model.ts +++ b/shared/models/server/custom-config.model.ts | |||
@@ -52,6 +52,20 @@ export interface CustomConfig { | |||
52 | } | 52 | } |
53 | } | 53 | } |
54 | 54 | ||
55 | client: { | ||
56 | videos: { | ||
57 | miniature: { | ||
58 | preferAuthorDisplayName: boolean | ||
59 | } | ||
60 | } | ||
61 | |||
62 | menu: { | ||
63 | login: { | ||
64 | redirectOnSingleExternalAuth: boolean | ||
65 | } | ||
66 | } | ||
67 | } | ||
68 | |||
55 | cache: { | 69 | cache: { |
56 | previews: { | 70 | previews: { |
57 | size: number | 71 | size: number |
diff --git a/shared/models/server/server-config.model.ts b/shared/models/server/server-config.model.ts index e75eefd47..32be96b9d 100644 --- a/shared/models/server/server-config.model.ts +++ b/shared/models/server/server-config.model.ts | |||
@@ -1,12 +1,14 @@ | |||
1 | import { ClientScript } from '../plugins/plugin-package-json.model' | 1 | import { VideoPrivacy } from '../videos/video-privacy.enum' |
2 | import { ClientScriptJSON } from '../plugins/plugin-package-json.model' | ||
2 | import { NSFWPolicyType } from '../videos/nsfw-policy.type' | 3 | import { NSFWPolicyType } from '../videos/nsfw-policy.type' |
3 | import { BroadcastMessageLevel } from './broadcast-message-level.type' | 4 | import { BroadcastMessageLevel } from './broadcast-message-level.type' |
4 | 5 | ||
5 | export interface ServerConfigPlugin { | 6 | export interface ServerConfigPlugin { |
6 | name: string | 7 | name: string |
8 | npmName: string | ||
7 | version: string | 9 | version: string |
8 | description: string | 10 | description: string |
9 | clientScripts: { [name: string]: ClientScript } | 11 | clientScripts: { [name: string]: ClientScriptJSON } |
10 | } | 12 | } |
11 | 13 | ||
12 | export interface ServerConfigTheme extends ServerConfigPlugin { | 14 | export interface ServerConfigTheme extends ServerConfigPlugin { |
@@ -39,6 +41,31 @@ export interface ServerConfig { | |||
39 | preferAuthorDisplayName: boolean | 41 | preferAuthorDisplayName: boolean |
40 | } | 42 | } |
41 | } | 43 | } |
44 | |||
45 | menu: { | ||
46 | login: { | ||
47 | redirectOnSingleExternalAuth: boolean | ||
48 | } | ||
49 | } | ||
50 | } | ||
51 | |||
52 | defaults: { | ||
53 | publish: { | ||
54 | downloadEnabled: boolean | ||
55 | commentsEnabled: boolean | ||
56 | privacy: VideoPrivacy | ||
57 | licence: number | ||
58 | } | ||
59 | |||
60 | p2p: { | ||
61 | webapp: { | ||
62 | enabled: boolean | ||
63 | } | ||
64 | |||
65 | embed: { | ||
66 | enabled: boolean | ||
67 | } | ||
68 | } | ||
42 | } | 69 | } |
43 | 70 | ||
44 | webadmin: { | 71 | webadmin: { |
diff --git a/shared/models/users/index.ts b/shared/models/users/index.ts index b61a8cd40..a24ffee96 100644 --- a/shared/models/users/index.ts +++ b/shared/models/users/index.ts | |||
@@ -8,6 +8,7 @@ export * from './user-refresh-token.model' | |||
8 | export * from './user-register.model' | 8 | export * from './user-register.model' |
9 | export * from './user-right.enum' | 9 | export * from './user-right.enum' |
10 | export * from './user-role' | 10 | export * from './user-role' |
11 | export * from './user-scoped-token' | ||
11 | export * from './user-update-me.model' | 12 | export * from './user-update-me.model' |
12 | export * from './user-update.model' | 13 | export * from './user-update.model' |
13 | export * from './user-video-quota.model' | 14 | export * from './user-video-quota.model' |
diff --git a/shared/models/users/user-right.enum.ts b/shared/models/users/user-right.enum.ts index 6415ca6f2..668535f4e 100644 --- a/shared/models/users/user-right.enum.ts +++ b/shared/models/users/user-right.enum.ts | |||
@@ -22,9 +22,9 @@ export const enum UserRight { | |||
22 | MANAGE_SERVERS_BLOCKLIST, | 22 | MANAGE_SERVERS_BLOCKLIST, |
23 | 23 | ||
24 | MANAGE_VIDEO_BLACKLIST, | 24 | MANAGE_VIDEO_BLACKLIST, |
25 | MANAGE_ANY_VIDEO_CHANNEL, | ||
25 | 26 | ||
26 | REMOVE_ANY_VIDEO, | 27 | REMOVE_ANY_VIDEO, |
27 | REMOVE_ANY_VIDEO_CHANNEL, | ||
28 | REMOVE_ANY_VIDEO_PLAYLIST, | 28 | REMOVE_ANY_VIDEO_PLAYLIST, |
29 | REMOVE_ANY_VIDEO_COMMENT, | 29 | REMOVE_ANY_VIDEO_COMMENT, |
30 | 30 | ||
diff --git a/shared/models/users/user-role.ts b/shared/models/users/user-role.ts index 94413abca..687a2aa0d 100644 --- a/shared/models/users/user-role.ts +++ b/shared/models/users/user-role.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | // Keep the order | 1 | // Keep the order |
2 | export enum UserRole { | 2 | export const enum UserRole { |
3 | ADMINISTRATOR = 0, | 3 | ADMINISTRATOR = 0, |
4 | MODERATOR = 1, | 4 | MODERATOR = 1, |
5 | USER = 2 | 5 | USER = 2 |
diff --git a/shared/models/users/user-update-me.model.ts b/shared/models/users/user-update-me.model.ts index 6d7df38fb..e664e44b5 100644 --- a/shared/models/users/user-update-me.model.ts +++ b/shared/models/users/user-update-me.model.ts | |||
@@ -5,7 +5,10 @@ export interface UserUpdateMe { | |||
5 | description?: string | 5 | description?: string |
6 | nsfwPolicy?: NSFWPolicyType | 6 | nsfwPolicy?: NSFWPolicyType |
7 | 7 | ||
8 | // FIXME: deprecated in favour of p2pEnabled in 4.1 | ||
8 | webTorrentEnabled?: boolean | 9 | webTorrentEnabled?: boolean |
10 | p2pEnabled?: boolean | ||
11 | |||
9 | autoPlayVideo?: boolean | 12 | autoPlayVideo?: boolean |
10 | autoPlayNextVideo?: boolean | 13 | autoPlayNextVideo?: boolean |
11 | autoPlayNextVideoPlaylist?: boolean | 14 | autoPlayNextVideoPlaylist?: boolean |
diff --git a/shared/models/users/user.model.ts b/shared/models/users/user.model.ts index 78870c556..63c5c8a92 100644 --- a/shared/models/users/user.model.ts +++ b/shared/models/users/user.model.ts | |||
@@ -20,7 +20,11 @@ export interface User { | |||
20 | autoPlayVideo: boolean | 20 | autoPlayVideo: boolean |
21 | autoPlayNextVideo: boolean | 21 | autoPlayNextVideo: boolean |
22 | autoPlayNextVideoPlaylist: boolean | 22 | autoPlayNextVideoPlaylist: boolean |
23 | |||
24 | // @deprecated in favour of p2pEnabled | ||
23 | webTorrentEnabled: boolean | 25 | webTorrentEnabled: boolean |
26 | p2pEnabled: boolean | ||
27 | |||
24 | videosHistoryEnabled: boolean | 28 | videosHistoryEnabled: boolean |
25 | videoLanguages: string[] | 29 | videoLanguages: string[] |
26 | 30 | ||
diff --git a/shared/models/videos/video-state.enum.ts b/shared/models/videos/video-state.enum.ts index 6112b6e16..09268d2ff 100644 --- a/shared/models/videos/video-state.enum.ts +++ b/shared/models/videos/video-state.enum.ts | |||
@@ -5,5 +5,6 @@ export const enum VideoState { | |||
5 | WAITING_FOR_LIVE = 4, | 5 | WAITING_FOR_LIVE = 4, |
6 | LIVE_ENDED = 5, | 6 | LIVE_ENDED = 5, |
7 | TO_MOVE_TO_EXTERNAL_STORAGE = 6, | 7 | TO_MOVE_TO_EXTERNAL_STORAGE = 6, |
8 | TRANSCODING_FAILED = 7 | 8 | TRANSCODING_FAILED = 7, |
9 | TO_MOVE_TO_EXTERNAL_STORAGE_FAILED = 8 | ||
9 | } | 10 | } |