diff options
author | Chocobozzz <me@florianbigard.com> | 2018-01-26 15:49:57 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-01-26 15:49:57 +0100 |
commit | 4ba3b8ea1be85d95a508ac479f26b96ceea15971 (patch) | |
tree | f76de3c6ec591cf885e5000f0e369aab883f3d95 /server/models/video/video.ts | |
parent | 7859b5800c08c15f3380fb3a7e267ce1b3f2df9f (diff) | |
download | PeerTube-4ba3b8ea1be85d95a508ac479f26b96ceea15971.tar.gz PeerTube-4ba3b8ea1be85d95a508ac479f26b96ceea15971.tar.zst PeerTube-4ba3b8ea1be85d95a508ac479f26b96ceea15971.zip |
Don't rehost announced video activities
Diffstat (limited to 'server/models/video/video.ts')
-rw-r--r-- | server/models/video/video.ts | 46 |
1 files changed, 38 insertions, 8 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 81d8a64ff..bd834b088 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -5,8 +5,26 @@ import * as parseTorrent from 'parse-torrent' | |||
5 | import { join } from 'path' | 5 | import { join } from 'path' |
6 | import * as Sequelize from 'sequelize' | 6 | import * as Sequelize from 'sequelize' |
7 | import { | 7 | import { |
8 | AfterDestroy, AllowNull, BeforeDestroy, BelongsTo, BelongsToMany, Column, CreatedAt, DataType, Default, ForeignKey, HasMany, | 8 | AfterDestroy, |
9 | IFindOptions, Is, IsInt, IsUUID, Min, Model, Scopes, Table, UpdatedAt | 9 | AllowNull, |
10 | BeforeDestroy, | ||
11 | BelongsTo, | ||
12 | BelongsToMany, | ||
13 | Column, | ||
14 | CreatedAt, | ||
15 | DataType, | ||
16 | Default, | ||
17 | ForeignKey, | ||
18 | HasMany, | ||
19 | IFindOptions, | ||
20 | Is, | ||
21 | IsInt, | ||
22 | IsUUID, | ||
23 | Min, | ||
24 | Model, | ||
25 | Scopes, | ||
26 | Table, | ||
27 | UpdatedAt | ||
10 | } from 'sequelize-typescript' | 28 | } from 'sequelize-typescript' |
11 | import { VideoPrivacy, VideoResolution } from '../../../shared' | 29 | import { VideoPrivacy, VideoResolution } from '../../../shared' |
12 | import { VideoTorrentObject } from '../../../shared/models/activitypub/objects' | 30 | import { VideoTorrentObject } from '../../../shared/models/activitypub/objects' |
@@ -16,17 +34,30 @@ import { createTorrentPromise, renamePromise, statPromise, unlinkPromise, writeF | |||
16 | import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' | 34 | import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' |
17 | import { isBooleanValid } from '../../helpers/custom-validators/misc' | 35 | import { isBooleanValid } from '../../helpers/custom-validators/misc' |
18 | import { | 36 | import { |
19 | isVideoCategoryValid, isVideoDescriptionValid, isVideoDurationValid, isVideoLanguageValid, isVideoLicenceValid, isVideoNameValid, | 37 | isVideoCategoryValid, |
38 | isVideoDescriptionValid, | ||
39 | isVideoDurationValid, | ||
40 | isVideoLanguageValid, | ||
41 | isVideoLicenceValid, | ||
42 | isVideoNameValid, | ||
20 | isVideoPrivacyValid | 43 | isVideoPrivacyValid |
21 | } from '../../helpers/custom-validators/videos' | 44 | } from '../../helpers/custom-validators/videos' |
22 | import { generateImageFromVideoFile, getVideoFileHeight, transcode } from '../../helpers/ffmpeg-utils' | 45 | import { generateImageFromVideoFile, getVideoFileHeight, transcode } from '../../helpers/ffmpeg-utils' |
23 | import { logger } from '../../helpers/logger' | 46 | import { logger } from '../../helpers/logger' |
24 | import { getServerActor } from '../../helpers/utils' | 47 | import { getServerActor } from '../../helpers/utils' |
25 | import { | 48 | import { |
26 | API_VERSION, CONFIG, CONSTRAINTS_FIELDS, PREVIEWS_SIZE, REMOTE_SCHEME, STATIC_PATHS, THUMBNAILS_SIZE, VIDEO_CATEGORIES, | 49 | API_VERSION, |
27 | VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES | 50 | CONFIG, |
51 | CONSTRAINTS_FIELDS, | ||
52 | PREVIEWS_SIZE, | ||
53 | REMOTE_SCHEME, | ||
54 | STATIC_PATHS, | ||
55 | THUMBNAILS_SIZE, | ||
56 | VIDEO_CATEGORIES, | ||
57 | VIDEO_LANGUAGES, | ||
58 | VIDEO_LICENCES, | ||
59 | VIDEO_PRIVACIES | ||
28 | } from '../../initializers' | 60 | } from '../../initializers' |
29 | import { getAnnounceActivityPubUrl } from '../../lib/activitypub' | ||
30 | import { sendDeleteVideo } from '../../lib/activitypub/send' | 61 | import { sendDeleteVideo } from '../../lib/activitypub/send' |
31 | import { AccountModel } from '../account/account' | 62 | import { AccountModel } from '../account/account' |
32 | import { AccountVideoRateModel } from '../account/account-video-rate' | 63 | import { AccountVideoRateModel } from '../account/account-video-rate' |
@@ -936,8 +967,7 @@ export class VideoModel extends Model<VideoModel> { | |||
936 | const shares: string[] = [] | 967 | const shares: string[] = [] |
937 | 968 | ||
938 | for (const videoShare of this.VideoShares) { | 969 | for (const videoShare of this.VideoShares) { |
939 | const shareUrl = getAnnounceActivityPubUrl(this.url, videoShare.Actor) | 970 | shares.push(videoShare.url) |
940 | shares.push(shareUrl) | ||
941 | } | 971 | } |
942 | 972 | ||
943 | sharesObject = activityPubCollection(shares) | 973 | sharesObject = activityPubCollection(shares) |