diff options
Diffstat (limited to 'server/lib/activitypub/url.ts')
-rw-r--r-- | server/lib/activitypub/url.ts | 46 |
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 @@ | |||
1 | import { CONFIG } from '../../initializers' | 1 | import { CONFIG } from '../../initializers' |
2 | import { AccountModel } from '../../models/account/account' | 2 | import { ActorModel } from '../../models/activitypub/actor' |
3 | import { AccountFollowModel } from '../../models/account/account-follow' | 3 | import { ActorFollowModel } from '../../models/activitypub/actor-follow' |
4 | import { VideoModel } from '../../models/video/video' | 4 | import { VideoModel } from '../../models/video/video' |
5 | import { VideoAbuseModel } from '../../models/video/video-abuse' | 5 | import { VideoAbuseModel } from '../../models/video/video-abuse' |
6 | import { VideoChannelModel } from '../../models/video/video-channel' | ||
7 | 6 | ||
8 | function getVideoActivityPubUrl (video: VideoModel) { | 7 | function 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 | ||
12 | function getVideoChannelActivityPubUrl (videoChannel: VideoChannelModel) { | 11 | function getVideoChannelActivityPubUrl (videoChannelUUID: string) { |
13 | return CONFIG.WEBSERVER.URL + '/video-channels/' + videoChannel.uuid | 12 | return CONFIG.WEBSERVER.URL + '/video-channels/' + videoChannelUUID |
13 | } | ||
14 | |||
15 | function getApplicationActivityPubUrl () { | ||
16 | return CONFIG.WEBSERVER.URL + '/application/peertube' | ||
14 | } | 17 | } |
15 | 18 | ||
16 | function getAccountActivityPubUrl (accountName: string) { | 19 | function 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 | ||
24 | function getVideoViewActivityPubUrl (byAccount: AccountModel, video: VideoModel) { | 27 | function 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 | ||
28 | function getVideoLikeActivityPubUrl (byAccount: AccountModel, video: VideoModel) { | 31 | function getVideoLikeActivityPubUrl (byActor: ActorModel, video: VideoModel) { |
29 | return byAccount.url + '/likes/' + video.id | 32 | return byActor.url + '/likes/' + video.id |
30 | } | 33 | } |
31 | 34 | ||
32 | function getVideoDislikeActivityPubUrl (byAccount: AccountModel, video: VideoModel) { | 35 | function getVideoDislikeActivityPubUrl (byActor: ActorModel, video: VideoModel) { |
33 | return byAccount.url + '/dislikes/' + video.id | 36 | return byActor.url + '/dislikes/' + video.id |
34 | } | 37 | } |
35 | 38 | ||
36 | function getAccountFollowActivityPubUrl (accountFollow: AccountFollowModel) { | 39 | function 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 | ||
43 | function getAccountFollowAcceptActivityPubUrl (accountFollow: AccountFollowModel) { | 46 | function 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 | ||
50 | function getAnnounceActivityPubUrl (originalUrl: string, byAccount: AccountModel) { | 53 | function getAnnounceActivityPubUrl (originalUrl: string, byActor: ActorModel) { |
51 | return originalUrl + '/announces/' + byAccount.id | 54 | return originalUrl + '/announces/' + byActor.id |
52 | } | 55 | } |
53 | 56 | ||
54 | function getUpdateActivityPubUrl (originalUrl: string, updatedAt: string) { | 57 | function getUpdateActivityPubUrl (originalUrl: string, updatedAt: string) { |
@@ -60,12 +63,13 @@ function getUndoActivityPubUrl (originalUrl: string) { | |||
60 | } | 63 | } |
61 | 64 | ||
62 | export { | 65 | export { |
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, |