aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/types
diff options
context:
space:
mode:
Diffstat (limited to 'server/types')
-rw-r--r--server/types/index.ts3
-rw-r--r--server/types/models/account/account-blocklist.ts2
-rw-r--r--server/types/models/account/account.ts2
-rw-r--r--server/types/models/account/actor-follow.ts2
-rw-r--r--server/types/models/account/actor.ts2
-rw-r--r--server/types/models/account/avatar.ts2
-rw-r--r--server/types/models/oauth/oauth-token.ts2
-rw-r--r--server/types/models/server/server-blocklist.ts2
-rw-r--r--server/types/models/server/server.ts2
-rw-r--r--server/types/models/user/user-notification.ts2
-rw-r--r--server/types/models/user/user.ts2
-rw-r--r--server/types/models/video/schedule-video-update.ts2
-rw-r--r--server/types/models/video/video-abuse.ts2
-rw-r--r--server/types/models/video/video-blacklist.ts2
-rw-r--r--server/types/models/video/video-caption.ts2
-rw-r--r--server/types/models/video/video-change-ownership.ts2
-rw-r--r--server/types/models/video/video-channels.ts2
-rw-r--r--server/types/models/video/video-comment.ts2
-rw-r--r--server/types/models/video/video-file.ts2
-rw-r--r--server/types/models/video/video-import.ts2
-rw-r--r--server/types/models/video/video-playlist-element.ts2
-rw-r--r--server/types/models/video/video-playlist.ts2
-rw-r--r--server/types/models/video/video-rate.ts2
-rw-r--r--server/types/models/video/video-redundancy.ts2
-rw-r--r--server/types/models/video/video-share.ts2
-rw-r--r--server/types/models/video/video-streaming-playlist.ts2
-rw-r--r--server/types/models/video/video.ts2
-rw-r--r--server/types/plugins/index.ts3
-rw-r--r--server/types/plugins/plugin-library.model.ts7
-rw-r--r--server/types/plugins/register-server-auth.model.ts52
-rw-r--r--server/types/plugins/register-server-option.model.ts84
-rw-r--r--server/types/utils.ts24
32 files changed, 175 insertions, 50 deletions
diff --git a/server/types/index.ts b/server/types/index.ts
new file mode 100644
index 000000000..18d3827a5
--- /dev/null
+++ b/server/types/index.ts
@@ -0,0 +1,3 @@
1export * from './plugins'
2export * from './activitypub-processor.model'
3export * from './sequelize'
diff --git a/server/types/models/account/account-blocklist.ts b/server/types/models/account/account-blocklist.ts
index 0d8bf11bd..3126fd0ab 100644
--- a/server/types/models/account/account-blocklist.ts
+++ b/server/types/models/account/account-blocklist.ts
@@ -1,5 +1,5 @@
1import { AccountBlocklistModel } from '../../../models/account/account-blocklist' 1import { AccountBlocklistModel } from '../../../models/account/account-blocklist'
2import { PickWith } from '../../utils' 2import { PickWith } from '@shared/core-utils'
3import { MAccountDefault, MAccountFormattable } from './account' 3import { MAccountDefault, MAccountFormattable } from './account'
4 4
5type Use<K extends keyof AccountBlocklistModel, M> = PickWith<AccountBlocklistModel, K, M> 5type Use<K extends keyof AccountBlocklistModel, M> = PickWith<AccountBlocklistModel, K, M>
diff --git a/server/types/models/account/account.ts b/server/types/models/account/account.ts
index 7b826ee04..d2add9810 100644
--- a/server/types/models/account/account.ts
+++ b/server/types/models/account/account.ts
@@ -13,7 +13,7 @@ import {
13 MActorSummaryFormattable, 13 MActorSummaryFormattable,
14 MActorUrl 14 MActorUrl
15} from './actor' 15} from './actor'
16import { FunctionProperties, PickWith } from '../../utils' 16import { FunctionProperties, PickWith } from '@shared/core-utils'
17import { MAccountBlocklistId } from './account-blocklist' 17import { MAccountBlocklistId } from './account-blocklist'
18import { MChannelDefault } from '../video/video-channels' 18import { MChannelDefault } from '../video/video-channels'
19 19
diff --git a/server/types/models/account/actor-follow.ts b/server/types/models/account/actor-follow.ts
index 5d0c03c8d..8c213d09c 100644
--- a/server/types/models/account/actor-follow.ts
+++ b/server/types/models/account/actor-follow.ts
@@ -8,7 +8,7 @@ import {
8 MActorHost, 8 MActorHost,
9 MActorUsername 9 MActorUsername
10} from './actor' 10} from './actor'
11import { PickWith } from '../../utils' 11import { PickWith } from '@shared/core-utils'
12import { ActorModel } from '@server/models/activitypub/actor' 12import { ActorModel } from '@server/models/activitypub/actor'
13import { MChannelDefault } from '../video/video-channels' 13import { MChannelDefault } from '../video/video-channels'
14 14
diff --git a/server/types/models/account/actor.ts b/server/types/models/account/actor.ts
index 1160e84cb..ee0d05f4e 100644
--- a/server/types/models/account/actor.ts
+++ b/server/types/models/account/actor.ts
@@ -1,5 +1,5 @@
1import { ActorModel } from '../../../models/activitypub/actor' 1import { ActorModel } from '../../../models/activitypub/actor'
2import { FunctionProperties, PickWith, PickWithOpt } from '../../utils' 2import { FunctionProperties, PickWith, PickWithOpt } from '@shared/core-utils'
3import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from './account' 3import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from './account'
4import { MServer, MServerHost, MServerHostBlocks, MServerRedundancyAllowed } from '../server' 4import { MServer, MServerHost, MServerHostBlocks, MServerRedundancyAllowed } from '../server'
5import { MAvatar, MAvatarFormattable } from './avatar' 5import { MAvatar, MAvatarFormattable } from './avatar'
diff --git a/server/types/models/account/avatar.ts b/server/types/models/account/avatar.ts
index 6eba59ee4..0489a8599 100644
--- a/server/types/models/account/avatar.ts
+++ b/server/types/models/account/avatar.ts
@@ -1,5 +1,5 @@
1import { AvatarModel } from '../../../models/avatar/avatar' 1import { AvatarModel } from '../../../models/avatar/avatar'
2import { FunctionProperties } from '@server/types/utils' 2import { FunctionProperties } from '@shared/core-utils'
3 3
4export type MAvatar = AvatarModel 4export type MAvatar = AvatarModel
5 5
diff --git a/server/types/models/oauth/oauth-token.ts b/server/types/models/oauth/oauth-token.ts
index 396cf6429..8399af8f1 100644
--- a/server/types/models/oauth/oauth-token.ts
+++ b/server/types/models/oauth/oauth-token.ts
@@ -1,5 +1,5 @@
1import { OAuthTokenModel } from '@server/models/oauth/oauth-token' 1import { OAuthTokenModel } from '@server/models/oauth/oauth-token'
2import { PickWith } from '@server/types/utils' 2import { PickWith } from '@shared/core-utils'
3import { MUserAccountUrl } from '../user/user' 3import { MUserAccountUrl } from '../user/user'
4 4
5type Use<K extends keyof OAuthTokenModel, M> = PickWith<OAuthTokenModel, K, M> 5type Use<K extends keyof OAuthTokenModel, M> = PickWith<OAuthTokenModel, K, M>
diff --git a/server/types/models/server/server-blocklist.ts b/server/types/models/server/server-blocklist.ts
index cfbf3b73a..801f179fd 100644
--- a/server/types/models/server/server-blocklist.ts
+++ b/server/types/models/server/server-blocklist.ts
@@ -1,5 +1,5 @@
1import { ServerBlocklistModel } from '@server/models/server/server-blocklist' 1import { ServerBlocklistModel } from '@server/models/server/server-blocklist'
2import { PickWith } from '@server/types/utils' 2import { PickWith } from '@shared/core-utils'
3import { MAccountDefault, MAccountFormattable } from '../account/account' 3import { MAccountDefault, MAccountFormattable } from '../account/account'
4import { MServer, MServerFormattable } from './server' 4import { MServer, MServerFormattable } from './server'
5 5
diff --git a/server/types/models/server/server.ts b/server/types/models/server/server.ts
index b35e55aeb..f8b053e3b 100644
--- a/server/types/models/server/server.ts
+++ b/server/types/models/server/server.ts
@@ -1,5 +1,5 @@
1import { ServerModel } from '../../../models/server/server' 1import { ServerModel } from '../../../models/server/server'
2import { FunctionProperties, PickWith } from '../../utils' 2import { FunctionProperties, PickWith } from '@shared/core-utils'
3import { MAccountBlocklistId } from '../account' 3import { MAccountBlocklistId } from '../account'
4 4
5type Use<K extends keyof ServerModel, M> = PickWith<ServerModel, K, M> 5type Use<K extends keyof ServerModel, M> = PickWith<ServerModel, K, M>
diff --git a/server/types/models/user/user-notification.ts b/server/types/models/user/user-notification.ts
index 2080360e1..dd3de423b 100644
--- a/server/types/models/user/user-notification.ts
+++ b/server/types/models/user/user-notification.ts
@@ -1,5 +1,5 @@
1import { UserNotificationModel } from '../../../models/account/user-notification' 1import { UserNotificationModel } from '../../../models/account/user-notification'
2import { PickWith, PickWithOpt } from '../../utils' 2import { PickWith, PickWithOpt } from '@shared/core-utils'
3import { VideoModel } from '../../../models/video/video' 3import { VideoModel } from '../../../models/video/video'
4import { ActorModel } from '../../../models/activitypub/actor' 4import { ActorModel } from '../../../models/activitypub/actor'
5import { ServerModel } from '../../../models/server/server' 5import { ServerModel } from '../../../models/server/server'
diff --git a/server/types/models/user/user.ts b/server/types/models/user/user.ts
index 7938ea288..12a68accf 100644
--- a/server/types/models/user/user.ts
+++ b/server/types/models/user/user.ts
@@ -1,5 +1,5 @@
1import { UserModel } from '../../../models/account/user' 1import { UserModel } from '../../../models/account/user'
2import { PickWith, PickWithOpt } from '../../utils' 2import { PickWith, PickWithOpt } from '@shared/core-utils'
3import { 3import {
4 MAccount, 4 MAccount,
5 MAccountDefault, 5 MAccountDefault,
diff --git a/server/types/models/video/schedule-video-update.ts b/server/types/models/video/schedule-video-update.ts
index 6336fdabe..5d2936000 100644
--- a/server/types/models/video/schedule-video-update.ts
+++ b/server/types/models/video/schedule-video-update.ts
@@ -1,5 +1,5 @@
1import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update' 1import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-update'
2import { PickWith } from '@server/types/utils' 2import { PickWith } from '@shared/core-utils'
3import { MVideoAPWithoutCaption, MVideoWithBlacklistLight } from './video' 3import { MVideoAPWithoutCaption, MVideoWithBlacklistLight } from './video'
4 4
5type Use<K extends keyof ScheduleVideoUpdateModel, M> = PickWith<ScheduleVideoUpdateModel, K, M> 5type Use<K extends keyof ScheduleVideoUpdateModel, M> = PickWith<ScheduleVideoUpdateModel, K, M>
diff --git a/server/types/models/video/video-abuse.ts b/server/types/models/video/video-abuse.ts
index d60f05e4c..279a87cf3 100644
--- a/server/types/models/video/video-abuse.ts
+++ b/server/types/models/video/video-abuse.ts
@@ -1,5 +1,5 @@
1import { VideoAbuseModel } from '../../../models/video/video-abuse' 1import { VideoAbuseModel } from '../../../models/video/video-abuse'
2import { PickWith } from '../../utils' 2import { PickWith } from '@shared/core-utils'
3import { MVideoAccountLightBlacklistAllFiles, MVideo } from './video' 3import { MVideoAccountLightBlacklistAllFiles, MVideo } from './video'
4import { MAccountDefault, MAccountFormattable } from '../account' 4import { MAccountDefault, MAccountFormattable } from '../account'
5 5
diff --git a/server/types/models/video/video-blacklist.ts b/server/types/models/video/video-blacklist.ts
index 08e59284a..2ac912405 100644
--- a/server/types/models/video/video-blacklist.ts
+++ b/server/types/models/video/video-blacklist.ts
@@ -1,5 +1,5 @@
1import { VideoBlacklistModel } from '../../../models/video/video-blacklist' 1import { VideoBlacklistModel } from '../../../models/video/video-blacklist'
2import { PickWith } from '@server/types/utils' 2import { PickWith } from '@shared/core-utils'
3import { MVideo, MVideoFormattable } from './video' 3import { MVideo, MVideoFormattable } from './video'
4 4
5type Use<K extends keyof VideoBlacklistModel, M> = PickWith<VideoBlacklistModel, K, M> 5type Use<K extends keyof VideoBlacklistModel, M> = PickWith<VideoBlacklistModel, K, M>
diff --git a/server/types/models/video/video-caption.ts b/server/types/models/video/video-caption.ts
index 9bb067001..ab80ff830 100644
--- a/server/types/models/video/video-caption.ts
+++ b/server/types/models/video/video-caption.ts
@@ -1,5 +1,5 @@
1import { VideoCaptionModel } from '../../../models/video/video-caption' 1import { VideoCaptionModel } from '../../../models/video/video-caption'
2import { FunctionProperties, PickWith } from '@server/types/utils' 2import { FunctionProperties, PickWith } from '@shared/core-utils'
3import { MVideo, MVideoUUID } from './video' 3import { MVideo, MVideoUUID } from './video'
4 4
5type Use<K extends keyof VideoCaptionModel, M> = PickWith<VideoCaptionModel, K, M> 5type Use<K extends keyof VideoCaptionModel, M> = PickWith<VideoCaptionModel, K, M>
diff --git a/server/types/models/video/video-change-ownership.ts b/server/types/models/video/video-change-ownership.ts
index 7421e081e..244d1a671 100644
--- a/server/types/models/video/video-change-ownership.ts
+++ b/server/types/models/video/video-change-ownership.ts
@@ -1,5 +1,5 @@
1import { VideoChangeOwnershipModel } from '@server/models/video/video-change-ownership' 1import { VideoChangeOwnershipModel } from '@server/models/video/video-change-ownership'
2import { PickWith } from '@server/types/utils' 2import { PickWith } from '@shared/core-utils'
3import { MAccountDefault, MAccountFormattable } from '../account/account' 3import { MAccountDefault, MAccountFormattable } from '../account/account'
4import { MVideo, MVideoWithAllFiles } from './video' 4import { MVideo, MVideoWithAllFiles } from './video'
5 5
diff --git a/server/types/models/video/video-channels.ts b/server/types/models/video/video-channels.ts
index 50f7c2d8a..2e05d8753 100644
--- a/server/types/models/video/video-channels.ts
+++ b/server/types/models/video/video-channels.ts
@@ -1,4 +1,4 @@
1import { FunctionProperties, PickWith, PickWithOpt } from '../../utils' 1import { FunctionProperties, PickWith, PickWithOpt } from '@shared/core-utils'
2import { VideoChannelModel } from '../../../models/video/video-channel' 2import { VideoChannelModel } from '../../../models/video/video-channel'
3import { 3import {
4 MAccountActor, 4 MAccountActor,
diff --git a/server/types/models/video/video-comment.ts b/server/types/models/video/video-comment.ts
index d6e0b66f5..f1c50c753 100644
--- a/server/types/models/video/video-comment.ts
+++ b/server/types/models/video/video-comment.ts
@@ -1,5 +1,5 @@
1import { VideoCommentModel } from '../../../models/video/video-comment' 1import { VideoCommentModel } from '../../../models/video/video-comment'
2import { PickWith, PickWithOpt } from '../../utils' 2import { PickWith, PickWithOpt } from '@shared/core-utils'
3import { MAccountDefault, MAccountFormattable, MAccountUrl } from '../account' 3import { MAccountDefault, MAccountFormattable, MAccountUrl } from '../account'
4import { MVideoAccountLight, MVideoFeed, MVideoIdUrl, MVideoUrl } from './video' 4import { MVideoAccountLight, MVideoFeed, MVideoIdUrl, MVideoUrl } from './video'
5 5
diff --git a/server/types/models/video/video-file.ts b/server/types/models/video/video-file.ts
index 3fcaca78f..327a148ce 100644
--- a/server/types/models/video/video-file.ts
+++ b/server/types/models/video/video-file.ts
@@ -1,5 +1,5 @@
1import { VideoFileModel } from '../../../models/video/video-file' 1import { VideoFileModel } from '../../../models/video/video-file'
2import { PickWith, PickWithOpt } from '../../utils' 2import { PickWith, PickWithOpt } from '@shared/core-utils'
3import { MVideo, MVideoUUID } from './video' 3import { MVideo, MVideoUUID } from './video'
4import { MVideoRedundancy, MVideoRedundancyFileUrl } from './video-redundancy' 4import { MVideoRedundancy, MVideoRedundancyFileUrl } from './video-redundancy'
5import { MStreamingPlaylistVideo, MStreamingPlaylist } from './video-streaming-playlist' 5import { MStreamingPlaylistVideo, MStreamingPlaylist } from './video-streaming-playlist'
diff --git a/server/types/models/video/video-import.ts b/server/types/models/video/video-import.ts
index f1385877e..759b13c6e 100644
--- a/server/types/models/video/video-import.ts
+++ b/server/types/models/video/video-import.ts
@@ -1,5 +1,5 @@
1import { VideoImportModel } from '@server/models/video/video-import' 1import { VideoImportModel } from '@server/models/video/video-import'
2import { PickWith, PickWithOpt } from '@server/types/utils' 2import { PickWith, PickWithOpt } from '@shared/core-utils'
3import { MVideo, MVideoAccountLight, MVideoFormattable, MVideoTag, MVideoThumbnail, MVideoWithFile } from './video' 3import { MVideo, MVideoAccountLight, MVideoFormattable, MVideoTag, MVideoThumbnail, MVideoWithFile } from './video'
4import { MUser } from '../user/user' 4import { MUser } from '../user/user'
5 5
diff --git a/server/types/models/video/video-playlist-element.ts b/server/types/models/video/video-playlist-element.ts
index c50992da7..f46ff4d49 100644
--- a/server/types/models/video/video-playlist-element.ts
+++ b/server/types/models/video/video-playlist-element.ts
@@ -1,5 +1,5 @@
1import { VideoPlaylistElementModel } from '@server/models/video/video-playlist-element' 1import { VideoPlaylistElementModel } from '@server/models/video/video-playlist-element'
2import { PickWith } from '@server/types/utils' 2import { PickWith } from '@shared/core-utils'
3import { MVideoFormattable, MVideoThumbnail, MVideoUrl } from './video' 3import { MVideoFormattable, MVideoThumbnail, MVideoUrl } from './video'
4import { MVideoPlaylistPrivacy } from './video-playlist' 4import { MVideoPlaylistPrivacy } from './video-playlist'
5 5
diff --git a/server/types/models/video/video-playlist.ts b/server/types/models/video/video-playlist.ts
index b504d1664..79e2daebf 100644
--- a/server/types/models/video/video-playlist.ts
+++ b/server/types/models/video/video-playlist.ts
@@ -1,5 +1,5 @@
1import { VideoPlaylistModel } from '../../../models/video/video-playlist' 1import { VideoPlaylistModel } from '../../../models/video/video-playlist'
2import { PickWith } from '../../utils' 2import { PickWith } from '@shared/core-utils'
3import { MAccount, MAccountDefault, MAccountSummary, MAccountSummaryFormattable } from '../account' 3import { MAccount, MAccountDefault, MAccountSummary, MAccountSummaryFormattable } from '../account'
4import { MThumbnail } from './thumbnail' 4import { MThumbnail } from './thumbnail'
5import { MChannelDefault, MChannelSummary, MChannelSummaryFormattable, MChannelUrl } from './video-channels' 5import { MChannelDefault, MChannelSummary, MChannelSummaryFormattable, MChannelUrl } from './video-channels'
diff --git a/server/types/models/video/video-rate.ts b/server/types/models/video/video-rate.ts
index a7682ef31..7bd54f7b0 100644
--- a/server/types/models/video/video-rate.ts
+++ b/server/types/models/video/video-rate.ts
@@ -1,5 +1,5 @@
1import { AccountVideoRateModel } from '@server/models/account/account-video-rate' 1import { AccountVideoRateModel } from '@server/models/account/account-video-rate'
2import { PickWith } from '@server/types/utils' 2import { PickWith } from '@shared/core-utils'
3import { MAccountAudience, MAccountUrl } from '../account/account' 3import { MAccountAudience, MAccountUrl } from '../account/account'
4import { MVideo, MVideoFormattable } from './video' 4import { MVideo, MVideoFormattable } from './video'
5 5
diff --git a/server/types/models/video/video-redundancy.ts b/server/types/models/video/video-redundancy.ts
index 7c7d52035..411375c81 100644
--- a/server/types/models/video/video-redundancy.ts
+++ b/server/types/models/video/video-redundancy.ts
@@ -1,5 +1,5 @@
1import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy' 1import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy'
2import { PickWith, PickWithOpt } from '@server/types/utils' 2import { PickWith, PickWithOpt } from '@shared/core-utils'
3import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist' 3import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist'
4import { VideoFileModel } from '@server/models/video/video-file' 4import { VideoFileModel } from '@server/models/video/video-file'
5import { MVideoFile, MVideoFileVideo } from './video-file' 5import { MVideoFile, MVideoFileVideo } from './video-file'
diff --git a/server/types/models/video/video-share.ts b/server/types/models/video/video-share.ts
index 50ca75d26..b7a783bb6 100644
--- a/server/types/models/video/video-share.ts
+++ b/server/types/models/video/video-share.ts
@@ -1,5 +1,5 @@
1import { VideoShareModel } from '../../../models/video/video-share' 1import { VideoShareModel } from '../../../models/video/video-share'
2import { PickWith } from '../../utils' 2import { PickWith } from '@shared/core-utils'
3import { MActorDefault } from '../account' 3import { MActorDefault } from '../account'
4import { MVideo } from './video' 4import { MVideo } from './video'
5 5
diff --git a/server/types/models/video/video-streaming-playlist.ts b/server/types/models/video/video-streaming-playlist.ts
index 3f54aa560..8b3ef51fc 100644
--- a/server/types/models/video/video-streaming-playlist.ts
+++ b/server/types/models/video/video-streaming-playlist.ts
@@ -1,5 +1,5 @@
1import { VideoStreamingPlaylistModel } from '../../../models/video/video-streaming-playlist' 1import { VideoStreamingPlaylistModel } from '../../../models/video/video-streaming-playlist'
2import { PickWith, PickWithOpt } from '../../utils' 2import { PickWith, PickWithOpt } from '@shared/core-utils'
3import { MVideoRedundancyFileUrl, MVideoRedundancy } from './video-redundancy' 3import { MVideoRedundancyFileUrl, MVideoRedundancy } from './video-redundancy'
4import { MVideo } from './video' 4import { MVideo } from './video'
5import { MVideoFile } from './video-file' 5import { MVideoFile } from './video-file'
diff --git a/server/types/models/video/video.ts b/server/types/models/video/video.ts
index 022a9566d..3d8f85b3d 100644
--- a/server/types/models/video/video.ts
+++ b/server/types/models/video/video.ts
@@ -1,5 +1,5 @@
1import { VideoModel } from '../../../models/video/video' 1import { VideoModel } from '../../../models/video/video'
2import { PickWith, PickWithOpt } from '../../utils' 2import { PickWith, PickWithOpt } from '@shared/core-utils'
3import { 3import {
4 MChannelAccountDefault, 4 MChannelAccountDefault,
5 MChannelAccountLight, 5 MChannelAccountLight,
diff --git a/server/types/plugins/index.ts b/server/types/plugins/index.ts
new file mode 100644
index 000000000..de30ff2ab
--- /dev/null
+++ b/server/types/plugins/index.ts
@@ -0,0 +1,3 @@
1export * from './plugin-library.model'
2export * from './register-server-auth.model'
3export * from './register-server-option.model'
diff --git a/server/types/plugins/plugin-library.model.ts b/server/types/plugins/plugin-library.model.ts
new file mode 100644
index 000000000..5b517ee9f
--- /dev/null
+++ b/server/types/plugins/plugin-library.model.ts
@@ -0,0 +1,7 @@
1import { RegisterServerOptions } from './register-server-option.model'
2
3export interface PluginLibrary {
4 register: (options: RegisterServerOptions) => Promise<any>
5
6 unregister: () => Promise<any>
7}
diff --git a/server/types/plugins/register-server-auth.model.ts b/server/types/plugins/register-server-auth.model.ts
new file mode 100644
index 000000000..31c71b0d0
--- /dev/null
+++ b/server/types/plugins/register-server-auth.model.ts
@@ -0,0 +1,52 @@
1import * as express from 'express'
2import { UserRole } from '@shared/models'
3import { MOAuthToken, MUser } from '../models'
4
5export type RegisterServerAuthOptions = RegisterServerAuthPassOptions | RegisterServerAuthExternalOptions
6
7export interface RegisterServerAuthenticatedResult {
8 username: string
9 email: string
10 role?: UserRole
11 displayName?: string
12}
13
14export interface RegisterServerExternalAuthenticatedResult extends RegisterServerAuthenticatedResult {
15 req: express.Request
16 res: express.Response
17}
18
19interface RegisterServerAuthBase {
20 // Authentication name (a plugin can register multiple auth strategies)
21 authName: string
22
23 // Called by PeerTube when a user from your plugin logged out
24 onLogout?(user: MUser): void
25
26 // Your plugin can hook PeerTube access/refresh token validity
27 // So you can control for your plugin the user session lifetime
28 hookTokenValidity?(options: { token: MOAuthToken, type: 'access' | 'refresh' }): Promise<{ valid: boolean }>
29}
30
31export interface RegisterServerAuthPassOptions extends RegisterServerAuthBase {
32 // Weight of this authentication so PeerTube tries the auth methods in DESC weight order
33 getWeight(): number
34
35 // Used by PeerTube to login a user
36 // Returns null if the login failed, or { username, email } on success
37 login(body: {
38 id: string
39 password: string
40 }): Promise<RegisterServerAuthenticatedResult | null>
41}
42
43export interface RegisterServerAuthExternalOptions extends RegisterServerAuthBase {
44 // Will be displayed in a block next to the login form
45 authDisplayName: () => string
46
47 onAuthRequest: (req: express.Request, res: express.Response) => void
48}
49
50export interface RegisterServerAuthExternalResult {
51 userAuthenticated (options: RegisterServerExternalAuthenticatedResult): void
52}
diff --git a/server/types/plugins/register-server-option.model.ts b/server/types/plugins/register-server-option.model.ts
new file mode 100644
index 000000000..74303d383
--- /dev/null
+++ b/server/types/plugins/register-server-option.model.ts
@@ -0,0 +1,84 @@
1import * as Bluebird from 'bluebird'
2import { Router } from 'express'
3import { Logger } from 'winston'
4import { ActorModel } from '@server/models/activitypub/actor'
5import {
6 PluginPlaylistPrivacyManager,
7 PluginSettingsManager,
8 PluginStorageManager,
9 PluginVideoCategoryManager,
10 PluginVideoLanguageManager,
11 PluginVideoLicenceManager,
12 PluginVideoPrivacyManager,
13 RegisterServerHookOptions,
14 RegisterServerSettingOptions,
15 VideoBlacklistCreate
16} from '@shared/models'
17import { MVideoThumbnail } from '../models'
18import {
19 RegisterServerAuthExternalOptions,
20 RegisterServerAuthExternalResult,
21 RegisterServerAuthPassOptions
22} from './register-server-auth.model'
23
24export type PeerTubeHelpers = {
25 logger: Logger
26
27 database: {
28 query: Function
29 }
30
31 videos: {
32 loadByUrl: (url: string) => Bluebird<MVideoThumbnail>
33
34 removeVideo: (videoId: number) => Promise<void>
35 }
36
37 config: {
38 getWebserverUrl: () => string
39 }
40
41 moderation: {
42 blockServer: (options: { byAccountId: number, hostToBlock: string }) => Promise<void>
43 unblockServer: (options: { byAccountId: number, hostToUnblock: string }) => Promise<void>
44 blockAccount: (options: { byAccountId: number, handleToBlock: string }) => Promise<void>
45 unblockAccount: (options: { byAccountId: number, handleToUnblock: string }) => Promise<void>
46
47 blacklistVideo: (options: { videoIdOrUUID: number | string, createOptions: VideoBlacklistCreate }) => Promise<void>
48 unblacklistVideo: (options: { videoIdOrUUID: number | string }) => Promise<void>
49 }
50
51 server: {
52 getServerActor: () => Promise<ActorModel>
53 }
54}
55
56export type RegisterServerOptions = {
57 registerHook: (options: RegisterServerHookOptions) => void
58
59 registerSetting: (options: RegisterServerSettingOptions) => void
60
61 settingsManager: PluginSettingsManager
62
63 storageManager: PluginStorageManager
64
65 videoCategoryManager: PluginVideoCategoryManager
66 videoLanguageManager: PluginVideoLanguageManager
67 videoLicenceManager: PluginVideoLicenceManager
68
69 videoPrivacyManager: PluginVideoPrivacyManager
70 playlistPrivacyManager: PluginPlaylistPrivacyManager
71
72 registerIdAndPassAuth: (options: RegisterServerAuthPassOptions) => void
73 registerExternalAuth: (options: RegisterServerAuthExternalOptions) => RegisterServerAuthExternalResult
74 unregisterIdAndPassAuth: (authName: string) => void
75 unregisterExternalAuth: (authName: string) => void
76
77 // Get plugin router to create custom routes
78 // Base routes of this router are
79 // * /plugins/:pluginName/:pluginVersion/router/...
80 // * /plugins/:pluginName/router/...
81 getRouter(): Router
82
83 peertubeHelpers: PeerTubeHelpers
84}
diff --git a/server/types/utils.ts b/server/types/utils.ts
deleted file mode 100644
index 55500d8c4..000000000
--- a/server/types/utils.ts
+++ /dev/null
@@ -1,24 +0,0 @@
1/* eslint-disable @typescript-eslint/array-type */
2
3export type FunctionPropertyNames<T> = {
4 [K in keyof T]: T[K] extends Function ? K : never
5}[keyof T]
6
7export type FunctionProperties<T> = Pick<T, FunctionPropertyNames<T>>
8
9export type PickWith<T, KT extends keyof T, V> = {
10 [P in KT]: T[P] extends V ? V : never
11}
12
13export type PickWithOpt<T, KT extends keyof T, V> = {
14 [P in KT]?: T[P] extends V ? V : never
15}
16
17// https://github.com/krzkaczor/ts-essentials Rocks!
18export type DeepPartial<T> = {
19 [P in keyof T]?: T[P] extends Array<infer U>
20 ? Array<DeepPartial<U>>
21 : T[P] extends ReadonlyArray<infer U>
22 ? ReadonlyArray<DeepPartial<U>>
23 : DeepPartial<T[P]>
24}