aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/process/process-update.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-02-26 10:55:40 +0100
committerChocobozzz <chocobozzz@cpy.re>2019-03-18 11:17:59 +0100
commit418d092afa81e2c8fe8ac6838fc4b5eb0af6a782 (patch)
tree5e9bc5604fd5d66a006cfebb7acdbdd5486e5d1e /server/lib/activitypub/process/process-update.ts
parentb427febb4d5cebf03b815bca2c59af6e82491569 (diff)
downloadPeerTube-418d092afa81e2c8fe8ac6838fc4b5eb0af6a782.tar.gz
PeerTube-418d092afa81e2c8fe8ac6838fc4b5eb0af6a782.tar.zst
PeerTube-418d092afa81e2c8fe8ac6838fc4b5eb0af6a782.zip
Playlist server API
Diffstat (limited to 'server/lib/activitypub/process/process-update.ts')
-rw-r--r--server/lib/activitypub/process/process-update.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/server/lib/activitypub/process/process-update.ts b/server/lib/activitypub/process/process-update.ts
index c6b42d846..0b96ba352 100644
--- a/server/lib/activitypub/process/process-update.ts
+++ b/server/lib/activitypub/process/process-update.ts
@@ -12,6 +12,8 @@ import { sanitizeAndCheckVideoTorrentObject } from '../../../helpers/custom-vali
12import { isCacheFileObjectValid } from '../../../helpers/custom-validators/activitypub/cache-file' 12import { isCacheFileObjectValid } from '../../../helpers/custom-validators/activitypub/cache-file'
13import { createOrUpdateCacheFile } from '../cache-file' 13import { createOrUpdateCacheFile } from '../cache-file'
14import { forwardVideoRelatedActivity } from '../send/utils' 14import { forwardVideoRelatedActivity } from '../send/utils'
15import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object'
16import { createOrUpdateVideoPlaylist } from '../playlist'
15 17
16async function processUpdateActivity (activity: ActivityUpdate, byActor: ActorModel) { 18async function processUpdateActivity (activity: ActivityUpdate, byActor: ActorModel) {
17 const objectType = activity.object.type 19 const objectType = activity.object.type
@@ -32,6 +34,10 @@ async function processUpdateActivity (activity: ActivityUpdate, byActor: ActorMo
32 return retryTransactionWrapper(processUpdateCacheFile, byActorFull, activity) 34 return retryTransactionWrapper(processUpdateCacheFile, byActorFull, activity)
33 } 35 }
34 36
37 if (objectType === 'Playlist') {
38 return retryTransactionWrapper(processUpdatePlaylist, byActor, activity)
39 }
40
35 return undefined 41 return undefined
36} 42}
37 43
@@ -135,3 +141,12 @@ async function processUpdateActor (actor: ActorModel, activity: ActivityUpdate)
135 throw err 141 throw err
136 } 142 }
137} 143}
144
145async function processUpdatePlaylist (byActor: ActorModel, activity: ActivityUpdate) {
146 const playlistObject = activity.object as PlaylistObject
147 const byAccount = byActor.Account
148
149 if (!byAccount) throw new Error('Cannot update video playlist with the non account actor ' + byActor.url)
150
151 await createOrUpdateVideoPlaylist(playlistObject, byAccount, activity.to)
152}