]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/activitypub.ts
add quarantine videos feature (#1637)
[github/Chocobozzz/PeerTube.git] / server / helpers / activitypub.ts
index 79b76fa0b89e2636bf6dc177363f2f8c9ffbc1c3..31c6187d108d9ea60fbc4e2607f51fffc54a557f 100644 (file)
@@ -15,7 +15,7 @@ function activityPubContextify <T> (data: T) {
       'https://w3id.org/security/v1',
       {
         RsaSignature2017: 'https://w3id.org/security#RsaSignature2017',
-        pt: 'https://joinpeertube.org/ns',
+        pt: 'https://joinpeertube.org/ns#',
         sc: 'http://schema.org#',
         Hashtag: 'as:Hashtag',
         uuid: 'sc:identifier',
@@ -28,11 +28,17 @@ function activityPubContextify <T> (data: T) {
         state: 'sc:Number',
         size: 'sc:Number',
         fps: 'sc:Number',
+        startTimestamp: 'sc:Number',
+        stopTimestamp: 'sc:Number',
+        position: 'sc:Number',
         commentsEnabled: 'sc:Boolean',
+        downloadEnabled: 'sc:Boolean',
         waitTranscoding: 'sc:Boolean',
         expires: 'sc:expires',
         support: 'sc:Text',
-        CacheFile: 'pt:CacheFile'
+        CacheFile: 'pt:CacheFile',
+        Infohash: 'pt:Infohash',
+        originallyPublishedAt: 'sc:DateTime'
       },
       {
         likes: {
@@ -43,6 +49,10 @@ function activityPubContextify <T> (data: T) {
           '@id': 'as:dislikes',
           '@type': '@id'
         },
+        playlists: {
+          '@id': 'pt:playlists',
+          '@type': '@id'
+        },
         shares: {
           '@id': 'as:shares',
           '@type': '@id'
@@ -64,7 +74,7 @@ async function activityPubCollectionPagination (baseUrl: string, handler: Activi
 
     return {
       id: baseUrl,
-      type: 'OrderedCollection',
+      type: 'OrderedCollectionPage',
       totalItems: result.total,
       first: baseUrl + '?page=1'
     }
@@ -106,7 +116,7 @@ function buildSignedActivity (byActor: ActorModel, data: Object) {
   return signJsonLDObject(byActor, activity) as Promise<Activity>
 }
 
-function getAPUrl (activity: string | { id: string }) {
+function getAPId (activity: string | { id: string }) {
   if (typeof activity === 'string') return activity
 
   return activity.id
@@ -123,7 +133,7 @@ function checkUrlsSameHost (url1: string, url2: string) {
 
 export {
   checkUrlsSameHost,
-  getAPUrl,
+  getAPId,
   activityPubContextify,
   activityPubCollectionPagination,
   buildSignedActivity