diff options
author | Chocobozzz <me@florianbigard.com> | 2019-01-15 11:14:12 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-01-15 14:45:09 +0100 |
commit | 848f499def54db2dd36437ef0dfb74dd5041c23b (patch) | |
tree | 13e6fcd30e3ce5306d5999fc91561af54d9fd20e /server/helpers/custom-validators/activitypub/videos.ts | |
parent | 44b9c0ba31c4a97e3d874f33226ad935c3a90dd5 (diff) | |
download | PeerTube-848f499def54db2dd36437ef0dfb74dd5041c23b.tar.gz PeerTube-848f499def54db2dd36437ef0dfb74dd5041c23b.tar.zst PeerTube-848f499def54db2dd36437ef0dfb74dd5041c23b.zip |
Prepare Dislike/Flag/View fixes
For now we Create these activities, but we should just send them
directly.
This fix handles correctly direct Dislikes/Flags/Views, we'll implement
the sending correctly these activities in the next peertube version
Diffstat (limited to 'server/helpers/custom-validators/activitypub/videos.ts')
-rw-r--r-- | server/helpers/custom-validators/activitypub/videos.ts | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/server/helpers/custom-validators/activitypub/videos.ts b/server/helpers/custom-validators/activitypub/videos.ts index 95fe824b9..0f34aab21 100644 --- a/server/helpers/custom-validators/activitypub/videos.ts +++ b/server/helpers/custom-validators/activitypub/videos.ts | |||
@@ -14,27 +14,11 @@ import { isActivityPubUrlValid, isBaseActivityValid, setValidAttributedTo } from | |||
14 | import { VideoState } from '../../../../shared/models/videos' | 14 | import { VideoState } from '../../../../shared/models/videos' |
15 | import { isVideoAbuseReasonValid } from '../video-abuses' | 15 | import { isVideoAbuseReasonValid } from '../video-abuses' |
16 | 16 | ||
17 | function sanitizeAndCheckVideoTorrentCreateActivity (activity: any) { | ||
18 | return isBaseActivityValid(activity, 'Create') && | ||
19 | sanitizeAndCheckVideoTorrentObject(activity.object) | ||
20 | } | ||
21 | |||
22 | function sanitizeAndCheckVideoTorrentUpdateActivity (activity: any) { | 17 | function sanitizeAndCheckVideoTorrentUpdateActivity (activity: any) { |
23 | return isBaseActivityValid(activity, 'Update') && | 18 | return isBaseActivityValid(activity, 'Update') && |
24 | sanitizeAndCheckVideoTorrentObject(activity.object) | 19 | sanitizeAndCheckVideoTorrentObject(activity.object) |
25 | } | 20 | } |
26 | 21 | ||
27 | function isVideoTorrentDeleteActivityValid (activity: any) { | ||
28 | return isBaseActivityValid(activity, 'Delete') | ||
29 | } | ||
30 | |||
31 | function isVideoFlagValid (activity: any) { | ||
32 | return isBaseActivityValid(activity, 'Create') && | ||
33 | activity.object.type === 'Flag' && | ||
34 | isVideoAbuseReasonValid(activity.object.content) && | ||
35 | isActivityPubUrlValid(activity.object.object) | ||
36 | } | ||
37 | |||
38 | function isActivityPubVideoDurationValid (value: string) { | 22 | function isActivityPubVideoDurationValid (value: string) { |
39 | // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-duration | 23 | // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-duration |
40 | return exists(value) && | 24 | return exists(value) && |
@@ -103,11 +87,8 @@ function isRemoteVideoUrlValid (url: any) { | |||
103 | // --------------------------------------------------------------------------- | 87 | // --------------------------------------------------------------------------- |
104 | 88 | ||
105 | export { | 89 | export { |
106 | sanitizeAndCheckVideoTorrentCreateActivity, | ||
107 | sanitizeAndCheckVideoTorrentUpdateActivity, | 90 | sanitizeAndCheckVideoTorrentUpdateActivity, |
108 | isVideoTorrentDeleteActivityValid, | ||
109 | isRemoteStringIdentifierValid, | 91 | isRemoteStringIdentifierValid, |
110 | isVideoFlagValid, | ||
111 | sanitizeAndCheckVideoTorrentObject, | 92 | sanitizeAndCheckVideoTorrentObject, |
112 | isRemoteVideoUrlValid | 93 | isRemoteVideoUrlValid |
113 | } | 94 | } |