aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-15 15:12:23 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:52 +0100
commit8e13fa7d09e9925b4559cbba6c5d72c5ff1bd391 (patch)
treea59070f4dc6b52a5b422bd31a8eb8ea3bff831a0 /server/helpers
parent59c857da5961e2bcddcfd07832783c1e4afcd01a (diff)
downloadPeerTube-8e13fa7d09e9925b4559cbba6c5d72c5ff1bd391.tar.gz
PeerTube-8e13fa7d09e9925b4559cbba6c5d72c5ff1bd391.tar.zst
PeerTube-8e13fa7d09e9925b4559cbba6c5d72c5ff1bd391.zip
Add video abuse to activity pub
Diffstat (limited to 'server/helpers')
-rw-r--r--server/helpers/activitypub.ts6
-rw-r--r--server/helpers/custom-validators/videos.ts5
2 files changed, 4 insertions, 7 deletions
diff --git a/server/helpers/activitypub.ts b/server/helpers/activitypub.ts
index 3e77e0581..de20ba55d 100644
--- a/server/helpers/activitypub.ts
+++ b/server/helpers/activitypub.ts
@@ -22,10 +22,11 @@ function generateThumbnailFromUrl (video: VideoInstance, icon: ActivityIconObjec
22 return doRequestAndSaveToFile(options, thumbnailPath) 22 return doRequestAndSaveToFile(options, thumbnailPath)
23} 23}
24 24
25function getActivityPubUrl (type: 'video' | 'videoChannel' | 'account', id: string) { 25function getActivityPubUrl (type: 'video' | 'videoChannel' | 'account' | 'videoAbuse', id: string) {
26 if (type === 'video') return CONFIG.WEBSERVER.URL + '/videos/watch/' + id 26 if (type === 'video') return CONFIG.WEBSERVER.URL + '/videos/watch/' + id
27 else if (type === 'videoChannel') return CONFIG.WEBSERVER.URL + '/video-channels/' + id 27 else if (type === 'videoChannel') return CONFIG.WEBSERVER.URL + '/video-channels/' + id
28 else if (type === 'account') return CONFIG.WEBSERVER.URL + '/account/' + id 28 else if (type === 'account') return CONFIG.WEBSERVER.URL + '/account/' + id
29 else if (type === 'videoAbuse') return CONFIG.WEBSERVER.URL + '/admin/video-abuses/' + id
29 30
30 return '' 31 return ''
31} 32}
@@ -134,7 +135,8 @@ function activityPubContextify <T> (data: T) {
134 'nsfw': 'as:sensitive', 135 'nsfw': 'as:sensitive',
135 'language': 'http://schema.org/inLanguage', 136 'language': 'http://schema.org/inLanguage',
136 'views': 'http://schema.org/Number', 137 'views': 'http://schema.org/Number',
137 'size': 'http://schema.org/Number' 138 'size': 'http://schema.org/Number',
139 'VideoChannel': 'https://peertu.be/ns/VideoChannel'
138 } 140 }
139 ] 141 ]
140 }) 142 })
diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.ts
index d68de6609..1505632da 100644
--- a/server/helpers/custom-validators/videos.ts
+++ b/server/helpers/custom-validators/videos.ts
@@ -112,10 +112,6 @@ function isVideoAbuseReasonValid (value: string) {
112 return exists(value) && validator.isLength(value, VIDEO_ABUSES_CONSTRAINTS_FIELDS.REASON) 112 return exists(value) && validator.isLength(value, VIDEO_ABUSES_CONSTRAINTS_FIELDS.REASON)
113} 113}
114 114
115function isVideoAbuseReporterUsernameValid (value: string) {
116 return isUserUsernameValid(value)
117}
118
119function isVideoViewsValid (value: string) { 115function isVideoViewsValid (value: string) {
120 return exists(value) && validator.isInt(value + '', VIDEOS_CONSTRAINTS_FIELDS.VIEWS) 116 return exists(value) && validator.isInt(value + '', VIDEOS_CONSTRAINTS_FIELDS.VIEWS)
121} 117}
@@ -209,7 +205,6 @@ export {
209 isVideoThumbnailDataValid, 205 isVideoThumbnailDataValid,
210 isVideoFileExtnameValid, 206 isVideoFileExtnameValid,
211 isVideoAbuseReasonValid, 207 isVideoAbuseReasonValid,
212 isVideoAbuseReporterUsernameValid,
213 isVideoFile, 208 isVideoFile,
214 isVideoViewsValid, 209 isVideoViewsValid,
215 isVideoLikesValid, 210 isVideoLikesValid,