X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Factivitypub%2Furl.ts;h=5705afbd62ff8ebdbe938439fe406205b47ad216;hb=4ba3b8ea1be85d95a508ac479f26b96ceea15971;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..5705afbd6 100644 --- a/server/lib/activitypub/url.ts +++ b/server/lib/activitypub/url.ts @@ -1,54 +1,62 @@ 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 (byAccount: AccountModel, video: VideoModel) { - return byAccount.url + '/likes/' + video.id +function getVideoLikeActivityPubUrl (byActor: ActorModel, video: VideoModel) { + return byActor.url + '/likes/' + video.id } -function getVideoDislikeActivityPubUrl (byAccount: AccountModel, video: VideoModel) { - return byAccount.url + '/dislikes/' + video.id +function getVideoDislikeActivityPubUrl (byActor: ActorModel, video: VideoModel) { + return byActor.url + '/dislikes/' + video.id } -function getAccountFollowActivityPubUrl (accountFollow: AccountFollowModel) { - const me = accountFollow.AccountFollower - const following = accountFollow.AccountFollowing +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 +72,14 @@ export { getVideoChannelActivityPubUrl, getAccountActivityPubUrl, getVideoAbuseActivityPubUrl, - getAccountFollowActivityPubUrl, - getAccountFollowAcceptActivityPubUrl, + getActorFollowActivityPubUrl, + getActorFollowAcceptActivityPubUrl, getAnnounceActivityPubUrl, getUpdateActivityPubUrl, getUndoActivityPubUrl, getVideoViewActivityPubUrl, getVideoLikeActivityPubUrl, - getVideoDislikeActivityPubUrl + getVideoDislikeActivityPubUrl, + getVideoCommentActivityPubUrl, + getDeleteActivityPubUrl }