2017-12-12 17:53:50 +01:00
|
|
|
import { CONFIG } from '../../initializers'
|
2017-12-14 17:38:41 +01:00
|
|
|
import { ActorModel } from '../../models/activitypub/actor'
|
|
|
|
import { ActorFollowModel } from '../../models/activitypub/actor-follow'
|
2017-12-12 17:53:50 +01:00
|
|
|
import { VideoModel } from '../../models/video/video'
|
|
|
|
import { VideoAbuseModel } from '../../models/video/video-abuse'
|
2017-12-22 10:50:07 +01:00
|
|
|
import { VideoCommentModel } from '../../models/video/video-comment'
|
2017-11-20 10:24:29 +01:00
|
|
|
|
2017-12-12 17:53:50 +01:00
|
|
|
function getVideoActivityPubUrl (video: VideoModel) {
|
2017-11-20 10:24:29 +01:00
|
|
|
return CONFIG.WEBSERVER.URL + '/videos/watch/' + video.uuid
|
|
|
|
}
|
|
|
|
|
2017-12-22 10:50:07 +01:00
|
|
|
function getVideoCommentActivityPubUrl (video: VideoModel, videoComment: VideoCommentModel) {
|
2017-12-28 11:16:08 +01:00
|
|
|
return CONFIG.WEBSERVER.URL + '/videos/watch/' + video.uuid + '/comments/' + videoComment.id
|
2017-12-14 17:38:41 +01:00
|
|
|
}
|
|
|
|
|
2017-12-22 10:50:07 +01:00
|
|
|
function getVideoChannelActivityPubUrl (videoChannelUUID: string) {
|
|
|
|
return CONFIG.WEBSERVER.URL + '/video-channels/' + videoChannelUUID
|
2017-11-20 10:24:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function getAccountActivityPubUrl (accountName: string) {
|
2017-12-29 19:10:13 +01:00
|
|
|
return CONFIG.WEBSERVER.URL + '/accounts/' + accountName
|
2017-11-20 10:24:29 +01:00
|
|
|
}
|
|
|
|
|
2017-12-12 17:53:50 +01:00
|
|
|
function getVideoAbuseActivityPubUrl (videoAbuse: VideoAbuseModel) {
|
2017-11-20 10:24:29 +01:00
|
|
|
return CONFIG.WEBSERVER.URL + '/admin/video-abuses/' + videoAbuse.id
|
|
|
|
}
|
|
|
|
|
2017-12-14 17:38:41 +01:00
|
|
|
function getVideoViewActivityPubUrl (byActor: ActorModel, video: VideoModel) {
|
|
|
|
return video.url + '/views/' + byActor.uuid + '/' + new Date().toISOString()
|
2017-11-22 16:25:03 +01:00
|
|
|
}
|
|
|
|
|
2017-12-14 17:38:41 +01:00
|
|
|
function getVideoLikeActivityPubUrl (byActor: ActorModel, video: VideoModel) {
|
|
|
|
return byActor.url + '/likes/' + video.id
|
2017-11-23 14:19:55 +01:00
|
|
|
}
|
|
|
|
|
2017-12-14 17:38:41 +01:00
|
|
|
function getVideoDislikeActivityPubUrl (byActor: ActorModel, video: VideoModel) {
|
|
|
|
return byActor.url + '/dislikes/' + video.id
|
2017-11-23 14:19:55 +01:00
|
|
|
}
|
|
|
|
|
2017-12-14 17:38:41 +01:00
|
|
|
function getActorFollowActivityPubUrl (actorFollow: ActorFollowModel) {
|
|
|
|
const me = actorFollow.ActorFollower
|
|
|
|
const following = actorFollow.ActorFollowing
|
2017-11-20 10:24:29 +01:00
|
|
|
|
2017-11-27 14:44:51 +01:00
|
|
|
return me.url + '/follows/' + following.id
|
2017-11-20 10:24:29 +01:00
|
|
|
}
|
|
|
|
|
2017-12-14 17:38:41 +01:00
|
|
|
function getActorFollowAcceptActivityPubUrl (actorFollow: ActorFollowModel) {
|
|
|
|
const follower = actorFollow.ActorFollower
|
|
|
|
const me = actorFollow.ActorFollowing
|
2017-11-20 10:24:29 +01:00
|
|
|
|
2017-11-27 14:44:51 +01:00
|
|
|
return follower.url + '/accepts/follows/' + me.id
|
2017-11-20 10:24:29 +01:00
|
|
|
}
|
|
|
|
|
2017-12-14 17:38:41 +01:00
|
|
|
function getAnnounceActivityPubUrl (originalUrl: string, byActor: ActorModel) {
|
|
|
|
return originalUrl + '/announces/' + byActor.id
|
2017-11-20 10:24:29 +01:00
|
|
|
}
|
|
|
|
|
2018-01-04 16:56:36 +01:00
|
|
|
function getDeleteActivityPubUrl (originalUrl: string) {
|
|
|
|
return originalUrl + '/delete'
|
|
|
|
}
|
|
|
|
|
2017-11-20 10:24:29 +01:00
|
|
|
function getUpdateActivityPubUrl (originalUrl: string, updatedAt: string) {
|
2017-11-27 14:44:51 +01:00
|
|
|
return originalUrl + '/updates/' + updatedAt
|
2017-11-20 10:24:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function getUndoActivityPubUrl (originalUrl: string) {
|
|
|
|
return originalUrl + '/undo'
|
|
|
|
}
|
|
|
|
|
|
|
|
export {
|
|
|
|
getVideoActivityPubUrl,
|
|
|
|
getVideoChannelActivityPubUrl,
|
|
|
|
getAccountActivityPubUrl,
|
|
|
|
getVideoAbuseActivityPubUrl,
|
2017-12-14 17:38:41 +01:00
|
|
|
getActorFollowActivityPubUrl,
|
|
|
|
getActorFollowAcceptActivityPubUrl,
|
2017-11-20 10:24:29 +01:00
|
|
|
getAnnounceActivityPubUrl,
|
|
|
|
getUpdateActivityPubUrl,
|
2017-11-22 16:25:03 +01:00
|
|
|
getUndoActivityPubUrl,
|
2017-11-23 14:19:55 +01:00
|
|
|
getVideoViewActivityPubUrl,
|
|
|
|
getVideoLikeActivityPubUrl,
|
2017-12-22 10:50:07 +01:00
|
|
|
getVideoDislikeActivityPubUrl,
|
2018-01-04 16:56:36 +01:00
|
|
|
getVideoCommentActivityPubUrl,
|
|
|
|
getDeleteActivityPubUrl
|
2017-11-20 10:24:29 +01:00
|
|
|
}
|