diff options
author | Chocobozzz <me@florianbigard.com> | 2018-12-11 14:52:50 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-12-11 15:11:09 +0100 |
commit | 14e2014acc1362cfbb770c051a7254b156cd8efb (patch) | |
tree | 8b7d5aedd9fe0beff8b971c9bae7781ba2069228 /server/lib/activitypub/videos.ts | |
parent | 8923187455c5aa7167d813c5c745d3857f183fd7 (diff) | |
download | PeerTube-14e2014acc1362cfbb770c051a7254b156cd8efb.tar.gz PeerTube-14e2014acc1362cfbb770c051a7254b156cd8efb.tar.zst PeerTube-14e2014acc1362cfbb770c051a7254b156cd8efb.zip |
Support additional video extensions
Diffstat (limited to 'server/lib/activitypub/videos.ts')
-rw-r--r-- | server/lib/activitypub/videos.ts | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts index 3d17e6846..379c2a0d7 100644 --- a/server/lib/activitypub/videos.ts +++ b/server/lib/activitypub/videos.ts | |||
@@ -1,7 +1,6 @@ | |||
1 | import * as Bluebird from 'bluebird' | 1 | import * as Bluebird from 'bluebird' |
2 | import * as sequelize from 'sequelize' | 2 | import * as sequelize from 'sequelize' |
3 | import * as magnetUtil from 'magnet-uri' | 3 | import * as magnetUtil from 'magnet-uri' |
4 | import { join } from 'path' | ||
5 | import * as request from 'request' | 4 | import * as request from 'request' |
6 | import { ActivityIconObject, ActivityUrlObject, ActivityVideoUrlObject, VideoState } from '../../../shared/index' | 5 | import { ActivityIconObject, ActivityUrlObject, ActivityVideoUrlObject, VideoState } from '../../../shared/index' |
7 | import { VideoTorrentObject } from '../../../shared/models/activitypub/objects' | 6 | import { VideoTorrentObject } from '../../../shared/models/activitypub/objects' |
@@ -11,7 +10,7 @@ import { isVideoFileInfoHashValid } from '../../helpers/custom-validators/videos | |||
11 | import { resetSequelizeInstance, retryTransactionWrapper } from '../../helpers/database-utils' | 10 | import { resetSequelizeInstance, retryTransactionWrapper } from '../../helpers/database-utils' |
12 | import { logger } from '../../helpers/logger' | 11 | import { logger } from '../../helpers/logger' |
13 | import { doRequest, downloadImage } from '../../helpers/requests' | 12 | import { doRequest, downloadImage } from '../../helpers/requests' |
14 | import { ACTIVITY_PUB, CONFIG, REMOTE_SCHEME, sequelizeTypescript, THUMBNAILS_SIZE, VIDEO_MIMETYPE_EXT } from '../../initializers' | 13 | import { ACTIVITY_PUB, CONFIG, MIMETYPES, REMOTE_SCHEME, sequelizeTypescript, THUMBNAILS_SIZE } from '../../initializers' |
15 | import { ActorModel } from '../../models/activitypub/actor' | 14 | import { ActorModel } from '../../models/activitypub/actor' |
16 | import { TagModel } from '../../models/video/tag' | 15 | import { TagModel } from '../../models/video/tag' |
17 | import { VideoModel } from '../../models/video/video' | 16 | import { VideoModel } from '../../models/video/video' |
@@ -362,7 +361,7 @@ export { | |||
362 | // --------------------------------------------------------------------------- | 361 | // --------------------------------------------------------------------------- |
363 | 362 | ||
364 | function isActivityVideoUrlObject (url: ActivityUrlObject): url is ActivityVideoUrlObject { | 363 | function isActivityVideoUrlObject (url: ActivityUrlObject): url is ActivityVideoUrlObject { |
365 | const mimeTypes = Object.keys(VIDEO_MIMETYPE_EXT) | 364 | const mimeTypes = Object.keys(MIMETYPES.VIDEO.MIMETYPE_EXT) |
366 | 365 | ||
367 | const urlMediaType = url.mediaType || url.mimeType | 366 | const urlMediaType = url.mediaType || url.mimeType |
368 | return mimeTypes.indexOf(urlMediaType) !== -1 && urlMediaType.startsWith('video/') | 367 | return mimeTypes.indexOf(urlMediaType) !== -1 && urlMediaType.startsWith('video/') |
@@ -490,7 +489,7 @@ function videoFileActivityUrlToDBAttributes (video: VideoModel, videoObject: Vid | |||
490 | 489 | ||
491 | const mediaType = fileUrl.mediaType || fileUrl.mimeType | 490 | const mediaType = fileUrl.mediaType || fileUrl.mimeType |
492 | const attribute = { | 491 | const attribute = { |
493 | extname: VIDEO_MIMETYPE_EXT[ mediaType ], | 492 | extname: MIMETYPES.VIDEO.MIMETYPE_EXT[ mediaType ], |
494 | infoHash: parsed.infoHash, | 493 | infoHash: parsed.infoHash, |
495 | resolution: fileUrl.height, | 494 | resolution: fileUrl.height, |
496 | size: fileUrl.size, | 495 | size: fileUrl.size, |