Federated video streaming platform using ActivityPub and P2P in the web browser with Angular. https://joinpeertube.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

190 lines
5.0 KiB

  1. import { OutgoingHttpHeaders } from 'http'
  2. import { RegisterServerAuthExternalOptions } from '@server/types'
  3. import {
  4. MAbuseMessage,
  5. MAbuseReporter,
  6. MAccountBlocklist,
  7. MActorFollowActorsDefault,
  8. MActorUrl,
  9. MChannelBannerAccountDefault,
  10. MStreamingPlaylist,
  11. MVideoChangeOwnershipFull,
  12. MVideoFile,
  13. MVideoFormattableDetails,
  14. MVideoId,
  15. MVideoImmutable,
  16. MVideoLive,
  17. MVideoPlaylistFull,
  18. MVideoPlaylistFullSummary
  19. } from '@server/types/models'
  20. import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token'
  21. import { MPlugin, MServer, MServerBlocklist } from '@server/types/models/server'
  22. import { MVideoImportDefault } from '@server/types/models/video/video-import'
  23. import { MVideoPlaylistElement, MVideoPlaylistElementVideoUrlPlaylistPrivacy } from '@server/types/models/video/video-playlist-element'
  24. import { MAccountVideoRateAccountVideo } from '@server/types/models/video/video-rate'
  25. import { HttpMethod, PeerTubeProblemDocumentData, ServerErrorCode, VideoCreate } from '@shared/models'
  26. import { File as UploadXFile, Metadata } from '@uploadx/core'
  27. import { RegisteredPlugin } from '../../lib/plugins/plugin-manager'
  28. import {
  29. MAccountDefault,
  30. MActorAccountChannelId,
  31. MActorFollowActorsDefaultSubscription,
  32. MActorFull,
  33. MComment,
  34. MCommentOwnerVideoReply,
  35. MUserDefault,
  36. MVideoBlacklist,
  37. MVideoCaptionVideo,
  38. MVideoFullLight,
  39. MVideoRedundancyVideo,
  40. MVideoShareActor,
  41. MVideoThumbnail
  42. } from '../../types/models'
  43. import { Writable } from 'stream'
  44. declare module 'express' {
  45. export interface Request {
  46. query: any
  47. method: HttpMethod
  48. }
  49. // Upload using multer or uploadx middleware
  50. export type MulterOrUploadXFile = UploadXFile | Express.Multer.File
  51. export type UploadFiles = {
  52. [fieldname: string]: MulterOrUploadXFile[]
  53. } | MulterOrUploadXFile[]
  54. // Partial object used by some functions to check the file mimetype/extension
  55. export type UploadFileForCheck = {
  56. originalname: string
  57. mimetype: string
  58. }
  59. export type UploadFilesForCheck = {
  60. [fieldname: string]: UploadFileForCheck[]
  61. } | UploadFileForCheck[]
  62. // Upload file with a duration added by our middleware
  63. export type VideoUploadFile = Pick<Express.Multer.File, 'path' | 'filename' | 'size'> & {
  64. duration: number
  65. }
  66. // Extends Metadata property of UploadX object
  67. export type UploadXFileMetadata = Metadata & VideoCreate & {
  68. previewfile: Express.Multer.File[]
  69. thumbnailfile: Express.Multer.File[]
  70. }
  71. // Our custom UploadXFile object using our custom metadata
  72. export type CustomUploadXFile <T extends Metadata> = UploadXFile & { metadata: T }
  73. export type EnhancedUploadXFile = CustomUploadXFile<UploadXFileMetadata> & {
  74. duration: number
  75. path: string
  76. filename: string
  77. }
  78. // Extends Response with added functions and potential variables passed by middlewares
  79. interface Response {
  80. fail: (options: {
  81. message: string
  82. title?: string
  83. status?: number
  84. type?: ServerErrorCode
  85. instance?: string
  86. data?: PeerTubeProblemDocumentData
  87. }) => void
  88. locals: {
  89. apicache: {
  90. content: string | Buffer
  91. write: Writable['write']
  92. writeHead: Response['writeHead']
  93. end: Response['end']
  94. cacheable: boolean
  95. headers: OutgoingHttpHeaders
  96. }
  97. docUrl?: string
  98. videoAPI?: MVideoFormattableDetails
  99. videoAll?: MVideoFullLight
  100. onlyImmutableVideo?: MVideoImmutable
  101. onlyVideo?: MVideoThumbnail
  102. videoId?: MVideoId
  103. videoLive?: MVideoLive
  104. videoShare?: MVideoShareActor
  105. videoFile?: MVideoFile
  106. videoFileResumable?: EnhancedUploadXFile
  107. videoImport?: MVideoImportDefault
  108. videoBlacklist?: MVideoBlacklist
  109. videoCaption?: MVideoCaptionVideo
  110. abuse?: MAbuseReporter
  111. abuseMessage?: MAbuseMessage
  112. videoStreamingPlaylist?: MStreamingPlaylist
  113. videoChannel?: MChannelBannerAccountDefault
  114. videoPlaylistFull?: MVideoPlaylistFull
  115. videoPlaylistSummary?: MVideoPlaylistFullSummary
  116. videoPlaylistElement?: MVideoPlaylistElement
  117. videoPlaylistElementAP?: MVideoPlaylistElementVideoUrlPlaylistPrivacy
  118. accountVideoRate?: MAccountVideoRateAccountVideo
  119. videoCommentFull?: MCommentOwnerVideoReply
  120. videoCommentThread?: MComment
  121. follow?: MActorFollowActorsDefault
  122. subscription?: MActorFollowActorsDefaultSubscription
  123. nextOwner?: MAccountDefault
  124. videoChangeOwnership?: MVideoChangeOwnershipFull
  125. account?: MAccountDefault
  126. actorUrl?: MActorUrl
  127. actorFull?: MActorFull
  128. user?: MUserDefault
  129. server?: MServer
  130. videoRedundancy?: MVideoRedundancyVideo
  131. accountBlock?: MAccountBlocklist
  132. serverBlock?: MServerBlocklist
  133. oauth?: {
  134. token: MOAuthTokenUser
  135. }
  136. signature?: {
  137. actor: MActorAccountChannelId
  138. }
  139. authenticated?: boolean
  140. registeredPlugin?: RegisteredPlugin
  141. externalAuth?: RegisterServerAuthExternalOptions
  142. plugin?: MPlugin
  143. }
  144. }
  145. }