diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-16 17:04:19 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-27 19:40:52 +0100 |
commit | 21e0727a84734cb0c81c1c9bb22a49b13e46fe5f (patch) | |
tree | 088da51cadbffe3ac64414b407e161f58b53bde7 /server/lib | |
parent | d7d5611c8a23de9b483f0437ad3469afef7b8805 (diff) | |
download | PeerTube-21e0727a84734cb0c81c1c9bb22a49b13e46fe5f.tar.gz PeerTube-21e0727a84734cb0c81c1c9bb22a49b13e46fe5f.tar.zst PeerTube-21e0727a84734cb0c81c1c9bb22a49b13e46fe5f.zip |
Federate video abuses
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/activitypub/misc.ts | 6 | ||||
-rw-r--r-- | server/lib/activitypub/send-request.ts | 4 |
2 files changed, 4 insertions, 6 deletions
diff --git a/server/lib/activitypub/misc.ts b/server/lib/activitypub/misc.ts index f853d742e..c07d9f654 100644 --- a/server/lib/activitypub/misc.ts +++ b/server/lib/activitypub/misc.ts | |||
@@ -1,14 +1,12 @@ | |||
1 | import * as magnetUtil from 'magnet-uri' | 1 | import * as magnetUtil from 'magnet-uri' |
2 | import * as Sequelize from 'sequelize' | ||
3 | import { VideoTorrentObject } from '../../../shared' | 2 | import { VideoTorrentObject } from '../../../shared' |
3 | import { VideoChannelObject } from '../../../shared/models/activitypub/objects/video-channel-object' | ||
4 | import { isVideoFileInfoHashValid } from '../../helpers/custom-validators/videos' | 4 | import { isVideoFileInfoHashValid } from '../../helpers/custom-validators/videos' |
5 | import { database as db } from '../../initializers' | ||
6 | import { VIDEO_MIMETYPE_EXT } from '../../initializers/constants' | 5 | import { VIDEO_MIMETYPE_EXT } from '../../initializers/constants' |
6 | import { AccountInstance } from '../../models/account/account-interface' | ||
7 | import { VideoChannelInstance } from '../../models/video/video-channel-interface' | 7 | import { VideoChannelInstance } from '../../models/video/video-channel-interface' |
8 | import { VideoFileAttributes } from '../../models/video/video-file-interface' | 8 | import { VideoFileAttributes } from '../../models/video/video-file-interface' |
9 | import { VideoAttributes, VideoInstance } from '../../models/video/video-interface' | 9 | import { VideoAttributes, VideoInstance } from '../../models/video/video-interface' |
10 | import { VideoChannelObject } from '../../../shared/models/activitypub/objects/video-channel-object' | ||
11 | import { AccountInstance } from '../../models/account/account-interface' | ||
12 | 10 | ||
13 | function videoChannelActivityObjectToDBAttributes (videoChannelObject: VideoChannelObject, account: AccountInstance) { | 11 | function videoChannelActivityObjectToDBAttributes (videoChannelObject: VideoChannelObject, account: AccountInstance) { |
14 | return { | 12 | return { |
diff --git a/server/lib/activitypub/send-request.ts b/server/lib/activitypub/send-request.ts index d5d07011a..abc1b598d 100644 --- a/server/lib/activitypub/send-request.ts +++ b/server/lib/activitypub/send-request.ts | |||
@@ -8,7 +8,7 @@ import { | |||
8 | } from '../../models' | 8 | } from '../../models' |
9 | import { httpRequestJobScheduler } from '../jobs' | 9 | import { httpRequestJobScheduler } from '../jobs' |
10 | import { signObject, activityPubContextify } from '../../helpers' | 10 | import { signObject, activityPubContextify } from '../../helpers' |
11 | import { Activity } from '../../../shared' | 11 | import { Activity, VideoAbuseObject } from '../../../shared' |
12 | import { VideoAbuseInstance } from '../../models/video/video-abuse-interface' | 12 | import { VideoAbuseInstance } from '../../models/video/video-abuse-interface' |
13 | import { getActivityPubUrl } from '../../helpers/activitypub' | 13 | import { getActivityPubUrl } from '../../helpers/activitypub' |
14 | import { logger } from '../../helpers/logger' | 14 | import { logger } from '../../helpers/logger' |
@@ -96,7 +96,7 @@ async function sendVideoAbuse ( | |||
96 | t: Sequelize.Transaction | 96 | t: Sequelize.Transaction |
97 | ) { | 97 | ) { |
98 | const url = getActivityPubUrl('videoAbuse', videoAbuse.id.toString()) | 98 | const url = getActivityPubUrl('videoAbuse', videoAbuse.id.toString()) |
99 | const data = await createActivityData(url, fromAccount, video.url) | 99 | const data = await createActivityData(url, fromAccount, videoAbuse.toActivityPubObject()) |
100 | 100 | ||
101 | return unicastTo(data, video.VideoChannel.Account.sharedInboxUrl, t) | 101 | return unicastTo(data, video.VideoChannel.Account.sharedInboxUrl, t) |
102 | } | 102 | } |