diff options
author | Chocobozzz <me@florianbigard.com> | 2019-04-11 11:33:44 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-04-11 13:45:39 +0200 |
commit | 6dd9de95dfa39bd5c1faed00d1dbd52cd112bae0 (patch) | |
tree | b47de7efb8c6c611c63a15a971c6125a278f547a /server/models/video/video.ts | |
parent | 2c3abc4fa796555eb7d25f416c4f41ab3e3ad8ca (diff) | |
download | PeerTube-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.ts | 22 |
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' | |||
51 | import { | 51 | import { |
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' |
69 | import { sendDeleteVideo } from '../../lib/activitypub/send' | 69 | import { sendDeleteVideo } from '../../lib/activitypub/send' |
70 | import { AccountModel } from '../account/account' | 70 | import { 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' |
83 | import { TagModel } from './tag' | 84 | import { TagModel } from './tag' |
84 | import { VideoAbuseModel } from './video-abuse' | 85 | import { VideoAbuseModel } from './video-abuse' |
85 | import { VideoChannelModel, ScopeNames as VideoChannelScopeNames } from './video-channel' | 86 | import { ScopeNames as VideoChannelScopeNames, VideoChannelModel } from './video-channel' |
86 | import { VideoCommentModel } from './video-comment' | 87 | import { VideoCommentModel } from './video-comment' |
87 | import { VideoFileModel } from './video-file' | 88 | import { VideoFileModel } from './video-file' |
88 | import { VideoShareModel } from './video-share' | 89 | import { VideoShareModel } from './video-share' |
@@ -105,6 +106,7 @@ import { UserModel } from '../account/user' | |||
105 | import { VideoImportModel } from './video-import' | 106 | import { VideoImportModel } from './video-import' |
106 | import { VideoStreamingPlaylistModel } from './video-streaming-playlist' | 107 | import { VideoStreamingPlaylistModel } from './video-streaming-playlist' |
107 | import { VideoPlaylistElementModel } from './video-playlist-element' | 108 | import { VideoPlaylistElementModel } from './video-playlist-element' |
109 | import { 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 |
110 | const indexes: Sequelize.DefineIndexesOptions[] = [ | 112 | const 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 |