aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/url.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2017-12-14 17:38:41 +0100
committerChocobozzz <me@florianbigard.com>2017-12-19 10:53:16 +0100
commit50d6de9c286abcb34ff4234d56d9cbb803db7665 (patch)
treef1732b27edcd05c7877a8358b8312f1e38c287ed /server/lib/activitypub/url.ts
parentfadf619ad61a016c1c7fc53de5a8f398a4f77519 (diff)
downloadPeerTube-50d6de9c286abcb34ff4234d56d9cbb803db7665.tar.gz
PeerTube-50d6de9c286abcb34ff4234d56d9cbb803db7665.tar.zst
PeerTube-50d6de9c286abcb34ff4234d56d9cbb803db7665.zip
Begin moving video channel to actor
Diffstat (limited to 'server/lib/activitypub/url.ts')
-rw-r--r--server/lib/activitypub/url.ts46
1 files changed, 25 insertions, 21 deletions
diff --git a/server/lib/activitypub/url.ts b/server/lib/activitypub/url.ts
index 00b4e8852..bb2d4d11e 100644
--- a/server/lib/activitypub/url.ts
+++ b/server/lib/activitypub/url.ts
@@ -1,16 +1,19 @@
1import { CONFIG } from '../../initializers' 1import { CONFIG } from '../../initializers'
2import { AccountModel } from '../../models/account/account' 2import { ActorModel } from '../../models/activitypub/actor'
3import { AccountFollowModel } from '../../models/account/account-follow' 3import { ActorFollowModel } from '../../models/activitypub/actor-follow'
4import { VideoModel } from '../../models/video/video' 4import { VideoModel } from '../../models/video/video'
5import { VideoAbuseModel } from '../../models/video/video-abuse' 5import { VideoAbuseModel } from '../../models/video/video-abuse'
6import { VideoChannelModel } from '../../models/video/video-channel'
7 6
8function getVideoActivityPubUrl (video: VideoModel) { 7function getVideoActivityPubUrl (video: VideoModel) {
9 return CONFIG.WEBSERVER.URL + '/videos/watch/' + video.uuid 8 return CONFIG.WEBSERVER.URL + '/videos/watch/' + video.uuid
10} 9}
11 10
12function getVideoChannelActivityPubUrl (videoChannel: VideoChannelModel) { 11function getVideoChannelActivityPubUrl (videoChannelUUID: string) {
13 return CONFIG.WEBSERVER.URL + '/video-channels/' + videoChannel.uuid 12 return CONFIG.WEBSERVER.URL + '/video-channels/' + videoChannelUUID
13}
14
15function getApplicationActivityPubUrl () {
16 return CONFIG.WEBSERVER.URL + '/application/peertube'
14} 17}
15 18
16function getAccountActivityPubUrl (accountName: string) { 19function getAccountActivityPubUrl (accountName: string) {
@@ -21,34 +24,34 @@ function getVideoAbuseActivityPubUrl (videoAbuse: VideoAbuseModel) {
21 return CONFIG.WEBSERVER.URL + '/admin/video-abuses/' + videoAbuse.id 24 return CONFIG.WEBSERVER.URL + '/admin/video-abuses/' + videoAbuse.id
22} 25}
23 26
24function getVideoViewActivityPubUrl (byAccount: AccountModel, video: VideoModel) { 27function getVideoViewActivityPubUrl (byActor: ActorModel, video: VideoModel) {
25 return video.url + '/views/' + byAccount.uuid + '/' + new Date().toISOString() 28 return video.url + '/views/' + byActor.uuid + '/' + new Date().toISOString()
26} 29}
27 30
28function getVideoLikeActivityPubUrl (byAccount: AccountModel, video: VideoModel) { 31function getVideoLikeActivityPubUrl (byActor: ActorModel, video: VideoModel) {
29 return byAccount.url + '/likes/' + video.id 32 return byActor.url + '/likes/' + video.id
30} 33}
31 34
32function getVideoDislikeActivityPubUrl (byAccount: AccountModel, video: VideoModel) { 35function getVideoDislikeActivityPubUrl (byActor: ActorModel, video: VideoModel) {
33 return byAccount.url + '/dislikes/' + video.id 36 return byActor.url + '/dislikes/' + video.id
34} 37}
35 38
36function getAccountFollowActivityPubUrl (accountFollow: AccountFollowModel) { 39function getActorFollowActivityPubUrl (actorFollow: ActorFollowModel) {
37 const me = accountFollow.AccountFollower 40 const me = actorFollow.ActorFollower
38 const following = accountFollow.AccountFollowing 41 const following = actorFollow.ActorFollowing
39 42
40 return me.url + '/follows/' + following.id 43 return me.url + '/follows/' + following.id
41} 44}
42 45
43function getAccountFollowAcceptActivityPubUrl (accountFollow: AccountFollowModel) { 46function getActorFollowAcceptActivityPubUrl (actorFollow: ActorFollowModel) {
44 const follower = accountFollow.AccountFollower 47 const follower = actorFollow.ActorFollower
45 const me = accountFollow.AccountFollowing 48 const me = actorFollow.ActorFollowing
46 49
47 return follower.url + '/accepts/follows/' + me.id 50 return follower.url + '/accepts/follows/' + me.id
48} 51}
49 52
50function getAnnounceActivityPubUrl (originalUrl: string, byAccount: AccountModel) { 53function getAnnounceActivityPubUrl (originalUrl: string, byActor: ActorModel) {
51 return originalUrl + '/announces/' + byAccount.id 54 return originalUrl + '/announces/' + byActor.id
52} 55}
53 56
54function getUpdateActivityPubUrl (originalUrl: string, updatedAt: string) { 57function getUpdateActivityPubUrl (originalUrl: string, updatedAt: string) {
@@ -60,12 +63,13 @@ function getUndoActivityPubUrl (originalUrl: string) {
60} 63}
61 64
62export { 65export {
66 getApplicationActivityPubUrl,
63 getVideoActivityPubUrl, 67 getVideoActivityPubUrl,
64 getVideoChannelActivityPubUrl, 68 getVideoChannelActivityPubUrl,
65 getAccountActivityPubUrl, 69 getAccountActivityPubUrl,
66 getVideoAbuseActivityPubUrl, 70 getVideoAbuseActivityPubUrl,
67 getAccountFollowActivityPubUrl, 71 getActorFollowActivityPubUrl,
68 getAccountFollowAcceptActivityPubUrl, 72 getActorFollowAcceptActivityPubUrl,
69 getAnnounceActivityPubUrl, 73 getAnnounceActivityPubUrl,
70 getUpdateActivityPubUrl, 74 getUpdateActivityPubUrl,
71 getUndoActivityPubUrl, 75 getUndoActivityPubUrl,