X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Factivitypub%2Furl.ts;h=ba3bf688d634d036f0877eab1d8c865f78da9a9e;hb=16f29007dc6ad9c539195d7a7c1cde45d626ce91;hp=00b4e8852451d638474ab5b389092c7e6eeb1129;hpb=3fd3ab2d34d512b160a5e6084d7609be7b4f4452;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/activitypub/url.ts b/server/lib/activitypub/url.ts index 00b4e8852..ba3bf688d 100644 --- a/server/lib/activitypub/url.ts +++ b/server/lib/activitypub/url.ts @@ -1,54 +1,78 @@ import { CONFIG } from '../../initializers' -import { AccountModel } from '../../models/account/account' -import { AccountFollowModel } from '../../models/account/account-follow' +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 { VideoChannelModel } from '../../models/video/video-channel' +import { VideoCommentModel } from '../../models/video/video-comment' function getVideoActivityPubUrl (video: VideoModel) { return CONFIG.WEBSERVER.URL + '/videos/watch/' + video.uuid } -function getVideoChannelActivityPubUrl (videoChannel: VideoChannelModel) { - return CONFIG.WEBSERVER.URL + '/video-channels/' + videoChannel.uuid +function getVideoCommentActivityPubUrl (video: VideoModel, videoComment: VideoCommentModel) { + return CONFIG.WEBSERVER.URL + '/videos/watch/' + video.uuid + '/comments/' + videoComment.id +} + +function getVideoChannelActivityPubUrl (videoChannelUUID: string) { + return CONFIG.WEBSERVER.URL + '/video-channels/' + videoChannelUUID } function getAccountActivityPubUrl (accountName: string) { - return CONFIG.WEBSERVER.URL + '/account/' + accountName + return CONFIG.WEBSERVER.URL + '/accounts/' + accountName } function getVideoAbuseActivityPubUrl (videoAbuse: VideoAbuseModel) { return CONFIG.WEBSERVER.URL + '/admin/video-abuses/' + videoAbuse.id } -function getVideoViewActivityPubUrl (byAccount: AccountModel, video: VideoModel) { - return video.url + '/views/' + byAccount.uuid + '/' + new Date().toISOString() +function getVideoViewActivityPubUrl (byActor: ActorModel, video: VideoModel) { + return video.url + '/views/' + byActor.uuid + '/' + new Date().toISOString() +} + +function getVideoLikeActivityPubUrl (byActor: ActorModel, video: VideoModel) { + return byActor.url + '/likes/' + video.id +} + +function getVideoDislikeActivityPubUrl (byActor: ActorModel, video: VideoModel) { + return byActor.url + '/dislikes/' + video.id } -function getVideoLikeActivityPubUrl (byAccount: AccountModel, video: VideoModel) { - return byAccount.url + '/likes/' + video.id +function getVideoSharesActivityPubUrl (video: VideoModel) { + return video.url + '/announces' } -function getVideoDislikeActivityPubUrl (byAccount: AccountModel, video: VideoModel) { - return byAccount.url + '/dislikes/' + video.id +function getVideoCommentsActivityPubUrl (video: VideoModel) { + return video.url + '/comments' } -function getAccountFollowActivityPubUrl (accountFollow: AccountFollowModel) { - const me = accountFollow.AccountFollower - const following = accountFollow.AccountFollowing +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 return me.url + '/follows/' + following.id } -function getAccountFollowAcceptActivityPubUrl (accountFollow: AccountFollowModel) { - const follower = accountFollow.AccountFollower - const me = accountFollow.AccountFollowing +function getActorFollowAcceptActivityPubUrl (actorFollow: ActorFollowModel) { + const follower = actorFollow.ActorFollower + const me = actorFollow.ActorFollowing return follower.url + '/accepts/follows/' + me.id } -function getAnnounceActivityPubUrl (originalUrl: string, byAccount: AccountModel) { - return originalUrl + '/announces/' + byAccount.id +function getAnnounceActivityPubUrl (originalUrl: string, byActor: ActorModel) { + return originalUrl + '/announces/' + byActor.id +} + +function getDeleteActivityPubUrl (originalUrl: string) { + return originalUrl + '/delete' } function getUpdateActivityPubUrl (originalUrl: string, updatedAt: string) { @@ -64,12 +88,18 @@ export { getVideoChannelActivityPubUrl, getAccountActivityPubUrl, getVideoAbuseActivityPubUrl, - getAccountFollowActivityPubUrl, - getAccountFollowAcceptActivityPubUrl, + getActorFollowActivityPubUrl, + getActorFollowAcceptActivityPubUrl, getAnnounceActivityPubUrl, getUpdateActivityPubUrl, getUndoActivityPubUrl, getVideoViewActivityPubUrl, getVideoLikeActivityPubUrl, - getVideoDislikeActivityPubUrl + getVideoDislikeActivityPubUrl, + getVideoCommentActivityPubUrl, + getDeleteActivityPubUrl, + getVideoSharesActivityPubUrl, + getVideoCommentsActivityPubUrl, + getVideoLikesActivityPubUrl, + getVideoDislikesActivityPubUrl }