X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Factivitypub%2Furl.ts;h=2e7c56955523241ed6856100e16e504225efceff;hb=d4defe07d26013a75577b30608841fe3f8334308;hp=bb2d4d11e7b4dfc6f15600c42365af9937f6a1da;hpb=50d6de9c286abcb34ff4234d56d9cbb803db7665;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/activitypub/url.ts b/server/lib/activitypub/url.ts index bb2d4d11e..2e7c56955 100644 --- a/server/lib/activitypub/url.ts +++ b/server/lib/activitypub/url.ts @@ -3,21 +3,29 @@ import { ActorModel } from '../../models/activitypub/actor' import { ActorFollowModel } from '../../models/activitypub/actor-follow' import { VideoModel } from '../../models/video/video' import { VideoAbuseModel } from '../../models/video/video-abuse' +import { VideoCommentModel } from '../../models/video/video-comment' +import { VideoFileModel } from '../../models/video/video-file' function getVideoActivityPubUrl (video: VideoModel) { return CONFIG.WEBSERVER.URL + '/videos/watch/' + video.uuid } -function getVideoChannelActivityPubUrl (videoChannelUUID: string) { - return CONFIG.WEBSERVER.URL + '/video-channels/' + videoChannelUUID +function getVideoCacheFileActivityPubUrl (videoFile: VideoFileModel) { + const suffixFPS = videoFile.fps ? '-' + videoFile.fps : '' + + return `${CONFIG.WEBSERVER.URL}/redundancy/videos/${videoFile.Video.uuid}/${videoFile.resolution}${suffixFPS}` +} + +function getVideoCommentActivityPubUrl (video: VideoModel, videoComment: VideoCommentModel) { + return CONFIG.WEBSERVER.URL + '/videos/watch/' + video.uuid + '/comments/' + videoComment.id } -function getApplicationActivityPubUrl () { - return CONFIG.WEBSERVER.URL + '/application/peertube' +function getVideoChannelActivityPubUrl (videoChannelName: string) { + return CONFIG.WEBSERVER.URL + '/video-channels/' + videoChannelName } function getAccountActivityPubUrl (accountName: string) { - return CONFIG.WEBSERVER.URL + '/account/' + accountName + return CONFIG.WEBSERVER.URL + '/accounts/' + accountName } function getVideoAbuseActivityPubUrl (videoAbuse: VideoAbuseModel) { @@ -36,6 +44,22 @@ function getVideoDislikeActivityPubUrl (byActor: ActorModel, video: VideoModel) return byActor.url + '/dislikes/' + video.id } +function getVideoSharesActivityPubUrl (video: VideoModel) { + return video.url + '/announces' +} + +function getVideoCommentsActivityPubUrl (video: VideoModel) { + return video.url + '/comments' +} + +function getVideoLikesActivityPubUrl (video: VideoModel) { + return video.url + '/likes' +} + +function getVideoDislikesActivityPubUrl (video: VideoModel) { + return video.url + '/dislikes' +} + function getActorFollowActivityPubUrl (actorFollow: ActorFollowModel) { const me = actorFollow.ActorFollower const following = actorFollow.ActorFollowing @@ -54,6 +78,10 @@ function getAnnounceActivityPubUrl (originalUrl: string, byActor: ActorModel) { return originalUrl + '/announces/' + byActor.id } +function getDeleteActivityPubUrl (originalUrl: string) { + return originalUrl + '/delete' +} + function getUpdateActivityPubUrl (originalUrl: string, updatedAt: string) { return originalUrl + '/updates/' + updatedAt } @@ -63,7 +91,6 @@ function getUndoActivityPubUrl (originalUrl: string) { } export { - getApplicationActivityPubUrl, getVideoActivityPubUrl, getVideoChannelActivityPubUrl, getAccountActivityPubUrl, @@ -75,5 +102,12 @@ export { getUndoActivityPubUrl, getVideoViewActivityPubUrl, getVideoLikeActivityPubUrl, - getVideoDislikeActivityPubUrl + getVideoDislikeActivityPubUrl, + getVideoCommentActivityPubUrl, + getDeleteActivityPubUrl, + getVideoSharesActivityPubUrl, + getVideoCommentsActivityPubUrl, + getVideoLikesActivityPubUrl, + getVideoDislikesActivityPubUrl, + getVideoCacheFileActivityPubUrl }