]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/root-helpers/video.ts
Fix notification number
[github/Chocobozzz/PeerTube.git] / client / src / root-helpers / video.ts
index 4290992aab93964f12ace229b17a2f951f23c97f..107ba1eba704658bccf2fcefccf7e8911820f891 100644 (file)
@@ -1,6 +1,11 @@
-import { HTMLServerConfig, Video } from '@shared/models'
+import { HTMLServerConfig, Video, VideoPrivacy } from '@shared/models'
+
+function buildVideoOrPlaylistEmbed (options: {
+  embedUrl: string
+  embedTitle: string
+}) {
+  const { embedUrl, embedTitle } = options
 
-function buildVideoOrPlaylistEmbed (embedUrl: string, embedTitle: string) {
   const iframe = document.createElement('iframe')
 
   iframe.title = embedTitle
@@ -21,9 +26,14 @@ function isP2PEnabled (video: Video, config: HTMLServerConfig, userP2PEnabled: b
   return userP2PEnabled
 }
 
+function videoRequiresAuth (video: Video) {
+  return new Set([ VideoPrivacy.PRIVATE, VideoPrivacy.INTERNAL ]).has(video.privacy.id)
+}
+
 export {
   buildVideoOrPlaylistEmbed,
-  isP2PEnabled
+  isP2PEnabled,
+  videoRequiresAuth
 }
 
 // ---------------------------------------------------------------------------