aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/typings
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-04-22 16:07:04 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-05-04 16:21:39 +0200
commit7fed637506043e4432cbebe041ada0625171cceb (patch)
tree07f174e17c4b4a0b3d43a0fa6944865c06234338 /server/typings
parent8d4197637868d5cde49434e937186b57e40f4b2b (diff)
downloadPeerTube-7fed637506043e4432cbebe041ada0625171cceb.tar.gz
PeerTube-7fed637506043e4432cbebe041ada0625171cceb.tar.zst
PeerTube-7fed637506043e4432cbebe041ada0625171cceb.zip
Begin auth plugin support
Diffstat (limited to 'server/typings')
-rw-r--r--server/typings/express.ts13
-rw-r--r--server/typings/plugins/register-server-option.model.ts4
2 files changed, 16 insertions, 1 deletions
diff --git a/server/typings/express.ts b/server/typings/express.ts
index f4188bf3d..ebccf7f7d 100644
--- a/server/typings/express.ts
+++ b/server/typings/express.ts
@@ -28,12 +28,23 @@ import { MVideoChangeOwnershipFull } from './models/video/video-change-ownership
28import { MPlugin, MServer } from '@server/typings/models/server' 28import { MPlugin, MServer } from '@server/typings/models/server'
29import { MServerBlocklist } from './models/server/server-blocklist' 29import { MServerBlocklist } from './models/server/server-blocklist'
30import { MOAuthTokenUser } from '@server/typings/models/oauth/oauth-token' 30import { MOAuthTokenUser } from '@server/typings/models/oauth/oauth-token'
31import { UserRole } from '@shared/models'
31 32
32declare module 'express' { 33declare module 'express' {
33
34 interface Response { 34 interface Response {
35 35
36 locals: { 36 locals: {
37 bypassLogin?: {
38 bypass: boolean
39 pluginName: string
40 user: {
41 username: string
42 email: string
43 displayName: string
44 role: UserRole
45 }
46 }
47
37 videoAll?: MVideoFullLight 48 videoAll?: MVideoFullLight
38 onlyImmutableVideo?: MVideoImmutable 49 onlyImmutableVideo?: MVideoImmutable
39 onlyVideo?: MVideoThumbnail 50 onlyVideo?: MVideoThumbnail
diff --git a/server/typings/plugins/register-server-option.model.ts b/server/typings/plugins/register-server-option.model.ts
index 813e93003..0c0993c14 100644
--- a/server/typings/plugins/register-server-option.model.ts
+++ b/server/typings/plugins/register-server-option.model.ts
@@ -9,6 +9,7 @@ import { Logger } from 'winston'
9import { Router } from 'express' 9import { Router } from 'express'
10import { PluginVideoPrivacyManager } from '@shared/models/plugins/plugin-video-privacy-manager.model' 10import { PluginVideoPrivacyManager } from '@shared/models/plugins/plugin-video-privacy-manager.model'
11import { PluginPlaylistPrivacyManager } from '@shared/models/plugins/plugin-playlist-privacy-manager.model' 11import { PluginPlaylistPrivacyManager } from '@shared/models/plugins/plugin-playlist-privacy-manager.model'
12import { RegisterServerAuthPassOptions, RegisterServerAuthExternalOptions, RegisterServerAuthExternalResult } from '@shared/models/plugins/register-server-auth.model'
12 13
13export type PeerTubeHelpers = { 14export type PeerTubeHelpers = {
14 logger: Logger 15 logger: Logger
@@ -38,6 +39,9 @@ export type RegisterServerOptions = {
38 videoPrivacyManager: PluginVideoPrivacyManager 39 videoPrivacyManager: PluginVideoPrivacyManager
39 playlistPrivacyManager: PluginPlaylistPrivacyManager 40 playlistPrivacyManager: PluginPlaylistPrivacyManager
40 41
42 registerIdAndPassAuth: (options: RegisterServerAuthPassOptions) => void
43 registerExternalAuth: (options: RegisterServerAuthExternalOptions) => RegisterServerAuthExternalResult
44
41 // Get plugin router to create custom routes 45 // Get plugin router to create custom routes
42 // Base routes of this router are 46 // Base routes of this router are
43 // * /plugins/:pluginName/:pluginVersion/router/... 47 // * /plugins/:pluginName/:pluginVersion/router/...