2017-11-20 10:24:29 +01:00
|
|
|
import { CONFIG } from '../../initializers/constants'
|
|
|
|
import { VideoInstance } from '../../models/video/video-interface'
|
|
|
|
import { VideoChannelInstance } from '../../models/video/video-channel-interface'
|
|
|
|
import { VideoAbuseInstance } from '../../models/video/video-abuse-interface'
|
|
|
|
import { AccountFollowInstance } from '../../models/account/account-follow-interface'
|
|
|
|
import { AccountInstance } from '../../models/account/account-interface'
|
|
|
|
|
|
|
|
function getVideoActivityPubUrl (video: VideoInstance) {
|
|
|
|
return CONFIG.WEBSERVER.URL + '/videos/watch/' + video.uuid
|
|
|
|
}
|
|
|
|
|
|
|
|
function getVideoChannelActivityPubUrl (videoChannel: VideoChannelInstance) {
|
|
|
|
return CONFIG.WEBSERVER.URL + '/video-channels/' + videoChannel.uuid
|
|
|
|
}
|
|
|
|
|
|
|
|
function getAccountActivityPubUrl (accountName: string) {
|
|
|
|
return CONFIG.WEBSERVER.URL + '/account/' + accountName
|
|
|
|
}
|
|
|
|
|
|
|
|
function getVideoAbuseActivityPubUrl (videoAbuse: VideoAbuseInstance) {
|
|
|
|
return CONFIG.WEBSERVER.URL + '/admin/video-abuses/' + videoAbuse.id
|
|
|
|
}
|
|
|
|
|
2017-11-22 16:25:03 +01:00
|
|
|
function getVideoViewActivityPubUrl (byAccount: AccountInstance, video: VideoInstance) {
|
2017-11-27 14:44:51 +01:00
|
|
|
return video.url + '/views/' + byAccount.uuid + '/' + new Date().toISOString()
|
2017-11-22 16:25:03 +01:00
|
|
|
}
|
|
|
|
|
2017-11-23 14:19:55 +01:00
|
|
|
function getVideoLikeActivityPubUrl (byAccount: AccountInstance, video: VideoInstance) {
|
2017-11-27 14:44:51 +01:00
|
|
|
return byAccount.url + '/likes/' + video.id
|
2017-11-23 14:19:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function getVideoDislikeActivityPubUrl (byAccount: AccountInstance, video: VideoInstance) {
|
2017-11-27 14:44:51 +01:00
|
|
|
return byAccount.url + '/dislikes/' + video.id
|
2017-11-23 14:19:55 +01:00
|
|
|
}
|
|
|
|
|
2017-11-20 10:24:29 +01:00
|
|
|
function getAccountFollowActivityPubUrl (accountFollow: AccountFollowInstance) {
|
|
|
|
const me = accountFollow.AccountFollower
|
|
|
|
const following = accountFollow.AccountFollowing
|
|
|
|
|
2017-11-27 14:44:51 +01:00
|
|
|
return me.url + '/follows/' + following.id
|
2017-11-20 10:24:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function getAccountFollowAcceptActivityPubUrl (accountFollow: AccountFollowInstance) {
|
|
|
|
const follower = accountFollow.AccountFollower
|
|
|
|
const me = accountFollow.AccountFollowing
|
|
|
|
|
2017-11-27 14:44:51 +01:00
|
|
|
return follower.url + '/accepts/follows/' + me.id
|
2017-11-20 10:24:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function getAnnounceActivityPubUrl (originalUrl: string, byAccount: AccountInstance) {
|
2017-11-27 14:44:51 +01:00
|
|
|
return originalUrl + '/announces/' + byAccount.id
|
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,
|
|
|
|
getAccountFollowActivityPubUrl,
|
|
|
|
getAccountFollowAcceptActivityPubUrl,
|
|
|
|
getAnnounceActivityPubUrl,
|
|
|
|
getUpdateActivityPubUrl,
|
2017-11-22 16:25:03 +01:00
|
|
|
getUndoActivityPubUrl,
|
2017-11-23 14:19:55 +01:00
|
|
|
getVideoViewActivityPubUrl,
|
|
|
|
getVideoLikeActivityPubUrl,
|
|
|
|
getVideoDislikeActivityPubUrl
|
2017-11-20 10:24:29 +01:00
|
|
|
}
|