2017-12-12 10:53:50 -06:00
|
|
|
import { CONFIG } from '../../initializers'
|
|
|
|
import { AccountModel } from '../../models/account/account'
|
|
|
|
import { AccountFollowModel } from '../../models/account/account-follow'
|
|
|
|
import { VideoModel } from '../../models/video/video'
|
|
|
|
import { VideoAbuseModel } from '../../models/video/video-abuse'
|
|
|
|
import { VideoChannelModel } from '../../models/video/video-channel'
|
2017-11-20 03:24:29 -06:00
|
|
|
|
2017-12-12 10:53:50 -06:00
|
|
|
function getVideoActivityPubUrl (video: VideoModel) {
|
2017-11-20 03:24:29 -06:00
|
|
|
return CONFIG.WEBSERVER.URL + '/videos/watch/' + video.uuid
|
|
|
|
}
|
|
|
|
|
2017-12-12 10:53:50 -06:00
|
|
|
function getVideoChannelActivityPubUrl (videoChannel: VideoChannelModel) {
|
2017-11-20 03:24:29 -06:00
|
|
|
return CONFIG.WEBSERVER.URL + '/video-channels/' + videoChannel.uuid
|
|
|
|
}
|
|
|
|
|
|
|
|
function getAccountActivityPubUrl (accountName: string) {
|
|
|
|
return CONFIG.WEBSERVER.URL + '/account/' + accountName
|
|
|
|
}
|
|
|
|
|
2017-12-12 10:53:50 -06:00
|
|
|
function getVideoAbuseActivityPubUrl (videoAbuse: VideoAbuseModel) {
|
2017-11-20 03:24:29 -06:00
|
|
|
return CONFIG.WEBSERVER.URL + '/admin/video-abuses/' + videoAbuse.id
|
|
|
|
}
|
|
|
|
|
2017-12-12 10:53:50 -06:00
|
|
|
function getVideoViewActivityPubUrl (byAccount: AccountModel, video: VideoModel) {
|
2017-11-27 07:44:51 -06:00
|
|
|
return video.url + '/views/' + byAccount.uuid + '/' + new Date().toISOString()
|
2017-11-22 09:25:03 -06:00
|
|
|
}
|
|
|
|
|
2017-12-12 10:53:50 -06:00
|
|
|
function getVideoLikeActivityPubUrl (byAccount: AccountModel, video: VideoModel) {
|
2017-11-27 07:44:51 -06:00
|
|
|
return byAccount.url + '/likes/' + video.id
|
2017-11-23 07:19:55 -06:00
|
|
|
}
|
|
|
|
|
2017-12-12 10:53:50 -06:00
|
|
|
function getVideoDislikeActivityPubUrl (byAccount: AccountModel, video: VideoModel) {
|
2017-11-27 07:44:51 -06:00
|
|
|
return byAccount.url + '/dislikes/' + video.id
|
2017-11-23 07:19:55 -06:00
|
|
|
}
|
|
|
|
|
2017-12-12 10:53:50 -06:00
|
|
|
function getAccountFollowActivityPubUrl (accountFollow: AccountFollowModel) {
|
2017-11-20 03:24:29 -06:00
|
|
|
const me = accountFollow.AccountFollower
|
|
|
|
const following = accountFollow.AccountFollowing
|
|
|
|
|
2017-11-27 07:44:51 -06:00
|
|
|
return me.url + '/follows/' + following.id
|
2017-11-20 03:24:29 -06:00
|
|
|
}
|
|
|
|
|
2017-12-12 10:53:50 -06:00
|
|
|
function getAccountFollowAcceptActivityPubUrl (accountFollow: AccountFollowModel) {
|
2017-11-20 03:24:29 -06:00
|
|
|
const follower = accountFollow.AccountFollower
|
|
|
|
const me = accountFollow.AccountFollowing
|
|
|
|
|
2017-11-27 07:44:51 -06:00
|
|
|
return follower.url + '/accepts/follows/' + me.id
|
2017-11-20 03:24:29 -06:00
|
|
|
}
|
|
|
|
|
2017-12-12 10:53:50 -06:00
|
|
|
function getAnnounceActivityPubUrl (originalUrl: string, byAccount: AccountModel) {
|
2017-11-27 07:44:51 -06:00
|
|
|
return originalUrl + '/announces/' + byAccount.id
|
2017-11-20 03:24:29 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
function getUpdateActivityPubUrl (originalUrl: string, updatedAt: string) {
|
2017-11-27 07:44:51 -06:00
|
|
|
return originalUrl + '/updates/' + updatedAt
|
2017-11-20 03:24:29 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
function getUndoActivityPubUrl (originalUrl: string) {
|
|
|
|
return originalUrl + '/undo'
|
|
|
|
}
|
|
|
|
|
|
|
|
export {
|
|
|
|
getVideoActivityPubUrl,
|
|
|
|
getVideoChannelActivityPubUrl,
|
|
|
|
getAccountActivityPubUrl,
|
|
|
|
getVideoAbuseActivityPubUrl,
|
|
|
|
getAccountFollowActivityPubUrl,
|
|
|
|
getAccountFollowAcceptActivityPubUrl,
|
|
|
|
getAnnounceActivityPubUrl,
|
|
|
|
getUpdateActivityPubUrl,
|
2017-11-22 09:25:03 -06:00
|
|
|
getUndoActivityPubUrl,
|
2017-11-23 07:19:55 -06:00
|
|
|
getVideoViewActivityPubUrl,
|
|
|
|
getVideoLikeActivityPubUrl,
|
|
|
|
getVideoDislikeActivityPubUrl
|
2017-11-20 03:24:29 -06:00
|
|
|
}
|