Move models to typescript-sequelize
[oweals/peertube.git] / server / lib / activitypub / url.ts
index 17395a99b81291d091877fbc2ad48741a9bd5e57..00b4e8852451d638474ab5b389092c7e6eeb1129 100644 (file)
@@ -1,15 +1,15 @@
-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'
+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'
 
-function getVideoActivityPubUrl (video: VideoInstance) {
+function getVideoActivityPubUrl (video: VideoModel) {
   return CONFIG.WEBSERVER.URL + '/videos/watch/' + video.uuid
 }
 
-function getVideoChannelActivityPubUrl (videoChannel: VideoChannelInstance) {
+function getVideoChannelActivityPubUrl (videoChannel: VideoChannelModel) {
   return CONFIG.WEBSERVER.URL + '/video-channels/' + videoChannel.uuid
 }
 
@@ -17,42 +17,42 @@ function getAccountActivityPubUrl (accountName: string) {
   return CONFIG.WEBSERVER.URL + '/account/' + accountName
 }
 
-function getVideoAbuseActivityPubUrl (videoAbuse: VideoAbuseInstance) {
+function getVideoAbuseActivityPubUrl (videoAbuse: VideoAbuseModel) {
   return CONFIG.WEBSERVER.URL + '/admin/video-abuses/' + videoAbuse.id
 }
 
-function getVideoViewActivityPubUrl (byAccount: AccountInstance, video: VideoInstance) {
-  return video.url + '#views/' + byAccount.uuid + '/' + new Date().toISOString()
+function getVideoViewActivityPubUrl (byAccount: AccountModel, video: VideoModel) {
+  return video.url + '/views/' + byAccount.uuid + '/' + new Date().toISOString()
 }
 
-function getVideoLikeActivityPubUrl (byAccount: AccountInstance, video: VideoInstance) {
-  return byAccount.url + '#likes/' + video.id
+function getVideoLikeActivityPubUrl (byAccount: AccountModel, video: VideoModel) {
+  return byAccount.url + '/likes/' + video.id
 }
 
-function getVideoDislikeActivityPubUrl (byAccount: AccountInstance, video: VideoInstance) {
-  return byAccount.url + '#dislikes/' + video.id
+function getVideoDislikeActivityPubUrl (byAccount: AccountModel, video: VideoModel) {
+  return byAccount.url + '/dislikes/' + video.id
 }
 
-function getAccountFollowActivityPubUrl (accountFollow: AccountFollowInstance) {
+function getAccountFollowActivityPubUrl (accountFollow: AccountFollowModel) {
   const me = accountFollow.AccountFollower
   const following = accountFollow.AccountFollowing
 
-  return me.url + '#follows/' + following.id
+  return me.url + '/follows/' + following.id
 }
 
-function getAccountFollowAcceptActivityPubUrl (accountFollow: AccountFollowInstance) {
+function getAccountFollowAcceptActivityPubUrl (accountFollow: AccountFollowModel) {
   const follower = accountFollow.AccountFollower
   const me = accountFollow.AccountFollowing
 
-  return follower.url + '#accepts/follows/' + me.id
+  return follower.url + '/accepts/follows/' + me.id
 }
 
-function getAnnounceActivityPubUrl (originalUrl: string, byAccount: AccountInstance) {
-  return originalUrl + '#announces/' + byAccount.id
+function getAnnounceActivityPubUrl (originalUrl: string, byAccount: AccountModel) {
+  return originalUrl + '/announces/' + byAccount.id
 }
 
 function getUpdateActivityPubUrl (originalUrl: string, updatedAt: string) {
-  return originalUrl + '#updates/' + updatedAt
+  return originalUrl + '/updates/' + updatedAt
 }
 
 function getUndoActivityPubUrl (originalUrl: string) {