]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/typings/express/index.d.ts
Refactor auth flow
[github/Chocobozzz/PeerTube.git] / server / typings / express / index.d.ts
index 7595e6d86c22ceaafd3bef731f3fd74e1dcc7788..b0004dc7b7818a48ed0355e7a94023c43147f26c 100644 (file)
@@ -1,12 +1,14 @@
 import { RegisterServerAuthExternalOptions } from '@server/types'
 import {
-  MAbuse,
+  MAbuseMessage,
+  MAbuseReporter,
   MAccountBlocklist,
   MActorUrl,
   MStreamingPlaylist,
   MVideoChangeOwnershipFull,
   MVideoFile,
   MVideoImmutable,
+  MVideoLive,
   MVideoPlaylistFull,
   MVideoPlaylistFullSummary
 } from '@server/types/models'
@@ -15,7 +17,6 @@ import { MPlugin, MServer, MServerBlocklist } from '@server/types/models/server'
 import { MVideoImportDefault } from '@server/types/models/video/video-import'
 import { MVideoPlaylistElement, MVideoPlaylistElementVideoUrlPlaylistPrivacy } from '@server/types/models/video/video-playlist-element'
 import { MAccountVideoRateAccountVideo } from '@server/types/models/video/video-rate'
-import { UserRole } from '@shared/models'
 import { RegisteredPlugin } from '../../lib/plugins/plugin-manager'
 import {
   MAccountDefault,
@@ -41,94 +42,81 @@ declare module 'express' {
   export interface Request {
     query: any
   }
-
   interface Response {
+    locals: PeerTubeLocals
+  }
+}
 
-    locals: {
-      bypassLogin?: {
-        bypass: boolean
-        pluginName: string
-        authName?: string
-        user: {
-          username: string
-          email: string
-          displayName: string
-          role: UserRole
-        }
-      }
-
-      refreshTokenAuthName?: string
-
-      explicitLogout: boolean
+interface PeerTubeLocals {
+  videoAll?: MVideoFullLight
+  onlyImmutableVideo?: MVideoImmutable
+  onlyVideo?: MVideoThumbnail
+  onlyVideoWithRights?: MVideoWithRights
+  videoId?: MVideoIdThumbnail
 
-      videoAll?: MVideoFullLight
-      onlyImmutableVideo?: MVideoImmutable
-      onlyVideo?: MVideoThumbnail
-      onlyVideoWithRights?: MVideoWithRights
-      videoId?: MVideoIdThumbnail
+  videoLive?: MVideoLive
 
-      videoShare?: MVideoShareActor
+  videoShare?: MVideoShareActor
 
-      videoFile?: MVideoFile
+  videoFile?: MVideoFile
 
-      videoImport?: MVideoImportDefault
+  videoImport?: MVideoImportDefault
 
-      videoBlacklist?: MVideoBlacklist
+  videoBlacklist?: MVideoBlacklist
 
-      videoCaption?: MVideoCaptionVideo
+  videoCaption?: MVideoCaptionVideo
 
-      abuse?: MAbuse
+  abuse?: MAbuseReporter
+  abuseMessage?: MAbuseMessage
 
-      videoStreamingPlaylist?: MStreamingPlaylist
+  videoStreamingPlaylist?: MStreamingPlaylist
 
-      videoChannel?: MChannelAccountDefault
+  videoChannel?: MChannelAccountDefault
 
-      videoPlaylistFull?: MVideoPlaylistFull
-      videoPlaylistSummary?: MVideoPlaylistFullSummary
+  videoPlaylistFull?: MVideoPlaylistFull
+  videoPlaylistSummary?: MVideoPlaylistFullSummary
 
-      videoPlaylistElement?: MVideoPlaylistElement
-      videoPlaylistElementAP?: MVideoPlaylistElementVideoUrlPlaylistPrivacy
+  videoPlaylistElement?: MVideoPlaylistElement
+  videoPlaylistElementAP?: MVideoPlaylistElementVideoUrlPlaylistPrivacy
 
-      accountVideoRate?: MAccountVideoRateAccountVideo
+  accountVideoRate?: MAccountVideoRateAccountVideo
 
-      videoCommentFull?: MCommentOwnerVideoReply
-      videoCommentThread?: MComment
+  videoCommentFull?: MCommentOwnerVideoReply
+  videoCommentThread?: MComment
 
-      follow?: MActorFollowActorsDefault
-      subscription?: MActorFollowActorsDefaultSubscription
+  follow?: MActorFollowActorsDefault
+  subscription?: MActorFollowActorsDefaultSubscription
 
-      nextOwner?: MAccountDefault
-      videoChangeOwnership?: MVideoChangeOwnershipFull
+  nextOwner?: MAccountDefault
+  videoChangeOwnership?: MVideoChangeOwnershipFull
 
-      account?: MAccountDefault
+  account?: MAccountDefault
 
-      actorUrl?: MActorUrl
-      actorFull?: MActorFull
+  actorUrl?: MActorUrl
+  actorFull?: MActorFull
 
-      user?: MUserDefault
+  user?: MUserDefault
 
-      server?: MServer
+  server?: MServer
 
-      videoRedundancy?: MVideoRedundancyVideo
+  videoRedundancy?: MVideoRedundancyVideo
 
-      accountBlock?: MAccountBlocklist
-      serverBlock?: MServerBlocklist
+  accountBlock?: MAccountBlocklist
+  serverBlock?: MServerBlocklist
 
-      oauth?: {
-        token: MOAuthTokenUser
-      }
+  oauth?: {
+    token: MOAuthTokenUser
+  }
 
-      signature?: {
-        actor: MActorAccountChannelId
-      }
+  signature?: {
+    actor: MActorAccountChannelId
+  }
 
-      authenticated?: boolean
+  authenticated?: boolean
 
-      registeredPlugin?: RegisteredPlugin
+  registeredPlugin?: RegisteredPlugin
 
-      externalAuth?: RegisterServerAuthExternalOptions
+  externalAuth?: RegisterServerAuthExternalOptions
 
-      plugin?: MPlugin
-    }
-  }
+  plugin?: MPlugin
 }