diff options
Diffstat (limited to 'shared/models')
19 files changed, 189 insertions, 14 deletions
diff --git a/shared/models/activitypub/activity.ts b/shared/models/activitypub/activity.ts index 44cb99efb..89994f665 100644 --- a/shared/models/activitypub/activity.ts +++ b/shared/models/activitypub/activity.ts | |||
@@ -5,12 +5,14 @@ import { DislikeObject } from './objects/dislike-object' | |||
5 | import { VideoAbuseObject } from './objects/video-abuse-object' | 5 | import { VideoAbuseObject } from './objects/video-abuse-object' |
6 | import { VideoCommentObject } from './objects/video-comment-object' | 6 | import { VideoCommentObject } from './objects/video-comment-object' |
7 | import { ViewObject } from './objects/view-object' | 7 | import { ViewObject } from './objects/view-object' |
8 | import { APObject } from './objects/object.model' | ||
8 | 9 | ||
9 | export type Activity = ActivityCreate | ActivityUpdate | | 10 | export type Activity = ActivityCreate | ActivityUpdate | |
10 | ActivityDelete | ActivityFollow | ActivityAccept | ActivityAnnounce | | 11 | ActivityDelete | ActivityFollow | ActivityAccept | ActivityAnnounce | |
11 | ActivityUndo | ActivityLike | ActivityReject | 12 | ActivityUndo | ActivityLike | ActivityReject | ActivityView | ActivityDislike | ActivityFlag |
12 | 13 | ||
13 | export type ActivityType = 'Create' | 'Update' | 'Delete' | 'Follow' | 'Accept' | 'Announce' | 'Undo' | 'Like' | 'Reject' | 14 | export type ActivityType = 'Create' | 'Update' | 'Delete' | 'Follow' | 'Accept' | 'Announce' | 'Undo' | 'Like' | 'Reject' | |
15 | 'View' | 'Dislike' | 'Flag' | ||
14 | 16 | ||
15 | export interface ActivityAudience { | 17 | export interface ActivityAudience { |
16 | to: string[] | 18 | to: string[] |
@@ -59,15 +61,34 @@ export interface ActivityReject extends BaseActivity { | |||
59 | 61 | ||
60 | export interface ActivityAnnounce extends BaseActivity { | 62 | export interface ActivityAnnounce extends BaseActivity { |
61 | type: 'Announce' | 63 | type: 'Announce' |
62 | object: string | { id: string } | 64 | object: APObject |
63 | } | 65 | } |
64 | 66 | ||
65 | export interface ActivityUndo extends BaseActivity { | 67 | export interface ActivityUndo extends BaseActivity { |
66 | type: 'Undo', | 68 | type: 'Undo', |
67 | object: ActivityFollow | ActivityLike | ActivityCreate | ActivityAnnounce | 69 | object: ActivityFollow | ActivityLike | ActivityDislike | ActivityCreate | ActivityAnnounce |
68 | } | 70 | } |
69 | 71 | ||
70 | export interface ActivityLike extends BaseActivity { | 72 | export interface ActivityLike extends BaseActivity { |
71 | type: 'Like', | 73 | type: 'Like', |
72 | object: string | 74 | object: APObject |
75 | } | ||
76 | |||
77 | export interface ActivityView extends BaseActivity { | ||
78 | type: 'View', | ||
79 | actor: string | ||
80 | object: APObject | ||
81 | } | ||
82 | |||
83 | export interface ActivityDislike extends BaseActivity { | ||
84 | id: string | ||
85 | type: 'Dislike' | ||
86 | actor: string | ||
87 | object: APObject | ||
88 | } | ||
89 | |||
90 | export interface ActivityFlag extends BaseActivity { | ||
91 | type: 'Flag', | ||
92 | content: string, | ||
93 | object: APObject | ||
73 | } | 94 | } |
diff --git a/shared/models/activitypub/objects/object.model.ts b/shared/models/activitypub/objects/object.model.ts new file mode 100644 index 000000000..3fd33800a --- /dev/null +++ b/shared/models/activitypub/objects/object.model.ts | |||
@@ -0,0 +1 @@ | |||
export type APObject = string | { id: string } | |||
diff --git a/shared/models/actors/actor.model.ts b/shared/models/actors/actor.model.ts index 6b3b1b47c..a3953874d 100644 --- a/shared/models/actors/actor.model.ts +++ b/shared/models/actors/actor.model.ts | |||
@@ -10,5 +10,5 @@ export interface Actor { | |||
10 | followersCount: number | 10 | followersCount: number |
11 | createdAt: Date | string | 11 | createdAt: Date | string |
12 | updatedAt: Date | string | 12 | updatedAt: Date | string |
13 | avatar: Avatar | 13 | avatar?: Avatar |
14 | } | 14 | } |
diff --git a/shared/models/i18n/i18n.ts b/shared/models/i18n/i18n.ts index 5c3249452..d7164b73f 100644 --- a/shared/models/i18n/i18n.ts +++ b/shared/models/i18n/i18n.ts | |||
@@ -8,12 +8,14 @@ export const I18N_LOCALES = { | |||
8 | 'cs-CZ': 'Čeština', | 8 | 'cs-CZ': 'Čeština', |
9 | 'eo': 'Esperanto', | 9 | 'eo': 'Esperanto', |
10 | 'de-DE': 'Deutsch', | 10 | 'de-DE': 'Deutsch', |
11 | 'it-IT': 'Italiano', | ||
11 | 'es-ES': 'Español', | 12 | 'es-ES': 'Español', |
12 | 'oc': 'Occitan', | 13 | 'oc': 'Occitan', |
13 | 'zh-Hant-TW': '繁體中文(台灣)', | 14 | 'zh-Hant-TW': '繁體中文(台灣)', |
14 | 'pt-BR': 'Português (Brasil)', | 15 | 'pt-BR': 'Português (Brasil)', |
15 | 'sv-SE': 'svenska', | 16 | 'sv-SE': 'svenska', |
16 | // 'pl-PL': 'Polski' | 17 | 'pl-PL': 'Polski', |
18 | 'ru-RU': 'русский', | ||
17 | 'zh-Hans-CN': '简体中文(中国)' | 19 | 'zh-Hans-CN': '简体中文(中国)' |
18 | } | 20 | } |
19 | 21 | ||
@@ -26,8 +28,9 @@ const I18N_LOCALE_ALIAS = { | |||
26 | 'de': 'de-DE', | 28 | 'de': 'de-DE', |
27 | 'es': 'es-ES', | 29 | 'es': 'es-ES', |
28 | 'pt': 'pt-BR', | 30 | 'pt': 'pt-BR', |
29 | 'sv': 'sv-SE' | 31 | 'sv': 'sv-SE', |
30 | // 'pl': 'pl-PL' | 32 | 'pl': 'pl-PL', |
33 | 'ru': 'ru-RU' | ||
31 | } | 34 | } |
32 | 35 | ||
33 | export const POSSIBLE_LOCALES = Object.keys(I18N_LOCALES) | 36 | export const POSSIBLE_LOCALES = Object.keys(I18N_LOCALES) |
diff --git a/shared/models/server/contact-form.model.ts b/shared/models/server/contact-form.model.ts new file mode 100644 index 000000000..0696be8b4 --- /dev/null +++ b/shared/models/server/contact-form.model.ts | |||
@@ -0,0 +1,5 @@ | |||
1 | export interface ContactForm { | ||
2 | fromEmail: string | ||
3 | fromName: string | ||
4 | body: string | ||
5 | } | ||
diff --git a/shared/models/server/custom-config.model.ts b/shared/models/server/custom-config.model.ts index 3afd36fcd..7a3eaa33f 100644 --- a/shared/models/server/custom-config.model.ts +++ b/shared/models/server/custom-config.model.ts | |||
@@ -41,6 +41,10 @@ export interface CustomConfig { | |||
41 | email: string | 41 | email: string |
42 | } | 42 | } |
43 | 43 | ||
44 | contactForm: { | ||
45 | enabled: boolean | ||
46 | } | ||
47 | |||
44 | user: { | 48 | user: { |
45 | videoQuota: number | 49 | videoQuota: number |
46 | videoQuotaDaily: number | 50 | videoQuotaDaily: number |
@@ -48,6 +52,7 @@ export interface CustomConfig { | |||
48 | 52 | ||
49 | transcoding: { | 53 | transcoding: { |
50 | enabled: boolean | 54 | enabled: boolean |
55 | allowAdditionalExtensions: boolean | ||
51 | threads: number | 56 | threads: number |
52 | resolutions: { | 57 | resolutions: { |
53 | '240p': boolean | 58 | '240p': boolean |
diff --git a/shared/models/server/index.ts b/shared/models/server/index.ts new file mode 100644 index 000000000..c42f6f67f --- /dev/null +++ b/shared/models/server/index.ts | |||
@@ -0,0 +1,6 @@ | |||
1 | export * from './about.model' | ||
2 | export * from './contact-form.model' | ||
3 | export * from './custom-config.model' | ||
4 | export * from './job.model' | ||
5 | export * from './server-config.model' | ||
6 | export * from './server-stats.model' | ||
diff --git a/shared/models/server/server-config.model.ts b/shared/models/server/server-config.model.ts index 91196c1eb..f4245ed4d 100644 --- a/shared/models/server/server-config.model.ts +++ b/shared/models/server/server-config.model.ts | |||
@@ -15,6 +15,14 @@ export interface ServerConfig { | |||
15 | } | 15 | } |
16 | } | 16 | } |
17 | 17 | ||
18 | email: { | ||
19 | enabled: boolean | ||
20 | } | ||
21 | |||
22 | contactForm: { | ||
23 | enabled: boolean | ||
24 | } | ||
25 | |||
18 | signup: { | 26 | signup: { |
19 | allowed: boolean, | 27 | allowed: boolean, |
20 | allowedForCurrentIP: boolean, | 28 | allowedForCurrentIP: boolean, |
@@ -70,4 +78,10 @@ export interface ServerConfig { | |||
70 | videoQuota: number | 78 | videoQuota: number |
71 | videoQuotaDaily: number | 79 | videoQuotaDaily: number |
72 | } | 80 | } |
81 | |||
82 | trending: { | ||
83 | videos: { | ||
84 | intervalDays: number | ||
85 | } | ||
86 | } | ||
73 | } | 87 | } |
diff --git a/shared/models/server/server-stats.model.ts b/shared/models/server/server-stats.model.ts index a6bd2d4d3..74f3de5d3 100644 --- a/shared/models/server/server-stats.model.ts +++ b/shared/models/server/server-stats.model.ts | |||
@@ -5,6 +5,7 @@ export interface ServerStats { | |||
5 | totalLocalVideos: number | 5 | totalLocalVideos: number |
6 | totalLocalVideoViews: number | 6 | totalLocalVideoViews: number |
7 | totalLocalVideoComments: number | 7 | totalLocalVideoComments: number |
8 | totalLocalVideoFilesSize: number | ||
8 | 9 | ||
9 | totalVideos: number | 10 | totalVideos: number |
10 | totalVideoComments: number | 11 | totalVideoComments: number |
diff --git a/shared/models/users/index.ts b/shared/models/users/index.ts index 7114741e0..cd07cf320 100644 --- a/shared/models/users/index.ts +++ b/shared/models/users/index.ts | |||
@@ -1,6 +1,8 @@ | |||
1 | export * from './user.model' | 1 | export * from './user.model' |
2 | export * from './user-create.model' | 2 | export * from './user-create.model' |
3 | export * from './user-login.model' | 3 | export * from './user-login.model' |
4 | export * from './user-notification.model' | ||
5 | export * from './user-notification-setting.model' | ||
4 | export * from './user-refresh-token.model' | 6 | export * from './user-refresh-token.model' |
5 | export * from './user-update.model' | 7 | export * from './user-update.model' |
6 | export * from './user-update-me.model' | 8 | export * from './user-update-me.model' |
diff --git a/shared/models/users/user-notification-setting.model.ts b/shared/models/users/user-notification-setting.model.ts new file mode 100644 index 000000000..531e12bba --- /dev/null +++ b/shared/models/users/user-notification-setting.model.ts | |||
@@ -0,0 +1,17 @@ | |||
1 | export enum UserNotificationSettingValue { | ||
2 | NONE = 0, | ||
3 | WEB = 1 << 0, | ||
4 | EMAIL = 1 << 1 | ||
5 | } | ||
6 | |||
7 | export interface UserNotificationSetting { | ||
8 | newVideoFromSubscription: UserNotificationSettingValue | ||
9 | newCommentOnMyVideo: UserNotificationSettingValue | ||
10 | videoAbuseAsModerator: UserNotificationSettingValue | ||
11 | blacklistOnMyVideo: UserNotificationSettingValue | ||
12 | myVideoPublished: UserNotificationSettingValue | ||
13 | myVideoImportFinished: UserNotificationSettingValue | ||
14 | newUserRegistration: UserNotificationSettingValue | ||
15 | newFollow: UserNotificationSettingValue | ||
16 | commentMention: UserNotificationSettingValue | ||
17 | } | ||
diff --git a/shared/models/users/user-notification.model.ts b/shared/models/users/user-notification.model.ts new file mode 100644 index 000000000..186b62612 --- /dev/null +++ b/shared/models/users/user-notification.model.ts | |||
@@ -0,0 +1,83 @@ | |||
1 | export enum UserNotificationType { | ||
2 | NEW_VIDEO_FROM_SUBSCRIPTION = 1, | ||
3 | NEW_COMMENT_ON_MY_VIDEO = 2, | ||
4 | NEW_VIDEO_ABUSE_FOR_MODERATORS = 3, | ||
5 | |||
6 | BLACKLIST_ON_MY_VIDEO = 4, | ||
7 | UNBLACKLIST_ON_MY_VIDEO = 5, | ||
8 | |||
9 | MY_VIDEO_PUBLISHED = 6, | ||
10 | |||
11 | MY_VIDEO_IMPORT_SUCCESS = 7, | ||
12 | MY_VIDEO_IMPORT_ERROR = 8, | ||
13 | |||
14 | NEW_USER_REGISTRATION = 9, | ||
15 | NEW_FOLLOW = 10, | ||
16 | COMMENT_MENTION = 11 | ||
17 | } | ||
18 | |||
19 | export interface VideoInfo { | ||
20 | id: number | ||
21 | uuid: string | ||
22 | name: string | ||
23 | } | ||
24 | |||
25 | export interface ActorInfo { | ||
26 | id: number | ||
27 | displayName: string | ||
28 | name: string | ||
29 | host: string | ||
30 | avatar?: { | ||
31 | path: string | ||
32 | } | ||
33 | } | ||
34 | |||
35 | export interface UserNotification { | ||
36 | id: number | ||
37 | type: UserNotificationType | ||
38 | read: boolean | ||
39 | |||
40 | video?: VideoInfo & { | ||
41 | channel: ActorInfo | ||
42 | } | ||
43 | |||
44 | videoImport?: { | ||
45 | id: number | ||
46 | video?: VideoInfo | ||
47 | torrentName?: string | ||
48 | magnetUri?: string | ||
49 | targetUrl?: string | ||
50 | } | ||
51 | |||
52 | comment?: { | ||
53 | id: number | ||
54 | threadId: number | ||
55 | account: ActorInfo | ||
56 | video: VideoInfo | ||
57 | } | ||
58 | |||
59 | videoAbuse?: { | ||
60 | id: number | ||
61 | video: VideoInfo | ||
62 | } | ||
63 | |||
64 | videoBlacklist?: { | ||
65 | id: number | ||
66 | video: VideoInfo | ||
67 | } | ||
68 | |||
69 | account?: ActorInfo | ||
70 | |||
71 | actorFollow?: { | ||
72 | id: number | ||
73 | follower: ActorInfo | ||
74 | following: { | ||
75 | type: 'account' | 'channel' | ||
76 | name: string | ||
77 | displayName: string | ||
78 | } | ||
79 | } | ||
80 | |||
81 | createdAt: string | ||
82 | updatedAt: string | ||
83 | } | ||
diff --git a/shared/models/users/user-right.enum.ts b/shared/models/users/user-right.enum.ts index 51c59d20a..090256bca 100644 --- a/shared/models/users/user-right.enum.ts +++ b/shared/models/users/user-right.enum.ts | |||
@@ -2,10 +2,15 @@ export enum UserRight { | |||
2 | ALL, | 2 | ALL, |
3 | 3 | ||
4 | MANAGE_USERS, | 4 | MANAGE_USERS, |
5 | |||
5 | MANAGE_SERVER_FOLLOW, | 6 | MANAGE_SERVER_FOLLOW, |
7 | |||
6 | MANAGE_SERVER_REDUNDANCY, | 8 | MANAGE_SERVER_REDUNDANCY, |
9 | |||
7 | MANAGE_VIDEO_ABUSES, | 10 | MANAGE_VIDEO_ABUSES, |
11 | |||
8 | MANAGE_JOBS, | 12 | MANAGE_JOBS, |
13 | |||
9 | MANAGE_CONFIGURATION, | 14 | MANAGE_CONFIGURATION, |
10 | 15 | ||
11 | MANAGE_ACCOUNTS_BLOCKLIST, | 16 | MANAGE_ACCOUNTS_BLOCKLIST, |
diff --git a/shared/models/users/user-role.ts b/shared/models/users/user-role.ts index adef8fd95..59c2ba106 100644 --- a/shared/models/users/user-role.ts +++ b/shared/models/users/user-role.ts | |||
@@ -29,7 +29,8 @@ const userRoleRights: { [ id: number ]: UserRight[] } = { | |||
29 | UserRight.UPDATE_ANY_VIDEO, | 29 | UserRight.UPDATE_ANY_VIDEO, |
30 | UserRight.SEE_ALL_VIDEOS, | 30 | UserRight.SEE_ALL_VIDEOS, |
31 | UserRight.MANAGE_ACCOUNTS_BLOCKLIST, | 31 | UserRight.MANAGE_ACCOUNTS_BLOCKLIST, |
32 | UserRight.MANAGE_SERVERS_BLOCKLIST | 32 | UserRight.MANAGE_SERVERS_BLOCKLIST, |
33 | UserRight.MANAGE_USERS | ||
33 | ], | 34 | ], |
34 | 35 | ||
35 | [UserRole.USER]: [] | 36 | [UserRole.USER]: [] |
diff --git a/shared/models/users/user-update-me.model.ts b/shared/models/users/user-update-me.model.ts index 10edeee2e..e24afab94 100644 --- a/shared/models/users/user-update-me.model.ts +++ b/shared/models/users/user-update-me.model.ts | |||
@@ -3,9 +3,12 @@ import { NSFWPolicyType } from '../videos/nsfw-policy.type' | |||
3 | export interface UserUpdateMe { | 3 | export interface UserUpdateMe { |
4 | displayName?: string | 4 | displayName?: string |
5 | description?: string | 5 | description?: string |
6 | nsfwPolicy?: NSFWPolicyType, | 6 | nsfwPolicy?: NSFWPolicyType |
7 | webTorrentEnabled?: boolean, | 7 | |
8 | webTorrentEnabled?: boolean | ||
8 | autoPlayVideo?: boolean | 9 | autoPlayVideo?: boolean |
10 | videosHistoryEnabled?: boolean | ||
11 | |||
9 | email?: string | 12 | email?: string |
10 | currentPassword?: string | 13 | currentPassword?: string |
11 | password?: string | 14 | password?: string |
diff --git a/shared/models/users/user.model.ts b/shared/models/users/user.model.ts index 82af17516..af783d389 100644 --- a/shared/models/users/user.model.ts +++ b/shared/models/users/user.model.ts | |||
@@ -2,6 +2,7 @@ import { Account } from '../actors' | |||
2 | import { VideoChannel } from '../videos/channel/video-channel.model' | 2 | import { VideoChannel } from '../videos/channel/video-channel.model' |
3 | import { UserRole } from './user-role' | 3 | import { UserRole } from './user-role' |
4 | import { NSFWPolicyType } from '../videos/nsfw-policy.type' | 4 | import { NSFWPolicyType } from '../videos/nsfw-policy.type' |
5 | import { UserNotificationSetting } from './user-notification-setting.model' | ||
5 | 6 | ||
6 | export interface User { | 7 | export interface User { |
7 | id: number | 8 | id: number |
@@ -9,12 +10,17 @@ export interface User { | |||
9 | email: string | 10 | email: string |
10 | emailVerified: boolean | 11 | emailVerified: boolean |
11 | nsfwPolicy: NSFWPolicyType | 12 | nsfwPolicy: NSFWPolicyType |
13 | |||
12 | autoPlayVideo: boolean | 14 | autoPlayVideo: boolean |
15 | webTorrentEnabled: boolean | ||
16 | videosHistoryEnabled: boolean | ||
17 | |||
13 | role: UserRole | 18 | role: UserRole |
14 | videoQuota: number | 19 | videoQuota: number |
15 | videoQuotaDaily: number | 20 | videoQuotaDaily: number |
16 | createdAt: Date | 21 | createdAt: Date |
17 | account: Account | 22 | account: Account |
23 | notificationSettings?: UserNotificationSetting | ||
18 | videoChannels?: VideoChannel[] | 24 | videoChannels?: VideoChannel[] |
19 | 25 | ||
20 | blocked: boolean | 26 | blocked: boolean |
diff --git a/shared/models/videos/blacklist/video-blacklist-create.model.ts b/shared/models/videos/blacklist/video-blacklist-create.model.ts index 89c69cb56..6e7d36421 100644 --- a/shared/models/videos/blacklist/video-blacklist-create.model.ts +++ b/shared/models/videos/blacklist/video-blacklist-create.model.ts | |||
@@ -1,3 +1,4 @@ | |||
1 | export interface VideoBlacklistCreate { | 1 | export interface VideoBlacklistCreate { |
2 | reason?: string | 2 | reason?: string |
3 | unfederate?: boolean | ||
3 | } | 4 | } |
diff --git a/shared/models/videos/blacklist/video-blacklist.model.ts b/shared/models/videos/blacklist/video-blacklist.model.ts index ef4e5e3a2..4bd976190 100644 --- a/shared/models/videos/blacklist/video-blacklist.model.ts +++ b/shared/models/videos/blacklist/video-blacklist.model.ts | |||
@@ -2,6 +2,7 @@ export interface VideoBlacklist { | |||
2 | id: number | 2 | id: number |
3 | createdAt: Date | 3 | createdAt: Date |
4 | updatedAt: Date | 4 | updatedAt: Date |
5 | unfederated: boolean | ||
5 | reason?: string | 6 | reason?: string |
6 | 7 | ||
7 | video: { | 8 | video: { |
diff --git a/shared/models/videos/video.model.ts b/shared/models/videos/video.model.ts index 4a9fa58b1..022876a0b 100644 --- a/shared/models/videos/video.model.ts +++ b/shared/models/videos/video.model.ts | |||
@@ -24,7 +24,7 @@ export interface VideoChannelAttribute { | |||
24 | displayName: string | 24 | displayName: string |
25 | url: string | 25 | url: string |
26 | host: string | 26 | host: string |
27 | avatar: Avatar | 27 | avatar?: Avatar |
28 | } | 28 | } |
29 | 29 | ||
30 | export interface AccountAttribute { | 30 | export interface AccountAttribute { |
@@ -34,7 +34,7 @@ export interface AccountAttribute { | |||
34 | displayName: string | 34 | displayName: string |
35 | url: string | 35 | url: string |
36 | host: string | 36 | host: string |
37 | avatar: Avatar | 37 | avatar?: Avatar |
38 | } | 38 | } |
39 | 39 | ||
40 | export interface Video { | 40 | export interface Video { |