aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-04-11 11:33:44 +0200
committerChocobozzz <me@florianbigard.com>2019-04-11 13:45:39 +0200
commit6dd9de95dfa39bd5c1faed00d1dbd52cd112bae0 (patch)
treeb47de7efb8c6c611c63a15a971c6125a278f547a /server/models/video/video.ts
parent2c3abc4fa796555eb7d25f416c4f41ab3e3ad8ca (diff)
downloadPeerTube-6dd9de95dfa39bd5c1faed00d1dbd52cd112bae0.tar.gz
PeerTube-6dd9de95dfa39bd5c1faed00d1dbd52cd112bae0.tar.zst
PeerTube-6dd9de95dfa39bd5c1faed00d1dbd52cd112bae0.zip
Move config in its own file
Diffstat (limited to 'server/models/video/video.ts')
-rw-r--r--server/models/video/video.ts22
1 files changed, 12 insertions, 10 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index b0d92b674..3b30e9e28 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -51,10 +51,9 @@ import { getServerActor } from '../../helpers/utils'
51import { 51import {
52 ACTIVITY_PUB, 52 ACTIVITY_PUB,
53 API_VERSION, 53 API_VERSION,
54 CONFIG,
55 CONSTRAINTS_FIELDS, 54 CONSTRAINTS_FIELDS,
56 HLS_STREAMING_PLAYLIST_DIRECTORY,
57 HLS_REDUNDANCY_DIRECTORY, 55 HLS_REDUNDANCY_DIRECTORY,
56 HLS_STREAMING_PLAYLIST_DIRECTORY,
58 PREVIEWS_SIZE, 57 PREVIEWS_SIZE,
59 REMOTE_SCHEME, 58 REMOTE_SCHEME,
60 STATIC_DOWNLOAD_PATHS, 59 STATIC_DOWNLOAD_PATHS,
@@ -64,7 +63,8 @@ import {
64 VIDEO_LANGUAGES, 63 VIDEO_LANGUAGES,
65 VIDEO_LICENCES, 64 VIDEO_LICENCES,
66 VIDEO_PRIVACIES, 65 VIDEO_PRIVACIES,
67 VIDEO_STATES 66 VIDEO_STATES,
67 WEBSERVER
68} from '../../initializers' 68} from '../../initializers'
69import { sendDeleteVideo } from '../../lib/activitypub/send' 69import { sendDeleteVideo } from '../../lib/activitypub/send'
70import { AccountModel } from '../account/account' 70import { AccountModel } from '../account/account'
@@ -77,12 +77,13 @@ import {
77 buildTrigramSearchIndex, 77 buildTrigramSearchIndex,
78 buildWhereIdOrUUID, 78 buildWhereIdOrUUID,
79 createSimilarityAttribute, 79 createSimilarityAttribute,
80 getVideoSort, isOutdated, 80 getVideoSort,
81 isOutdated,
81 throwIfNotValid 82 throwIfNotValid
82} from '../utils' 83} from '../utils'
83import { TagModel } from './tag' 84import { TagModel } from './tag'
84import { VideoAbuseModel } from './video-abuse' 85import { VideoAbuseModel } from './video-abuse'
85import { VideoChannelModel, ScopeNames as VideoChannelScopeNames } from './video-channel' 86import { ScopeNames as VideoChannelScopeNames, VideoChannelModel } from './video-channel'
86import { VideoCommentModel } from './video-comment' 87import { VideoCommentModel } from './video-comment'
87import { VideoFileModel } from './video-file' 88import { VideoFileModel } from './video-file'
88import { VideoShareModel } from './video-share' 89import { VideoShareModel } from './video-share'
@@ -105,6 +106,7 @@ import { UserModel } from '../account/user'
105import { VideoImportModel } from './video-import' 106import { VideoImportModel } from './video-import'
106import { VideoStreamingPlaylistModel } from './video-streaming-playlist' 107import { VideoStreamingPlaylistModel } from './video-streaming-playlist'
107import { VideoPlaylistElementModel } from './video-playlist-element' 108import { VideoPlaylistElementModel } from './video-playlist-element'
109import { CONFIG } from '../../initializers/config'
108 110
109// FIXME: Define indexes here because there is an issue with TS and Sequelize.literal when called directly in the annotation 111// FIXME: Define indexes here because there is an issue with TS and Sequelize.literal when called directly in the annotation
110const indexes: Sequelize.DefineIndexesOptions[] = [ 112const indexes: Sequelize.DefineIndexesOptions[] = [
@@ -1664,10 +1666,10 @@ export class VideoModel extends Model<VideoModel> {
1664 name: `${this.name} ${videoFile.resolution}p${videoFile.extname}`, 1666 name: `${this.name} ${videoFile.resolution}p${videoFile.extname}`,
1665 createdBy: 'PeerTube', 1667 createdBy: 'PeerTube',
1666 announceList: [ 1668 announceList: [
1667 [ CONFIG.WEBSERVER.WS + '://' + CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT + '/tracker/socket' ], 1669 [ WEBSERVER.WS + '://' + WEBSERVER.HOSTNAME + ':' + WEBSERVER.PORT + '/tracker/socket' ],
1668 [ CONFIG.WEBSERVER.URL + '/tracker/announce' ] 1670 [ WEBSERVER.URL + '/tracker/announce' ]
1669 ], 1671 ],
1670 urlList: [ CONFIG.WEBSERVER.URL + STATIC_PATHS.WEBSEED + this.getVideoFilename(videoFile) ] 1672 urlList: [ WEBSERVER.URL + STATIC_PATHS.WEBSEED + this.getVideoFilename(videoFile) ]
1671 } 1673 }
1672 1674
1673 const torrent = await createTorrentPromise(this.getVideoFilePath(videoFile), options) 1675 const torrent = await createTorrentPromise(this.getVideoFilePath(videoFile), options)
@@ -1781,8 +1783,8 @@ export class VideoModel extends Model<VideoModel> {
1781 let baseUrlWs 1783 let baseUrlWs
1782 1784
1783 if (this.isOwned()) { 1785 if (this.isOwned()) {
1784 baseUrlHttp = CONFIG.WEBSERVER.URL 1786 baseUrlHttp = WEBSERVER.URL
1785 baseUrlWs = CONFIG.WEBSERVER.WS + '://' + CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT 1787 baseUrlWs = WEBSERVER.WS + '://' + WEBSERVER.HOSTNAME + ':' + WEBSERVER.PORT
1786 } else { 1788 } else {
1787 baseUrlHttp = REMOTE_SCHEME.HTTP + '://' + this.VideoChannel.Account.Actor.Server.host 1789 baseUrlHttp = REMOTE_SCHEME.HTTP + '://' + this.VideoChannel.Account.Actor.Server.host
1788 baseUrlWs = REMOTE_SCHEME.WS + '://' + this.VideoChannel.Account.Actor.Server.host 1790 baseUrlWs = REMOTE_SCHEME.WS + '://' + this.VideoChannel.Account.Actor.Server.host