aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/models/plugins
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-06-23 14:10:17 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-06-23 16:00:49 +0200
commit67ed6552b831df66713bac9e672738796128d33f (patch)
tree59c97d41e0b49d75a90aa3de987968ab9b1ff447 /shared/models/plugins
parent0c4bacbff53bc732f5a2677d62a6ead7752e2405 (diff)
downloadPeerTube-67ed6552b831df66713bac9e672738796128d33f.tar.gz
PeerTube-67ed6552b831df66713bac9e672738796128d33f.tar.zst
PeerTube-67ed6552b831df66713bac9e672738796128d33f.zip
Reorganize client shared modules
Diffstat (limited to 'shared/models/plugins')
-rw-r--r--shared/models/plugins/index.ts24
-rw-r--r--shared/models/plugins/plugin-playlist-privacy-manager.model.ts2
-rw-r--r--shared/models/plugins/plugin-video-privacy-manager.model.ts2
-rw-r--r--shared/models/plugins/register-server-auth.model.ts52
4 files changed, 26 insertions, 54 deletions
diff --git a/shared/models/plugins/index.ts b/shared/models/plugins/index.ts
new file mode 100644
index 000000000..209fca791
--- /dev/null
+++ b/shared/models/plugins/index.ts
@@ -0,0 +1,24 @@
1export * from './client-hook.model'
2export * from './hook-type.enum'
3export * from './install-plugin.model'
4export * from './manage-plugin.model'
5export * from './peertube-plugin-index-list.model'
6export * from './peertube-plugin-index.model'
7export * from './peertube-plugin-latest-version.model'
8export * from './peertube-plugin.model'
9export * from './plugin-client-scope.type'
10export * from './plugin-package-json.model'
11export * from './plugin-playlist-privacy-manager.model'
12export * from './plugin-settings-manager.model'
13export * from './plugin-storage-manager.model'
14export * from './plugin-translation.model'
15export * from './plugin-video-category-manager.model'
16export * from './plugin-video-language-manager.model'
17export * from './plugin-video-licence-manager.model'
18export * from './plugin-video-privacy-manager.model'
19export * from './plugin.type'
20export * from './public-server.setting'
21export * from './register-client-hook.model'
22export * from './register-server-hook.model'
23export * from './register-server-setting.model'
24export * from './server-hook.model'
diff --git a/shared/models/plugins/plugin-playlist-privacy-manager.model.ts b/shared/models/plugins/plugin-playlist-privacy-manager.model.ts
index f9630c77f..d1823ef4e 100644
--- a/shared/models/plugins/plugin-playlist-privacy-manager.model.ts
+++ b/shared/models/plugins/plugin-playlist-privacy-manager.model.ts
@@ -1,4 +1,4 @@
1import { VideoPlaylistPrivacy } from '@shared/models' 1import { VideoPlaylistPrivacy } from '../videos/playlist/video-playlist-privacy.model'
2 2
3export interface PluginPlaylistPrivacyManager { 3export interface PluginPlaylistPrivacyManager {
4 // PUBLIC = 1, 4 // PUBLIC = 1,
diff --git a/shared/models/plugins/plugin-video-privacy-manager.model.ts b/shared/models/plugins/plugin-video-privacy-manager.model.ts
index d602ba297..c0e8117b5 100644
--- a/shared/models/plugins/plugin-video-privacy-manager.model.ts
+++ b/shared/models/plugins/plugin-video-privacy-manager.model.ts
@@ -1,4 +1,4 @@
1import { VideoPrivacy } from '@shared/models' 1import { VideoPrivacy } from '@shared/models/videos/video-privacy.enum'
2 2
3export interface PluginVideoPrivacyManager { 3export interface PluginVideoPrivacyManager {
4 // PUBLIC = 1 4 // PUBLIC = 1
diff --git a/shared/models/plugins/register-server-auth.model.ts b/shared/models/plugins/register-server-auth.model.ts
deleted file mode 100644
index fc6f0f258..000000000
--- a/shared/models/plugins/register-server-auth.model.ts
+++ /dev/null
@@ -1,52 +0,0 @@
1import { UserRole } from '@shared/models'
2import { MOAuthToken, MUser } from '@server/types/models'
3import * as express from 'express'
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}