aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-01-26 15:49:57 +0100
committerChocobozzz <me@florianbigard.com>2018-01-26 15:49:57 +0100
commit4ba3b8ea1be85d95a508ac479f26b96ceea15971 (patch)
treef76de3c6ec591cf885e5000f0e369aab883f3d95 /server/models/video/video.ts
parent7859b5800c08c15f3380fb3a7e267ce1b3f2df9f (diff)
downloadPeerTube-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.ts46
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'
5import { join } from 'path' 5import { join } from 'path'
6import * as Sequelize from 'sequelize' 6import * as Sequelize from 'sequelize'
7import { 7import {
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'
11import { VideoPrivacy, VideoResolution } from '../../../shared' 29import { VideoPrivacy, VideoResolution } from '../../../shared'
12import { VideoTorrentObject } from '../../../shared/models/activitypub/objects' 30import { VideoTorrentObject } from '../../../shared/models/activitypub/objects'
@@ -16,17 +34,30 @@ import { createTorrentPromise, renamePromise, statPromise, unlinkPromise, writeF
16import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' 34import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
17import { isBooleanValid } from '../../helpers/custom-validators/misc' 35import { isBooleanValid } from '../../helpers/custom-validators/misc'
18import { 36import {
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'
22import { generateImageFromVideoFile, getVideoFileHeight, transcode } from '../../helpers/ffmpeg-utils' 45import { generateImageFromVideoFile, getVideoFileHeight, transcode } from '../../helpers/ffmpeg-utils'
23import { logger } from '../../helpers/logger' 46import { logger } from '../../helpers/logger'
24import { getServerActor } from '../../helpers/utils' 47import { getServerActor } from '../../helpers/utils'
25import { 48import {
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'
29import { getAnnounceActivityPubUrl } from '../../lib/activitypub'
30import { sendDeleteVideo } from '../../lib/activitypub/send' 61import { sendDeleteVideo } from '../../lib/activitypub/send'
31import { AccountModel } from '../account/account' 62import { AccountModel } from '../account/account'
32import { AccountVideoRateModel } from '../account/account-video-rate' 63import { 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)