aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/checker-after-init.ts9
-rw-r--r--server/initializers/checker-before-init.ts4
-rw-r--r--server/initializers/config.ts15
-rw-r--r--server/initializers/constants.ts137
-rw-r--r--server/initializers/database.ts2
-rw-r--r--server/initializers/migrations/0005-email-pod.ts4
-rw-r--r--server/initializers/migrations/0010-email-user.ts4
-rw-r--r--server/initializers/migrations/0015-video-views.ts4
-rw-r--r--server/initializers/migrations/0020-video-likes.ts4
-rw-r--r--server/initializers/migrations/0025-video-dislikes.ts4
-rw-r--r--server/initializers/migrations/0030-video-category.ts4
-rw-r--r--server/initializers/migrations/0035-video-licence.ts4
-rw-r--r--server/initializers/migrations/0040-video-nsfw.ts4
-rw-r--r--server/initializers/migrations/0045-user-display-nsfw.ts4
-rw-r--r--server/initializers/migrations/0050-video-language.ts4
-rw-r--r--server/initializers/migrations/0055-video-uuid.ts4
-rw-r--r--server/initializers/migrations/0060-video-file.ts6
-rw-r--r--server/initializers/migrations/0065-video-file-size.ts6
-rw-r--r--server/initializers/migrations/0070-user-video-quota.ts6
-rw-r--r--server/initializers/migrations/0075-video-resolutions.ts6
-rw-r--r--server/initializers/migrations/0080-video-channels.ts6
-rw-r--r--server/initializers/migrations/0085-user-role.ts6
-rw-r--r--server/initializers/migrations/0090-videos-description.ts6
-rw-r--r--server/initializers/migrations/0095-videos-privacy.ts6
-rw-r--r--server/initializers/migrations/0100-activitypub.ts6
-rw-r--r--server/initializers/migrations/0105-server-mail.ts6
-rw-r--r--server/initializers/migrations/0110-server-key.ts6
-rw-r--r--server/initializers/migrations/0115-account-avatar.ts6
-rw-r--r--server/initializers/migrations/0120-video-null.ts6
-rw-r--r--server/initializers/migrations/0125-table-lowercase.ts4
-rw-r--r--server/initializers/migrations/0130-user-autoplay-video.ts4
-rw-r--r--server/initializers/migrations/0135-video-channel-actor.ts42
-rw-r--r--server/initializers/migrations/0140-actor-url.ts4
-rw-r--r--server/initializers/migrations/0145-delete-author.ts4
-rw-r--r--server/initializers/migrations/0150-avatar-cascade.ts4
-rw-r--r--server/initializers/migrations/0155-video-comments-enabled.ts4
-rw-r--r--server/initializers/migrations/0160-account-route.ts4
-rw-r--r--server/initializers/migrations/0165-video-route.ts4
-rw-r--r--server/initializers/migrations/0170-actor-follow-score.ts4
-rw-r--r--server/initializers/migrations/0175-actor-follow-counts.ts4
-rw-r--r--server/initializers/migrations/0180-job-table-delete.ts4
-rw-r--r--server/initializers/migrations/0185-video-share-url.ts4
-rw-r--r--server/initializers/migrations/0190-video-comment-unique-url.ts4
-rw-r--r--server/initializers/migrations/0195-support.ts4
-rw-r--r--server/initializers/migrations/0200-video-published-at.ts4
-rw-r--r--server/initializers/migrations/0205-user-nsfw-policy.ts4
-rw-r--r--server/initializers/migrations/0210-video-language.ts4
-rw-r--r--server/initializers/migrations/0215-video-support-length.ts4
-rw-r--r--server/initializers/migrations/0255-video-blacklist-reason.ts1
-rw-r--r--server/initializers/migrations/0285-description-support.ts6
-rw-r--r--server/initializers/migrations/0290-account-video-rate-url.ts6
-rw-r--r--server/initializers/migrations/0295-video-file-extname.ts6
-rw-r--r--server/initializers/migrations/0300-user-videos-history-enabled.ts6
-rw-r--r--server/initializers/migrations/0305-fix-unfederated-videos.ts6
-rw-r--r--server/initializers/migrations/0310-drop-unused-video-indexes.ts6
-rw-r--r--server/initializers/migrations/0315-user-notifications.ts4
-rw-r--r--server/initializers/migrations/0320-blacklist-unfederate.ts4
-rw-r--r--server/initializers/migrations/0325-video-abuse-fields.ts4
-rw-r--r--server/initializers/migrations/0330-video-streaming-playlist.ts4
-rw-r--r--server/initializers/migrations/0335-video-downloading-enabled.ts4
-rw-r--r--server/initializers/migrations/0340-add-originally-published-at.ts4
-rw-r--r--server/initializers/migrations/0345-video-playlists.ts4
-rw-r--r--server/initializers/migrations/0350-video-blacklist-type.ts6
-rw-r--r--server/initializers/migrations/0355-p2p-peer-version.ts6
-rw-r--r--server/initializers/migrations/0360-notification-instance-follower.ts6
-rw-r--r--server/initializers/migrations/0365-user-admin-flags.ts6
-rw-r--r--server/initializers/migrations/0370-thumbnail.ts6
-rw-r--r--server/initializers/migrations/0375-account-description.ts6
-rw-r--r--server/initializers/migrations/0380-cleanup-timestamps.ts6
-rw-r--r--server/initializers/migrations/0385-remove-actor-uuid.ts6
-rw-r--r--server/initializers/migrations/0390-user-pending-email.ts6
-rw-r--r--server/initializers/migrations/0395-user-video-languages.ts6
-rw-r--r--server/initializers/migrations/0400-user-theme.ts6
-rw-r--r--server/initializers/migrations/0405-plugin.ts6
-rw-r--r--server/initializers/migrations/0410-video-playlist-element.ts6
-rw-r--r--server/initializers/migrations/0415-thumbnail-auto-generated.ts6
-rw-r--r--server/initializers/migrations/0420-avatar-lazy.ts6
-rw-r--r--server/initializers/migrations/0425-nullable-actor-fields.ts6
-rw-r--r--server/initializers/migrations/0430-auto-follow-notification-setting.ts6
-rw-r--r--server/initializers/migrations/0435-user-modals.ts6
-rw-r--r--server/initializers/migrations/0440-user-auto-play-next-video.ts6
-rw-r--r--server/initializers/migrations/0445-shared-inbox-optional.ts6
-rw-r--r--server/initializers/migrations/0450-streaming-playlist-files.ts16
-rw-r--r--server/initializers/migrations/0455-soft-delete-video-comments.ts6
-rw-r--r--server/initializers/migrations/0460-user-playlist-autoplay.ts6
-rw-r--r--server/initializers/migrations/0465-thumbnail-file-url-length.ts6
-rw-r--r--server/initializers/migrations/0470-cleaup-indexes.ts6
-rw-r--r--server/initializers/migrations/0475-redundancy-expires-on.ts27
-rw-r--r--server/initializers/migrations/0480-caption-file-url.ts27
-rw-r--r--server/initializers/migrator.ts4
90 files changed, 372 insertions, 314 deletions
diff --git a/server/initializers/checker-after-init.ts b/server/initializers/checker-after-init.ts
index 44efd346c..e01609eef 100644
--- a/server/initializers/checker-after-init.ts
+++ b/server/initializers/checker-after-init.ts
@@ -3,20 +3,19 @@ import { isProdInstance, isTestInstance } from '../helpers/core-utils'
3import { UserModel } from '../models/account/user' 3import { UserModel } from '../models/account/user'
4import { ApplicationModel } from '../models/application/application' 4import { ApplicationModel } from '../models/application/application'
5import { OAuthClientModel } from '../models/oauth/oauth-client' 5import { OAuthClientModel } from '../models/oauth/oauth-client'
6import { parse } from 'url' 6import { URL } from 'url'
7import { CONFIG } from './config' 7import { CONFIG, isEmailEnabled } from './config'
8import { logger } from '../helpers/logger' 8import { logger } from '../helpers/logger'
9import { getServerActor } from '../helpers/utils' 9import { getServerActor } from '../helpers/utils'
10import { RecentlyAddedStrategy } from '../../shared/models/redundancy' 10import { RecentlyAddedStrategy } from '../../shared/models/redundancy'
11import { isArray } from '../helpers/custom-validators/misc' 11import { isArray } from '../helpers/custom-validators/misc'
12import { uniq } from 'lodash' 12import { uniq } from 'lodash'
13import { Emailer } from '../lib/emailer'
14import { WEBSERVER } from './constants' 13import { WEBSERVER } from './constants'
15 14
16async function checkActivityPubUrls () { 15async function checkActivityPubUrls () {
17 const actor = await getServerActor() 16 const actor = await getServerActor()
18 17
19 const parsed = parse(actor.url) 18 const parsed = new URL(actor.url)
20 if (WEBSERVER.HOST !== parsed.host) { 19 if (WEBSERVER.HOST !== parsed.host) {
21 const NODE_ENV = config.util.getEnv('NODE_ENV') 20 const NODE_ENV = config.util.getEnv('NODE_ENV')
22 const NODE_CONFIG_DIR = config.util.getEnv('NODE_CONFIG_DIR') 21 const NODE_CONFIG_DIR = config.util.getEnv('NODE_CONFIG_DIR')
@@ -41,7 +40,7 @@ function checkConfig () {
41 } 40 }
42 41
43 // Email verification 42 // Email verification
44 if (!Emailer.isEnabled()) { 43 if (!isEmailEnabled()) {
45 if (CONFIG.SIGNUP.ENABLED && CONFIG.SIGNUP.REQUIRES_EMAIL_VERIFICATION) { 44 if (CONFIG.SIGNUP.ENABLED && CONFIG.SIGNUP.REQUIRES_EMAIL_VERIFICATION) {
46 return 'Emailer is disabled but you require signup email verification.' 45 return 'Emailer is disabled but you require signup email verification.'
47 } 46 }
diff --git a/server/initializers/checker-before-init.ts b/server/initializers/checker-before-init.ts
index 9731a0af9..a75f2cec2 100644
--- a/server/initializers/checker-before-init.ts
+++ b/server/initializers/checker-before-init.ts
@@ -35,8 +35,8 @@ function checkMissedConfig () {
35 ] 35 ]
36 const requiredAlternatives = [ 36 const requiredAlternatives = [
37 [ // set 37 [ // set
38 ['redis.hostname', 'redis.port'], // alternative 38 [ 'redis.hostname', 'redis.port' ], // alternative
39 ['redis.socket'] 39 [ 'redis.socket' ]
40 ] 40 ]
41 ] 41 ]
42 const miss: string[] = [] 42 const miss: string[] = []
diff --git a/server/initializers/config.ts b/server/initializers/config.ts
index 7fd77f3e8..950ca61bd 100644
--- a/server/initializers/config.ts
+++ b/server/initializers/config.ts
@@ -1,6 +1,6 @@
1import { IConfig } from 'config' 1import { IConfig } from 'config'
2import { dirname, join } from 'path' 2import { dirname, join } from 'path'
3import { VideosRedundancy } from '../../shared/models' 3import { VideosRedundancyStrategy } from '../../shared/models'
4// Do not use barrels, remain constants as independent as possible 4// Do not use barrels, remain constants as independent as possible
5import { buildPath, parseBytes, parseDurationToMs, root } from '../helpers/core-utils' 5import { buildPath, parseBytes, parseDurationToMs, root } from '../helpers/core-utils'
6import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' 6import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type'
@@ -284,11 +284,16 @@ function registerConfigChangedHandler (fun: Function) {
284 configChangedHandlers.push(fun) 284 configChangedHandlers.push(fun)
285} 285}
286 286
287function isEmailEnabled () {
288 return !!CONFIG.SMTP.HOSTNAME && !!CONFIG.SMTP.PORT
289}
290
287// --------------------------------------------------------------------------- 291// ---------------------------------------------------------------------------
288 292
289export { 293export {
290 CONFIG, 294 CONFIG,
291 registerConfigChangedHandler 295 registerConfigChangedHandler,
296 isEmailEnabled
292} 297}
293 298
294// --------------------------------------------------------------------------- 299// ---------------------------------------------------------------------------
@@ -301,10 +306,10 @@ function getLocalConfigFilePath () {
301 if (process.env.NODE_ENV) filename += `-${process.env.NODE_ENV}` 306 if (process.env.NODE_ENV) filename += `-${process.env.NODE_ENV}`
302 if (process.env.NODE_APP_INSTANCE) filename += `-${process.env.NODE_APP_INSTANCE}` 307 if (process.env.NODE_APP_INSTANCE) filename += `-${process.env.NODE_APP_INSTANCE}`
303 308
304 return join(dirname(configSources[ 0 ].name), filename + '.json') 309 return join(dirname(configSources[0].name), filename + '.json')
305} 310}
306 311
307function buildVideosRedundancy (objs: any[]): VideosRedundancy[] { 312function buildVideosRedundancy (objs: any[]): VideosRedundancyStrategy[] {
308 if (!objs) return [] 313 if (!objs) return []
309 314
310 if (!Array.isArray(objs)) return objs 315 if (!Array.isArray(objs)) return objs
@@ -330,7 +335,7 @@ export function reloadConfig () {
330 335
331 function purge () { 336 function purge () {
332 for (const fileName in require.cache) { 337 for (const fileName in require.cache) {
333 if (-1 === fileName.indexOf(directory())) { 338 if (fileName.indexOf(directory()) === -1) {
334 continue 339 continue
335 } 340 }
336 341
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index 13e32b6d2..3da06402c 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -4,7 +4,7 @@ import { ActivityPubActorType } from '../../shared/models/activitypub'
4import { FollowState } from '../../shared/models/actors' 4import { FollowState } from '../../shared/models/actors'
5import { VideoAbuseState, VideoImportState, VideoPrivacy, VideoTranscodingFPS } from '../../shared/models/videos' 5import { VideoAbuseState, VideoImportState, VideoPrivacy, VideoTranscodingFPS } from '../../shared/models/videos'
6// Do not use barrels, remain constants as independent as possible 6// Do not use barrels, remain constants as independent as possible
7import { isTestInstance, sanitizeHost, sanitizeUrl, root, parseDurationToMs } from '../helpers/core-utils' 7import { isTestInstance, sanitizeHost, sanitizeUrl, root } from '../helpers/core-utils'
8import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' 8import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type'
9import { invert } from 'lodash' 9import { invert } from 'lodash'
10import { CronRepeatOptions, EveryRepeatOptions } from 'bull' 10import { CronRepeatOptions, EveryRepeatOptions } from 'bull'
@@ -14,7 +14,7 @@ import { CONFIG, registerConfigChangedHandler } from './config'
14 14
15// --------------------------------------------------------------------------- 15// ---------------------------------------------------------------------------
16 16
17const LAST_MIGRATION_VERSION = 470 17const LAST_MIGRATION_VERSION = 480
18 18
19// --------------------------------------------------------------------------- 19// ---------------------------------------------------------------------------
20 20
@@ -73,7 +73,9 @@ const SORTABLE_COLUMNS = {
73 73
74 PLUGINS: [ 'name', 'createdAt', 'updatedAt' ], 74 PLUGINS: [ 'name', 'createdAt', 'updatedAt' ],
75 75
76 AVAILABLE_PLUGINS: [ 'npmName', 'popularity' ] 76 AVAILABLE_PLUGINS: [ 'npmName', 'popularity' ],
77
78 VIDEO_REDUNDANCIES: [ 'name' ]
77} 79}
78 80
79const OAUTH_LIFETIME = { 81const OAUTH_LIFETIME = {
@@ -117,45 +119,44 @@ const REMOTE_SCHEME = {
117 WS: 'wss' 119 WS: 'wss'
118} 120}
119 121
120// TODO: remove 'video-file' 122const JOB_ATTEMPTS: { [id in JobType]: number } = {
121const JOB_ATTEMPTS: { [id in (JobType | 'video-file')]: number } = {
122 'activitypub-http-broadcast': 5, 123 'activitypub-http-broadcast': 5,
123 'activitypub-http-unicast': 5, 124 'activitypub-http-unicast': 5,
124 'activitypub-http-fetcher': 5, 125 'activitypub-http-fetcher': 5,
125 'activitypub-follow': 5, 126 'activitypub-follow': 5,
126 'video-file-import': 1, 127 'video-file-import': 1,
127 'video-transcoding': 1, 128 'video-transcoding': 1,
128 'video-file': 1,
129 'video-import': 1, 129 'video-import': 1,
130 'email': 5, 130 'email': 5,
131 'videos-views': 1, 131 'videos-views': 1,
132 'activitypub-refresher': 1 132 'activitypub-refresher': 1,
133 'video-redundancy': 1
133} 134}
134const JOB_CONCURRENCY: { [id in (JobType | 'video-file')]: number } = { 135const JOB_CONCURRENCY: { [id in JobType]: number } = {
135 'activitypub-http-broadcast': 1, 136 'activitypub-http-broadcast': 1,
136 'activitypub-http-unicast': 5, 137 'activitypub-http-unicast': 5,
137 'activitypub-http-fetcher': 1, 138 'activitypub-http-fetcher': 1,
138 'activitypub-follow': 1, 139 'activitypub-follow': 1,
139 'video-file-import': 1, 140 'video-file-import': 1,
140 'video-transcoding': 1, 141 'video-transcoding': 1,
141 'video-file': 1,
142 'video-import': 1, 142 'video-import': 1,
143 'email': 5, 143 'email': 5,
144 'videos-views': 1, 144 'videos-views': 1,
145 'activitypub-refresher': 1 145 'activitypub-refresher': 1,
146 'video-redundancy': 1
146} 147}
147const JOB_TTL: { [id in (JobType | 'video-file')]: number } = { 148const JOB_TTL: { [id in JobType]: number } = {
148 'activitypub-http-broadcast': 60000 * 10, // 10 minutes 149 'activitypub-http-broadcast': 60000 * 10, // 10 minutes
149 'activitypub-http-unicast': 60000 * 10, // 10 minutes 150 'activitypub-http-unicast': 60000 * 10, // 10 minutes
150 'activitypub-http-fetcher': 60000 * 10, // 10 minutes 151 'activitypub-http-fetcher': 60000 * 10, // 10 minutes
151 'activitypub-follow': 60000 * 10, // 10 minutes 152 'activitypub-follow': 60000 * 10, // 10 minutes
152 'video-file-import': 1000 * 3600, // 1 hour 153 'video-file-import': 1000 * 3600, // 1 hour
153 'video-transcoding': 1000 * 3600 * 48, // 2 days, transcoding could be long 154 'video-transcoding': 1000 * 3600 * 48, // 2 days, transcoding could be long
154 'video-file': 1000 * 3600 * 48, // 2 days, transcoding could be long
155 'video-import': 1000 * 3600 * 2, // hours 155 'video-import': 1000 * 3600 * 2, // hours
156 'email': 60000 * 10, // 10 minutes 156 'email': 60000 * 10, // 10 minutes
157 'videos-views': undefined, // Unlimited 157 'videos-views': undefined, // Unlimited
158 'activitypub-refresher': 60000 * 10 // 10 minutes 158 'activitypub-refresher': 60000 * 10, // 10 minutes
159 'video-redundancy': 1000 * 3600 * 3 // 3 hours
159} 160}
160const REPEAT_JOBS: { [ id: string ]: EveryRepeatOptions | CronRepeatOptions } = { 161const REPEAT_JOBS: { [ id: string ]: EveryRepeatOptions | CronRepeatOptions } = {
161 'videos-views': { 162 'videos-views': {
@@ -309,6 +310,8 @@ let CONTACT_FORM_LIFETIME = 60000 * 60 // 1 hour
309 310
310const VIDEO_TRANSCODING_FPS: VideoTranscodingFPS = { 311const VIDEO_TRANSCODING_FPS: VideoTranscodingFPS = {
311 MIN: 10, 312 MIN: 10,
313 STANDARD: [ 24, 25, 30 ],
314 HD_STANDARD: [ 50, 60 ],
312 AVERAGE: 30, 315 AVERAGE: 30,
313 MAX: 60, 316 MAX: 60,
314 KEEP_ORIGIN_FPS_RESOLUTION_MIN: 720 // We keep the original FPS on high resolutions (720 minimum) 317 KEEP_ORIGIN_FPS_RESOLUTION_MIN: 720 // We keep the original FPS on high resolutions (720 minimum)
@@ -358,42 +361,42 @@ const VIDEO_LICENCES = {
358 7: 'Public Domain Dedication' 361 7: 'Public Domain Dedication'
359} 362}
360 363
361let VIDEO_LANGUAGES: { [id: string]: string } = {} 364const VIDEO_LANGUAGES: { [id: string]: string } = {}
362 365
363const VIDEO_PRIVACIES = { 366const VIDEO_PRIVACIES = {
364 [ VideoPrivacy.PUBLIC ]: 'Public', 367 [VideoPrivacy.PUBLIC]: 'Public',
365 [ VideoPrivacy.UNLISTED ]: 'Unlisted', 368 [VideoPrivacy.UNLISTED]: 'Unlisted',
366 [ VideoPrivacy.PRIVATE ]: 'Private', 369 [VideoPrivacy.PRIVATE]: 'Private',
367 [ VideoPrivacy.INTERNAL ]: 'Internal' 370 [VideoPrivacy.INTERNAL]: 'Internal'
368} 371}
369 372
370const VIDEO_STATES = { 373const VIDEO_STATES = {
371 [ VideoState.PUBLISHED ]: 'Published', 374 [VideoState.PUBLISHED]: 'Published',
372 [ VideoState.TO_TRANSCODE ]: 'To transcode', 375 [VideoState.TO_TRANSCODE]: 'To transcode',
373 [ VideoState.TO_IMPORT ]: 'To import' 376 [VideoState.TO_IMPORT]: 'To import'
374} 377}
375 378
376const VIDEO_IMPORT_STATES = { 379const VIDEO_IMPORT_STATES = {
377 [ VideoImportState.FAILED ]: 'Failed', 380 [VideoImportState.FAILED]: 'Failed',
378 [ VideoImportState.PENDING ]: 'Pending', 381 [VideoImportState.PENDING]: 'Pending',
379 [ VideoImportState.SUCCESS ]: 'Success' 382 [VideoImportState.SUCCESS]: 'Success'
380} 383}
381 384
382const VIDEO_ABUSE_STATES = { 385const VIDEO_ABUSE_STATES = {
383 [ VideoAbuseState.PENDING ]: 'Pending', 386 [VideoAbuseState.PENDING]: 'Pending',
384 [ VideoAbuseState.REJECTED ]: 'Rejected', 387 [VideoAbuseState.REJECTED]: 'Rejected',
385 [ VideoAbuseState.ACCEPTED ]: 'Accepted' 388 [VideoAbuseState.ACCEPTED]: 'Accepted'
386} 389}
387 390
388const VIDEO_PLAYLIST_PRIVACIES = { 391const VIDEO_PLAYLIST_PRIVACIES = {
389 [ VideoPlaylistPrivacy.PUBLIC ]: 'Public', 392 [VideoPlaylistPrivacy.PUBLIC]: 'Public',
390 [ VideoPlaylistPrivacy.UNLISTED ]: 'Unlisted', 393 [VideoPlaylistPrivacy.UNLISTED]: 'Unlisted',
391 [ VideoPlaylistPrivacy.PRIVATE ]: 'Private' 394 [VideoPlaylistPrivacy.PRIVATE]: 'Private'
392} 395}
393 396
394const VIDEO_PLAYLIST_TYPES = { 397const VIDEO_PLAYLIST_TYPES = {
395 [ VideoPlaylistType.REGULAR ]: 'Regular', 398 [VideoPlaylistType.REGULAR]: 'Regular',
396 [ VideoPlaylistType.WATCH_LATER ]: 'Watch later' 399 [VideoPlaylistType.WATCH_LATER]: 'Watch later'
397} 400}
398 401
399const MIMETYPES = { 402const MIMETYPES = {
@@ -419,7 +422,8 @@ const MIMETYPES = {
419 'image/png': '.png', 422 'image/png': '.png',
420 'image/jpg': '.jpg', 423 'image/jpg': '.jpg',
421 'image/jpeg': '.jpg' 424 'image/jpeg': '.jpg'
422 } 425 },
426 EXT_MIMETYPE: null as { [ id: string ]: string }
423 }, 427 },
424 VIDEO_CAPTIONS: { 428 VIDEO_CAPTIONS: {
425 MIMETYPE_EXT: { 429 MIMETYPE_EXT: {
@@ -435,6 +439,7 @@ const MIMETYPES = {
435 } 439 }
436} 440}
437MIMETYPES.AUDIO.EXT_MIMETYPE = invert(MIMETYPES.AUDIO.MIMETYPE_EXT) 441MIMETYPES.AUDIO.EXT_MIMETYPE = invert(MIMETYPES.AUDIO.MIMETYPE_EXT)
442MIMETYPES.IMAGE.EXT_MIMETYPE = invert(MIMETYPES.IMAGE.MIMETYPE_EXT)
438 443
439// --------------------------------------------------------------------------- 444// ---------------------------------------------------------------------------
440 445
@@ -497,6 +502,7 @@ let PRIVATE_RSA_KEY_SIZE = 2048
497const BCRYPT_SALT_SIZE = 10 502const BCRYPT_SALT_SIZE = 10
498 503
499const USER_PASSWORD_RESET_LIFETIME = 60000 * 60 // 60 minutes 504const USER_PASSWORD_RESET_LIFETIME = 60000 * 60 // 60 minutes
505const USER_PASSWORD_CREATE_LIFETIME = 60000 * 60 * 24 * 7 // 7 days
500 506
501const USER_EMAIL_VERIFY_LIFETIME = 60000 * 60 // 60 minutes 507const USER_EMAIL_VERIFY_LIFETIME = 60000 * 60 // 60 minutes
502 508
@@ -533,7 +539,7 @@ const LAZY_STATIC_PATHS = {
533} 539}
534 540
535// Cache control 541// Cache control
536let STATIC_MAX_AGE = { 542const STATIC_MAX_AGE = {
537 SERVER: '2h', 543 SERVER: '2h',
538 CLIENT: '30d' 544 CLIENT: '30d'
539} 545}
@@ -541,11 +547,13 @@ let STATIC_MAX_AGE = {
541// Videos thumbnail size 547// Videos thumbnail size
542const THUMBNAILS_SIZE = { 548const THUMBNAILS_SIZE = {
543 width: 223, 549 width: 223,
544 height: 122 550 height: 122,
551 minWidth: 150
545} 552}
546const PREVIEWS_SIZE = { 553const PREVIEWS_SIZE = {
547 width: 850, 554 width: 850,
548 height: 480 555 height: 480,
556 minWidth: 400
549} 557}
550const AVATARS_SIZE = { 558const AVATARS_SIZE = {
551 width: 120, 559 width: 120,
@@ -669,14 +677,14 @@ if (isTestInstance() === true) {
669 SCHEDULER_INTERVALS_MS.removeOldViews = 5000 677 SCHEDULER_INTERVALS_MS.removeOldViews = 5000
670 SCHEDULER_INTERVALS_MS.updateVideos = 5000 678 SCHEDULER_INTERVALS_MS.updateVideos = 5000
671 SCHEDULER_INTERVALS_MS.autoFollowIndexInstances = 5000 679 SCHEDULER_INTERVALS_MS.autoFollowIndexInstances = 5000
672 REPEAT_JOBS[ 'videos-views' ] = { every: 5000 } 680 REPEAT_JOBS['videos-views'] = { every: 5000 }
673 681
674 REDUNDANCY.VIDEOS.RANDOMIZED_FACTOR = 1 682 REDUNDANCY.VIDEOS.RANDOMIZED_FACTOR = 1
675 683
676 VIDEO_VIEW_LIFETIME = 1000 // 1 second 684 VIDEO_VIEW_LIFETIME = 1000 // 1 second
677 CONTACT_FORM_LIFETIME = 1000 // 1 second 685 CONTACT_FORM_LIFETIME = 1000 // 1 second
678 686
679 JOB_ATTEMPTS[ 'email' ] = 1 687 JOB_ATTEMPTS['email'] = 1
680 688
681 FILES_CACHE.VIDEO_CAPTIONS.MAX_AGE = 3000 689 FILES_CACHE.VIDEO_CAPTIONS.MAX_AGE = 3000
682 MEMOIZE_TTL.OVERVIEWS_SAMPLE = 1 690 MEMOIZE_TTL.OVERVIEWS_SAMPLE = 1
@@ -757,6 +765,7 @@ export {
757 LRU_CACHE, 765 LRU_CACHE,
758 JOB_REQUEST_TIMEOUT, 766 JOB_REQUEST_TIMEOUT,
759 USER_PASSWORD_RESET_LIFETIME, 767 USER_PASSWORD_RESET_LIFETIME,
768 USER_PASSWORD_CREATE_LIFETIME,
760 MEMOIZE_TTL, 769 MEMOIZE_TTL,
761 USER_EMAIL_VERIFY_LIFETIME, 770 USER_EMAIL_VERIFY_LIFETIME,
762 OVERVIEWS, 771 OVERVIEWS,
@@ -837,42 +846,42 @@ function loadLanguages () {
837function buildLanguages () { 846function buildLanguages () {
838 const iso639 = require('iso-639-3') 847 const iso639 = require('iso-639-3')
839 848
840 const languages: { [ id: string ]: string } = {} 849 const languages: { [id: string]: string } = {}
841 850
842 const additionalLanguages = { 851 const additionalLanguages = {
843 'sgn': true, // Sign languages (macro language) 852 sgn: true, // Sign languages (macro language)
844 'ase': true, // American sign language 853 ase: true, // American sign language
845 'sdl': true, // Arabian sign language 854 sdl: true, // Arabian sign language
846 'bfi': true, // British sign language 855 bfi: true, // British sign language
847 'bzs': true, // Brazilian sign language 856 bzs: true, // Brazilian sign language
848 'csl': true, // Chinese sign language 857 csl: true, // Chinese sign language
849 'cse': true, // Czech sign language 858 cse: true, // Czech sign language
850 'dsl': true, // Danish sign language 859 dsl: true, // Danish sign language
851 'fsl': true, // French sign language 860 fsl: true, // French sign language
852 'gsg': true, // German sign language 861 gsg: true, // German sign language
853 'pks': true, // Pakistan sign language 862 pks: true, // Pakistan sign language
854 'jsl': true, // Japanese sign language 863 jsl: true, // Japanese sign language
855 'sfs': true, // South African sign language 864 sfs: true, // South African sign language
856 'swl': true, // Swedish sign language 865 swl: true, // Swedish sign language
857 'rsl': true, // Russian sign language: true 866 rsl: true, // Russian sign language: true
858 867
859 'epo': true, // Esperanto 868 epo: true, // Esperanto
860 'tlh': true, // Klingon 869 tlh: true, // Klingon
861 'jbo': true, // Lojban 870 jbo: true, // Lojban
862 'avk': true // Kotava 871 avk: true // Kotava
863 } 872 }
864 873
865 // Only add ISO639-1 languages and some sign languages (ISO639-3) 874 // Only add ISO639-1 languages and some sign languages (ISO639-3)
866 iso639 875 iso639
867 .filter(l => { 876 .filter(l => {
868 return (l.iso6391 !== null && l.type === 'living') || 877 return (l.iso6391 !== undefined && l.type === 'living') ||
869 additionalLanguages[ l.iso6393 ] === true 878 additionalLanguages[l.iso6393] === true
870 }) 879 })
871 .forEach(l => languages[ l.iso6391 || l.iso6393 ] = l.name) 880 .forEach(l => { languages[l.iso6391 || l.iso6393] = l.name })
872 881
873 // Override Occitan label 882 // Override Occitan label
874 languages[ 'oc' ] = 'Occitan' 883 languages['oc'] = 'Occitan'
875 languages[ 'el' ] = 'Greek' 884 languages['el'] = 'Greek'
876 885
877 return languages 886 return languages
878} 887}
diff --git a/server/initializers/database.ts b/server/initializers/database.ts
index 9ec146ab1..eedaf3c4e 100644
--- a/server/initializers/database.ts
+++ b/server/initializers/database.ts
@@ -119,8 +119,6 @@ async function initDatabaseModels (silent: boolean) {
119 await createFunctions() 119 await createFunctions()
120 120
121 if (!silent) logger.info('Database %s is ready.', dbname) 121 if (!silent) logger.info('Database %s is ready.', dbname)
122
123 return
124} 122}
125 123
126// --------------------------------------------------------------------------- 124// ---------------------------------------------------------------------------
diff --git a/server/initializers/migrations/0005-email-pod.ts b/server/initializers/migrations/0005-email-pod.ts
index c34a12255..417c33b1f 100644
--- a/server/initializers/migrations/0005-email-pod.ts
+++ b/server/initializers/migrations/0005-email-pod.ts
@@ -3,8 +3,8 @@ import * as Promise from 'bluebird'
3import { Migration } from '../../models/migrations' 3import { Migration } from '../../models/migrations'
4 4
5function up (utils: { 5function up (utils: {
6 transaction: Sequelize.Transaction, 6 transaction: Sequelize.Transaction
7 queryInterface: Sequelize.QueryInterface, 7 queryInterface: Sequelize.QueryInterface
8 sequelize: Sequelize.Sequelize 8 sequelize: Sequelize.Sequelize
9}): Promise<void> { 9}): Promise<void> {
10 const q = utils.queryInterface 10 const q = utils.queryInterface
diff --git a/server/initializers/migrations/0010-email-user.ts b/server/initializers/migrations/0010-email-user.ts
index 37a7b0bb3..f7d01f6d6 100644
--- a/server/initializers/migrations/0010-email-user.ts
+++ b/server/initializers/migrations/0010-email-user.ts
@@ -3,8 +3,8 @@ import * as Promise from 'bluebird'
3import { Migration } from '../../models/migrations' 3import { Migration } from '../../models/migrations'
4 4
5function up (utils: { 5function up (utils: {
6 transaction: Sequelize.Transaction, 6 transaction: Sequelize.Transaction
7 queryInterface: Sequelize.QueryInterface, 7 queryInterface: Sequelize.QueryInterface
8 sequelize: Sequelize.Sequelize 8 sequelize: Sequelize.Sequelize
9}): Promise<void> { 9}): Promise<void> {
10 const q = utils.queryInterface 10 const q = utils.queryInterface
diff --git a/server/initializers/migrations/0015-video-views.ts b/server/initializers/migrations/0015-video-views.ts
index 25164ff4d..47dd4069b 100644
--- a/server/initializers/migrations/0015-video-views.ts
+++ b/server/initializers/migrations/0015-video-views.ts
@@ -2,8 +2,8 @@ import * as Sequelize from 'sequelize'
2import * as Promise from 'bluebird' 2import * as Promise from 'bluebird'
3 3
4function up (utils: { 4function up (utils: {
5 transaction: Sequelize.Transaction, 5 transaction: Sequelize.Transaction
6 queryInterface: Sequelize.QueryInterface, 6 queryInterface: Sequelize.QueryInterface
7 sequelize: Sequelize.Sequelize 7 sequelize: Sequelize.Sequelize
8}): Promise<void> { 8}): Promise<void> {
9 const q = utils.queryInterface 9 const q = utils.queryInterface
diff --git a/server/initializers/migrations/0020-video-likes.ts b/server/initializers/migrations/0020-video-likes.ts
index 945be5a98..44333f3b0 100644
--- a/server/initializers/migrations/0020-video-likes.ts
+++ b/server/initializers/migrations/0020-video-likes.ts
@@ -2,8 +2,8 @@ import * as Sequelize from 'sequelize'
2import * as Promise from 'bluebird' 2import * as Promise from 'bluebird'
3 3
4function up (utils: { 4function up (utils: {
5 transaction: Sequelize.Transaction, 5 transaction: Sequelize.Transaction
6 queryInterface: Sequelize.QueryInterface, 6 queryInterface: Sequelize.QueryInterface
7 sequelize: Sequelize.Sequelize 7 sequelize: Sequelize.Sequelize
8}): Promise<void> { 8}): Promise<void> {
9 const q = utils.queryInterface 9 const q = utils.queryInterface
diff --git a/server/initializers/migrations/0025-video-dislikes.ts b/server/initializers/migrations/0025-video-dislikes.ts
index 27144c437..2aa22e2d7 100644
--- a/server/initializers/migrations/0025-video-dislikes.ts
+++ b/server/initializers/migrations/0025-video-dislikes.ts
@@ -2,8 +2,8 @@ import * as Sequelize from 'sequelize'
2import * as Promise from 'bluebird' 2import * as Promise from 'bluebird'
3 3
4function up (utils: { 4function up (utils: {
5 transaction: Sequelize.Transaction, 5 transaction: Sequelize.Transaction
6 queryInterface: Sequelize.QueryInterface, 6 queryInterface: Sequelize.QueryInterface
7 sequelize: Sequelize.Sequelize 7 sequelize: Sequelize.Sequelize
8}): Promise<void> { 8}): Promise<void> {
9 const q = utils.queryInterface 9 const q = utils.queryInterface
diff --git a/server/initializers/migrations/0030-video-category.ts b/server/initializers/migrations/0030-video-category.ts
index f784f820d..00cd2d8cf 100644
--- a/server/initializers/migrations/0030-video-category.ts
+++ b/server/initializers/migrations/0030-video-category.ts
@@ -3,8 +3,8 @@ import * as Promise from 'bluebird'
3import { Migration } from '../../models/migrations' 3import { Migration } from '../../models/migrations'
4 4
5function up (utils: { 5function up (utils: {
6 transaction: Sequelize.Transaction, 6 transaction: Sequelize.Transaction
7 queryInterface: Sequelize.QueryInterface, 7 queryInterface: Sequelize.QueryInterface
8 sequelize: Sequelize.Sequelize 8 sequelize: Sequelize.Sequelize
9}): Promise<void> { 9}): Promise<void> {
10 const q = utils.queryInterface 10 const q = utils.queryInterface
diff --git a/server/initializers/migrations/0035-video-licence.ts b/server/initializers/migrations/0035-video-licence.ts
index 3d0b0bac9..61d666c5e 100644
--- a/server/initializers/migrations/0035-video-licence.ts
+++ b/server/initializers/migrations/0035-video-licence.ts
@@ -3,8 +3,8 @@ import * as Promise from 'bluebird'
3import { Migration } from '../../models/migrations' 3import { Migration } from '../../models/migrations'
4 4
5function up (utils: { 5function up (utils: {
6 transaction: Sequelize.Transaction, 6 transaction: Sequelize.Transaction
7 queryInterface: Sequelize.QueryInterface, 7 queryInterface: Sequelize.QueryInterface
8 sequelize: Sequelize.Sequelize 8 sequelize: Sequelize.Sequelize
9}): Promise<void> { 9}): Promise<void> {
10 const q = utils.queryInterface 10 const q = utils.queryInterface
diff --git a/server/initializers/migrations/0040-video-nsfw.ts b/server/initializers/migrations/0040-video-nsfw.ts
index f7f70d3c4..44aec8a6c 100644
--- a/server/initializers/migrations/0040-video-nsfw.ts
+++ b/server/initializers/migrations/0040-video-nsfw.ts
@@ -3,8 +3,8 @@ import * as Promise from 'bluebird'
3import { Migration } from '../../models/migrations' 3import { Migration } from '../../models/migrations'
4 4
5function up (utils: { 5function up (utils: {
6 transaction: Sequelize.Transaction, 6 transaction: Sequelize.Transaction
7 queryInterface: Sequelize.QueryInterface, 7 queryInterface: Sequelize.QueryInterface
8 sequelize: Sequelize.Sequelize 8 sequelize: Sequelize.Sequelize
9}): Promise<void> { 9}): Promise<void> {
10 const q = utils.queryInterface 10 const q = utils.queryInterface
diff --git a/server/initializers/migrations/0045-user-display-nsfw.ts b/server/initializers/migrations/0045-user-display-nsfw.ts
index aef420f0e..07795bd75 100644
--- a/server/initializers/migrations/0045-user-display-nsfw.ts
+++ b/server/initializers/migrations/0045-user-display-nsfw.ts
@@ -2,8 +2,8 @@ import * as Sequelize from 'sequelize'
2import * as Promise from 'bluebird' 2import * as Promise from 'bluebird'
3 3
4function up (utils: { 4function up (utils: {
5 transaction: Sequelize.Transaction, 5 transaction: Sequelize.Transaction
6 queryInterface: Sequelize.QueryInterface, 6 queryInterface: Sequelize.QueryInterface
7 sequelize: Sequelize.Sequelize 7 sequelize: Sequelize.Sequelize
8}): Promise<void> { 8}): Promise<void> {
9 const q = utils.queryInterface 9 const q = utils.queryInterface
diff --git a/server/initializers/migrations/0050-video-language.ts b/server/initializers/migrations/0050-video-language.ts
index 796fa5f95..6f90abb44 100644
--- a/server/initializers/migrations/0050-video-language.ts
+++ b/server/initializers/migrations/0050-video-language.ts
@@ -2,8 +2,8 @@ import * as Sequelize from 'sequelize'
2import * as Promise from 'bluebird' 2import * as Promise from 'bluebird'
3 3
4function up (utils: { 4function up (utils: {
5 transaction: Sequelize.Transaction, 5 transaction: Sequelize.Transaction
6 queryInterface: Sequelize.QueryInterface, 6 queryInterface: Sequelize.QueryInterface
7 sequelize: Sequelize.Sequelize 7 sequelize: Sequelize.Sequelize
8}): Promise<void> { 8}): Promise<void> {
9 const q = utils.queryInterface 9 const q = utils.queryInterface
diff --git a/server/initializers/migrations/0055-video-uuid.ts b/server/initializers/migrations/0055-video-uuid.ts
index e0f904080..8a58aebb8 100644
--- a/server/initializers/migrations/0055-video-uuid.ts
+++ b/server/initializers/migrations/0055-video-uuid.ts
@@ -3,8 +3,8 @@ import * as Promise from 'bluebird'
3import { Migration } from '../../models/migrations' 3import { Migration } from '../../models/migrations'
4 4
5function up (utils: { 5function up (utils: {
6 transaction: Sequelize.Transaction, 6 transaction: Sequelize.Transaction
7 queryInterface: Sequelize.QueryInterface, 7 queryInterface: Sequelize.QueryInterface
8 sequelize: Sequelize.Sequelize 8 sequelize: Sequelize.Sequelize
9}): Promise<void> { 9}): Promise<void> {
10 const q = utils.queryInterface 10 const q = utils.queryInterface
diff --git a/server/initializers/migrations/0060-video-file.ts b/server/initializers/migrations/0060-video-file.ts
index c362cf71a..00647e60e 100644
--- a/server/initializers/migrations/0060-video-file.ts
+++ b/server/initializers/migrations/0060-video-file.ts
@@ -2,9 +2,9 @@ import * as Sequelize from 'sequelize'
2import * as Promise from 'bluebird' 2import * as Promise from 'bluebird'
3 3
4function up (utils: { 4function up (utils: {
5 transaction: Sequelize.Transaction, 5 transaction: Sequelize.Transaction
6 queryInterface: Sequelize.QueryInterface, 6 queryInterface: Sequelize.QueryInterface
7 sequelize: Sequelize.Sequelize, 7 sequelize: Sequelize.Sequelize
8 db: any 8 db: any
9}): Promise<void> { 9}): Promise<void> {
10 const q = utils.queryInterface 10 const q = utils.queryInterface
diff --git a/server/initializers/migrations/0065-video-file-size.ts b/server/initializers/migrations/0065-video-file-size.ts
index e9ce77e50..0bdc675c2 100644
--- a/server/initializers/migrations/0065-video-file-size.ts
+++ b/server/initializers/migrations/0065-video-file-size.ts
@@ -5,9 +5,9 @@ import { VideoModel } from '../../models/video/video'
5import { getVideoFilePath } from '@server/lib/video-paths' 5import { getVideoFilePath } from '@server/lib/video-paths'
6 6
7function up (utils: { 7function up (utils: {
8 transaction: Sequelize.Transaction, 8 transaction: Sequelize.Transaction
9 queryInterface: Sequelize.QueryInterface, 9 queryInterface: Sequelize.QueryInterface
10 sequelize: Sequelize.Sequelize, 10 sequelize: Sequelize.Sequelize
11 db: any 11 db: any
12}): Promise<void> { 12}): Promise<void> {
13 return utils.db.Video.listOwnedAndPopulateAuthorAndTags() 13 return utils.db.Video.listOwnedAndPopulateAuthorAndTags()
diff --git a/server/initializers/migrations/0070-user-video-quota.ts b/server/initializers/migrations/0070-user-video-quota.ts
index 37683432f..1d073f244 100644
--- a/server/initializers/migrations/0070-user-video-quota.ts
+++ b/server/initializers/migrations/0070-user-video-quota.ts
@@ -3,9 +3,9 @@ import * as Promise from 'bluebird'
3import { Migration } from '../../models/migrations' 3import { Migration } from '../../models/migrations'
4 4
5function up (utils: { 5function up (utils: {
6 transaction: Sequelize.Transaction, 6 transaction: Sequelize.Transaction
7 queryInterface: Sequelize.QueryInterface, 7 queryInterface: Sequelize.QueryInterface
8 sequelize: Sequelize.Sequelize, 8 sequelize: Sequelize.Sequelize
9 db: any 9 db: any
10}): Promise<void> { 10}): Promise<void> {
11 const q = utils.queryInterface 11 const q = utils.queryInterface
diff --git a/server/initializers/migrations/0075-video-resolutions.ts b/server/initializers/migrations/0075-video-resolutions.ts
index e4f26cb77..f56c1b2c3 100644
--- a/server/initializers/migrations/0075-video-resolutions.ts
+++ b/server/initializers/migrations/0075-video-resolutions.ts
@@ -5,9 +5,9 @@ import { getVideoFileResolution } from '../../helpers/ffmpeg-utils'
5import { readdir, rename } from 'fs-extra' 5import { readdir, rename } from 'fs-extra'
6 6
7function up (utils: { 7function up (utils: {
8 transaction: Sequelize.Transaction, 8 transaction: Sequelize.Transaction
9 queryInterface: Sequelize.QueryInterface, 9 queryInterface: Sequelize.QueryInterface
10 sequelize: Sequelize.Sequelize, 10 sequelize: Sequelize.Sequelize
11 db: any 11 db: any
12}): Promise<void> { 12}): Promise<void> {
13 const torrentDir = CONFIG.STORAGE.TORRENTS_DIR 13 const torrentDir = CONFIG.STORAGE.TORRENTS_DIR
diff --git a/server/initializers/migrations/0080-video-channels.ts b/server/initializers/migrations/0080-video-channels.ts
index 5512bdcf1..b8e9bd6d0 100644
--- a/server/initializers/migrations/0080-video-channels.ts
+++ b/server/initializers/migrations/0080-video-channels.ts
@@ -2,9 +2,9 @@ import * as Sequelize from 'sequelize'
2import * as uuidv4 from 'uuid/v4' 2import * as uuidv4 from 'uuid/v4'
3 3
4async function up (utils: { 4async function up (utils: {
5 transaction: Sequelize.Transaction, 5 transaction: Sequelize.Transaction
6 queryInterface: Sequelize.QueryInterface, 6 queryInterface: Sequelize.QueryInterface
7 sequelize: Sequelize.Sequelize, 7 sequelize: Sequelize.Sequelize
8 db: any 8 db: any
9}): Promise<void> { 9}): Promise<void> {
10 const q = utils.queryInterface 10 const q = utils.queryInterface
diff --git a/server/initializers/migrations/0085-user-role.ts b/server/initializers/migrations/0085-user-role.ts
index de75faec2..ec7428fd5 100644
--- a/server/initializers/migrations/0085-user-role.ts
+++ b/server/initializers/migrations/0085-user-role.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 const q = utils.queryInterface 9 const q = utils.queryInterface
diff --git a/server/initializers/migrations/0090-videos-description.ts b/server/initializers/migrations/0090-videos-description.ts
index 6f98dcade..32e518d75 100644
--- a/server/initializers/migrations/0090-videos-description.ts
+++ b/server/initializers/migrations/0090-videos-description.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 const q = utils.queryInterface 9 const q = utils.queryInterface
diff --git a/server/initializers/migrations/0095-videos-privacy.ts b/server/initializers/migrations/0095-videos-privacy.ts
index 4c2bf91d0..c732d6f6a 100644
--- a/server/initializers/migrations/0095-videos-privacy.ts
+++ b/server/initializers/migrations/0095-videos-privacy.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 const q = utils.queryInterface 9 const q = utils.queryInterface
diff --git a/server/initializers/migrations/0100-activitypub.ts b/server/initializers/migrations/0100-activitypub.ts
index 96d44a7ce..05fd37406 100644
--- a/server/initializers/migrations/0100-activitypub.ts
+++ b/server/initializers/migrations/0100-activitypub.ts
@@ -7,9 +7,9 @@ import { ApplicationModel } from '../../models/application/application'
7import { SERVER_ACTOR_NAME } from '../constants' 7import { SERVER_ACTOR_NAME } from '../constants'
8 8
9async function up (utils: { 9async function up (utils: {
10 transaction: Sequelize.Transaction, 10 transaction: Sequelize.Transaction
11 queryInterface: Sequelize.QueryInterface, 11 queryInterface: Sequelize.QueryInterface
12 sequelize: Sequelize.Sequelize, 12 sequelize: Sequelize.Sequelize
13 db: any 13 db: any
14}): Promise<void> { 14}): Promise<void> {
15 const q = utils.queryInterface 15 const q = utils.queryInterface
diff --git a/server/initializers/migrations/0105-server-mail.ts b/server/initializers/migrations/0105-server-mail.ts
index 4b9600e91..5ee37c418 100644
--- a/server/initializers/migrations/0105-server-mail.ts
+++ b/server/initializers/migrations/0105-server-mail.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 await utils.queryInterface.removeColumn('Servers', 'email') 9 await utils.queryInterface.removeColumn('Servers', 'email')
diff --git a/server/initializers/migrations/0110-server-key.ts b/server/initializers/migrations/0110-server-key.ts
index 5ff6daf69..354cd7e76 100644
--- a/server/initializers/migrations/0110-server-key.ts
+++ b/server/initializers/migrations/0110-server-key.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 await utils.queryInterface.removeColumn('Servers', 'publicKey') 9 await utils.queryInterface.removeColumn('Servers', 'publicKey')
diff --git a/server/initializers/migrations/0115-account-avatar.ts b/server/initializers/migrations/0115-account-avatar.ts
index b318e8163..604b6394a 100644
--- a/server/initializers/migrations/0115-account-avatar.ts
+++ b/server/initializers/migrations/0115-account-avatar.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 await utils.db.Avatar.sync() 9 await utils.db.Avatar.sync()
diff --git a/server/initializers/migrations/0120-video-null.ts b/server/initializers/migrations/0120-video-null.ts
index 6d253f04f..1b407b270 100644
--- a/server/initializers/migrations/0120-video-null.ts
+++ b/server/initializers/migrations/0120-video-null.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 9
diff --git a/server/initializers/migrations/0125-table-lowercase.ts b/server/initializers/migrations/0125-table-lowercase.ts
index 78041ccb0..f75a56791 100644
--- a/server/initializers/migrations/0125-table-lowercase.ts
+++ b/server/initializers/migrations/0125-table-lowercase.ts
@@ -1,8 +1,8 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize 6 sequelize: Sequelize.Sequelize
7}): Promise<void> { 7}): Promise<void> {
8 await utils.queryInterface.renameTable('Applications', 'application') 8 await utils.queryInterface.renameTable('Applications', 'application')
diff --git a/server/initializers/migrations/0130-user-autoplay-video.ts b/server/initializers/migrations/0130-user-autoplay-video.ts
index 9f6878e39..d57934588 100644
--- a/server/initializers/migrations/0130-user-autoplay-video.ts
+++ b/server/initializers/migrations/0130-user-autoplay-video.ts
@@ -2,8 +2,8 @@ import * as Sequelize from 'sequelize'
2import * as Promise from 'bluebird' 2import * as Promise from 'bluebird'
3 3
4function up (utils: { 4function up (utils: {
5 transaction: Sequelize.Transaction, 5 transaction: Sequelize.Transaction
6 queryInterface: Sequelize.QueryInterface, 6 queryInterface: Sequelize.QueryInterface
7 sequelize: Sequelize.Sequelize 7 sequelize: Sequelize.Sequelize
8}): Promise<void> { 8}): Promise<void> {
9 const q = utils.queryInterface 9 const q = utils.queryInterface
diff --git a/server/initializers/migrations/0135-video-channel-actor.ts b/server/initializers/migrations/0135-video-channel-actor.ts
index 5ace0f4d2..c0c343384 100644
--- a/server/initializers/migrations/0135-video-channel-actor.ts
+++ b/server/initializers/migrations/0135-video-channel-actor.ts
@@ -3,8 +3,8 @@ import { DataType } from 'sequelize-typescript'
3import { createPrivateAndPublicKeys } from '../../helpers/peertube-crypto' 3import { createPrivateAndPublicKeys } from '../../helpers/peertube-crypto'
4 4
5async function up (utils: { 5async function up (utils: {
6 transaction: Sequelize.Transaction, 6 transaction: Sequelize.Transaction
7 queryInterface: Sequelize.QueryInterface, 7 queryInterface: Sequelize.QueryInterface
8 sequelize: Sequelize.Sequelize 8 sequelize: Sequelize.Sequelize
9}): Promise<void> { 9}): Promise<void> {
10 // Create actor table 10 // Create actor table
@@ -64,10 +64,10 @@ async function up (utils: {
64 type, uuid, "preferredUsername", url, "publicKey", "privateKey", "followersCount", "followingCount", "inboxUrl", "outboxUrl", 64 type, uuid, "preferredUsername", url, "publicKey", "privateKey", "followersCount", "followingCount", "inboxUrl", "outboxUrl",
65 "sharedInboxUrl", "followersUrl", "followingUrl", "avatarId", "serverId", "createdAt", "updatedAt" 65 "sharedInboxUrl", "followersUrl", "followingUrl", "avatarId", "serverId", "createdAt", "updatedAt"
66 ) 66 )
67 SELECT 67 SELECT
68 'Application', uuid, name, url, "publicKey", "privateKey", "followersCount", "followingCount", "inboxUrl", "outboxUrl", 68 'Application', uuid, name, url, "publicKey", "privateKey", "followersCount", "followingCount", "inboxUrl", "outboxUrl",
69 "sharedInboxUrl", "followersUrl", "followingUrl", "avatarId", "serverId", "createdAt", "updatedAt" 69 "sharedInboxUrl", "followersUrl", "followingUrl", "avatarId", "serverId", "createdAt", "updatedAt"
70 FROM account 70 FROM account
71 WHERE "applicationId" IS NOT NULL 71 WHERE "applicationId" IS NOT NULL
72 ` 72 `
73 await utils.sequelize.query(query1) 73 await utils.sequelize.query(query1)
@@ -79,10 +79,10 @@ async function up (utils: {
79 type, uuid, "preferredUsername", url, "publicKey", "privateKey", "followersCount", "followingCount", "inboxUrl", "outboxUrl", 79 type, uuid, "preferredUsername", url, "publicKey", "privateKey", "followersCount", "followingCount", "inboxUrl", "outboxUrl",
80 "sharedInboxUrl", "followersUrl", "followingUrl", "avatarId", "serverId", "createdAt", "updatedAt" 80 "sharedInboxUrl", "followersUrl", "followingUrl", "avatarId", "serverId", "createdAt", "updatedAt"
81 ) 81 )
82 SELECT 82 SELECT
83 'Person', uuid, name, url, "publicKey", "privateKey", "followersCount", "followingCount", "inboxUrl", "outboxUrl", 83 'Person', uuid, name, url, "publicKey", "privateKey", "followersCount", "followingCount", "inboxUrl", "outboxUrl",
84 "sharedInboxUrl", "followersUrl", "followingUrl", "avatarId", "serverId", "createdAt", "updatedAt" 84 "sharedInboxUrl", "followersUrl", "followingUrl", "avatarId", "serverId", "createdAt", "updatedAt"
85 FROM account 85 FROM account
86 WHERE "applicationId" IS NULL 86 WHERE "applicationId" IS NULL
87 ` 87 `
88 await utils.sequelize.query(query2) 88 await utils.sequelize.query(query2)
@@ -108,17 +108,17 @@ async function up (utils: {
108 } 108 }
109 109
110 { 110 {
111 const query = ` 111 const query = `
112 INSERT INTO actor 112 INSERT INTO actor
113 ( 113 (
114 type, uuid, "preferredUsername", url, "publicKey", "privateKey", "followersCount", "followingCount", "inboxUrl", "outboxUrl", 114 type, uuid, "preferredUsername", url, "publicKey", "privateKey", "followersCount", "followingCount", "inboxUrl", "outboxUrl",
115 "sharedInboxUrl", "followersUrl", "followingUrl", "avatarId", "serverId", "createdAt", "updatedAt" 115 "sharedInboxUrl", "followersUrl", "followingUrl", "avatarId", "serverId", "createdAt", "updatedAt"
116 ) 116 )
117 SELECT 117 SELECT
118 'Group', "videoChannel".uuid, "videoChannel".uuid, "videoChannel".url, null, null, 0, 0, "videoChannel".url || '/inbox', 118 'Group', "videoChannel".uuid, "videoChannel".uuid, "videoChannel".url, null, null, 0, 0, "videoChannel".url || '/inbox',
119 "videoChannel".url || '/outbox', "videoChannel".url || '/inbox', "videoChannel".url || '/followers', "videoChannel".url || '/following', 119 "videoChannel".url || '/outbox', "videoChannel".url || '/inbox', "videoChannel".url || '/followers', "videoChannel".url || '/following',
120 null, account."serverId", "videoChannel"."createdAt", "videoChannel"."updatedAt" 120 null, account."serverId", "videoChannel"."createdAt", "videoChannel"."updatedAt"
121 FROM "videoChannel" 121 FROM "videoChannel"
122 INNER JOIN "account" on "videoChannel"."accountId" = "account".id 122 INNER JOIN "account" on "videoChannel"."accountId" = "account".id
123 ` 123 `
124 await utils.sequelize.query(query) 124 await utils.sequelize.query(query)
@@ -157,13 +157,13 @@ async function up (utils: {
157 } 157 }
158 158
159 { 159 {
160 const query1 = `UPDATE "actorFollow" 160 const query1 = `UPDATE "actorFollow"
161 SET "actorId" = 161 SET "actorId" =
162 (SELECT "account"."actorId" FROM account WHERE "account"."id" = "actorFollow"."actorId")` 162 (SELECT "account"."actorId" FROM account WHERE "account"."id" = "actorFollow"."actorId")`
163 await utils.sequelize.query(query1) 163 await utils.sequelize.query(query1)
164 164
165 const query2 = `UPDATE "actorFollow" 165 const query2 = `UPDATE "actorFollow"
166 SET "targetActorId" = 166 SET "targetActorId" =
167 (SELECT "account"."actorId" FROM account WHERE "account"."id" = "actorFollow"."targetActorId")` 167 (SELECT "account"."actorId" FROM account WHERE "account"."id" = "actorFollow"."targetActorId")`
168 168
169 await utils.sequelize.query(query2) 169 await utils.sequelize.query(query2)
@@ -189,8 +189,8 @@ async function up (utils: {
189 await utils.queryInterface.removeConstraint('videoShare', 'videoShare_accountId_fkey') 189 await utils.queryInterface.removeConstraint('videoShare', 'videoShare_accountId_fkey')
190 } 190 }
191 191
192 const query = `UPDATE "videoShare" 192 const query = `UPDATE "videoShare"
193 SET "actorId" = 193 SET "actorId" =
194 (SELECT "actorId" FROM account WHERE id = "videoShare"."actorId")` 194 (SELECT "actorId" FROM account WHERE id = "videoShare"."actorId")`
195 await utils.sequelize.query(query) 195 await utils.sequelize.query(query)
196 196
diff --git a/server/initializers/migrations/0140-actor-url.ts b/server/initializers/migrations/0140-actor-url.ts
index 020499391..d790988ad 100644
--- a/server/initializers/migrations/0140-actor-url.ts
+++ b/server/initializers/migrations/0140-actor-url.ts
@@ -2,8 +2,8 @@ import * as Sequelize from 'sequelize'
2import { WEBSERVER } from '../constants' 2import { WEBSERVER } from '../constants'
3 3
4async function up (utils: { 4async function up (utils: {
5 transaction: Sequelize.Transaction, 5 transaction: Sequelize.Transaction
6 queryInterface: Sequelize.QueryInterface, 6 queryInterface: Sequelize.QueryInterface
7 sequelize: Sequelize.Sequelize 7 sequelize: Sequelize.Sequelize
8}): Promise<void> { 8}): Promise<void> {
9 const toReplace = WEBSERVER.HOSTNAME + ':443' 9 const toReplace = WEBSERVER.HOSTNAME + ':443'
diff --git a/server/initializers/migrations/0145-delete-author.ts b/server/initializers/migrations/0145-delete-author.ts
index cb23d1cc2..6c9427997 100644
--- a/server/initializers/migrations/0145-delete-author.ts
+++ b/server/initializers/migrations/0145-delete-author.ts
@@ -1,8 +1,8 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize 6 sequelize: Sequelize.Sequelize
7}): Promise<void> { 7}): Promise<void> {
8 await utils.queryInterface.dropTable('Authors') 8 await utils.queryInterface.dropTable('Authors')
diff --git a/server/initializers/migrations/0150-avatar-cascade.ts b/server/initializers/migrations/0150-avatar-cascade.ts
index 821696717..fb3b25773 100644
--- a/server/initializers/migrations/0150-avatar-cascade.ts
+++ b/server/initializers/migrations/0150-avatar-cascade.ts
@@ -1,8 +1,8 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize 6 sequelize: Sequelize.Sequelize
7}): Promise<void> { 7}): Promise<void> {
8 await utils.queryInterface.removeConstraint('actor', 'actor_avatarId_fkey') 8 await utils.queryInterface.removeConstraint('actor', 'actor_avatarId_fkey')
diff --git a/server/initializers/migrations/0155-video-comments-enabled.ts b/server/initializers/migrations/0155-video-comments-enabled.ts
index 6949d3a0c..691640b35 100644
--- a/server/initializers/migrations/0155-video-comments-enabled.ts
+++ b/server/initializers/migrations/0155-video-comments-enabled.ts
@@ -2,8 +2,8 @@ import * as Sequelize from 'sequelize'
2import { Migration } from '../../models/migrations' 2import { Migration } from '../../models/migrations'
3 3
4async function up (utils: { 4async function up (utils: {
5 transaction: Sequelize.Transaction, 5 transaction: Sequelize.Transaction
6 queryInterface: Sequelize.QueryInterface, 6 queryInterface: Sequelize.QueryInterface
7 sequelize: Sequelize.Sequelize 7 sequelize: Sequelize.Sequelize
8}): Promise<void> { 8}): Promise<void> {
9 const data = { 9 const data = {
diff --git a/server/initializers/migrations/0160-account-route.ts b/server/initializers/migrations/0160-account-route.ts
index cab4c72f1..97469948b 100644
--- a/server/initializers/migrations/0160-account-route.ts
+++ b/server/initializers/migrations/0160-account-route.ts
@@ -1,8 +1,8 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize 6 sequelize: Sequelize.Sequelize
7}): Promise<void> { 7}): Promise<void> {
8 { 8 {
diff --git a/server/initializers/migrations/0165-video-route.ts b/server/initializers/migrations/0165-video-route.ts
index 56d98bc69..aa7c75128 100644
--- a/server/initializers/migrations/0165-video-route.ts
+++ b/server/initializers/migrations/0165-video-route.ts
@@ -1,8 +1,8 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize 6 sequelize: Sequelize.Sequelize
7}): Promise<void> { 7}): Promise<void> {
8 { 8 {
diff --git a/server/initializers/migrations/0170-actor-follow-score.ts b/server/initializers/migrations/0170-actor-follow-score.ts
index a12b35da9..901a3c799 100644
--- a/server/initializers/migrations/0170-actor-follow-score.ts
+++ b/server/initializers/migrations/0170-actor-follow-score.ts
@@ -2,8 +2,8 @@ import * as Sequelize from 'sequelize'
2import { ACTOR_FOLLOW_SCORE } from '../constants' 2import { ACTOR_FOLLOW_SCORE } from '../constants'
3 3
4async function up (utils: { 4async function up (utils: {
5 transaction: Sequelize.Transaction, 5 transaction: Sequelize.Transaction
6 queryInterface: Sequelize.QueryInterface, 6 queryInterface: Sequelize.QueryInterface
7 sequelize: Sequelize.Sequelize 7 sequelize: Sequelize.Sequelize
8}): Promise<void> { 8}): Promise<void> {
9 await utils.queryInterface.removeColumn('server', 'score') 9 await utils.queryInterface.removeColumn('server', 'score')
diff --git a/server/initializers/migrations/0175-actor-follow-counts.ts b/server/initializers/migrations/0175-actor-follow-counts.ts
index 4fb524181..d7853f8dc 100644
--- a/server/initializers/migrations/0175-actor-follow-counts.ts
+++ b/server/initializers/migrations/0175-actor-follow-counts.ts
@@ -1,8 +1,8 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize 6 sequelize: Sequelize.Sequelize
7}): Promise<void> { 7}): Promise<void> {
8 const query = 'UPDATE "actor" SET ' + 8 const query = 'UPDATE "actor" SET ' +
diff --git a/server/initializers/migrations/0180-job-table-delete.ts b/server/initializers/migrations/0180-job-table-delete.ts
index df29145d0..fb48a0c9d 100644
--- a/server/initializers/migrations/0180-job-table-delete.ts
+++ b/server/initializers/migrations/0180-job-table-delete.ts
@@ -1,8 +1,8 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize 6 sequelize: Sequelize.Sequelize
7}): Promise<void> { 7}): Promise<void> {
8 await utils.queryInterface.dropTable('job') 8 await utils.queryInterface.dropTable('job')
diff --git a/server/initializers/migrations/0185-video-share-url.ts b/server/initializers/migrations/0185-video-share-url.ts
index f7eeb0878..f59931e0f 100644
--- a/server/initializers/migrations/0185-video-share-url.ts
+++ b/server/initializers/migrations/0185-video-share-url.ts
@@ -1,8 +1,8 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize 6 sequelize: Sequelize.Sequelize
7}): Promise<void> { 7}): Promise<void> {
8 { 8 {
diff --git a/server/initializers/migrations/0190-video-comment-unique-url.ts b/server/initializers/migrations/0190-video-comment-unique-url.ts
index b196c9352..a8769ed41 100644
--- a/server/initializers/migrations/0190-video-comment-unique-url.ts
+++ b/server/initializers/migrations/0190-video-comment-unique-url.ts
@@ -1,8 +1,8 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize 6 sequelize: Sequelize.Sequelize
7}): Promise<void> { 7}): Promise<void> {
8 { 8 {
diff --git a/server/initializers/migrations/0195-support.ts b/server/initializers/migrations/0195-support.ts
index 3b9eabe79..3f7c75dce 100644
--- a/server/initializers/migrations/0195-support.ts
+++ b/server/initializers/migrations/0195-support.ts
@@ -1,8 +1,8 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize 6 sequelize: Sequelize.Sequelize
7}): Promise<void> { 7}): Promise<void> {
8 { 8 {
diff --git a/server/initializers/migrations/0200-video-published-at.ts b/server/initializers/migrations/0200-video-published-at.ts
index 1701ea07a..d8c7b42a7 100644
--- a/server/initializers/migrations/0200-video-published-at.ts
+++ b/server/initializers/migrations/0200-video-published-at.ts
@@ -1,8 +1,8 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize 6 sequelize: Sequelize.Sequelize
7}): Promise<void> { 7}): Promise<void> {
8 8
diff --git a/server/initializers/migrations/0205-user-nsfw-policy.ts b/server/initializers/migrations/0205-user-nsfw-policy.ts
index d0f6e8962..9c2786f12 100644
--- a/server/initializers/migrations/0205-user-nsfw-policy.ts
+++ b/server/initializers/migrations/0205-user-nsfw-policy.ts
@@ -1,8 +1,8 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize 6 sequelize: Sequelize.Sequelize
7}): Promise<void> { 7}): Promise<void> {
8 8
diff --git a/server/initializers/migrations/0210-video-language.ts b/server/initializers/migrations/0210-video-language.ts
index ca95c7527..ee4ce9266 100644
--- a/server/initializers/migrations/0210-video-language.ts
+++ b/server/initializers/migrations/0210-video-language.ts
@@ -2,8 +2,8 @@ import * as Sequelize from 'sequelize'
2import { CONSTRAINTS_FIELDS } from '../constants' 2import { CONSTRAINTS_FIELDS } from '../constants'
3 3
4async function up (utils: { 4async function up (utils: {
5 transaction: Sequelize.Transaction, 5 transaction: Sequelize.Transaction
6 queryInterface: Sequelize.QueryInterface, 6 queryInterface: Sequelize.QueryInterface
7 sequelize: Sequelize.Sequelize 7 sequelize: Sequelize.Sequelize
8}): Promise<void> { 8}): Promise<void> {
9 9
diff --git a/server/initializers/migrations/0215-video-support-length.ts b/server/initializers/migrations/0215-video-support-length.ts
index ba395050f..26c0ca700 100644
--- a/server/initializers/migrations/0215-video-support-length.ts
+++ b/server/initializers/migrations/0215-video-support-length.ts
@@ -1,8 +1,8 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize 6 sequelize: Sequelize.Sequelize
7}): Promise<void> { 7}): Promise<void> {
8 { 8 {
diff --git a/server/initializers/migrations/0255-video-blacklist-reason.ts b/server/initializers/migrations/0255-video-blacklist-reason.ts
index 69d6efb9e..7de982f93 100644
--- a/server/initializers/migrations/0255-video-blacklist-reason.ts
+++ b/server/initializers/migrations/0255-video-blacklist-reason.ts
@@ -1,5 +1,4 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import { VideoAbuseState } from '../../../shared/models/videos'
3 2
4async function up (utils: { 3async function up (utils: {
5 transaction: Sequelize.Transaction 4 transaction: Sequelize.Transaction
diff --git a/server/initializers/migrations/0285-description-support.ts b/server/initializers/migrations/0285-description-support.ts
index 85ef4ef39..aab3a938f 100644
--- a/server/initializers/migrations/0285-description-support.ts
+++ b/server/initializers/migrations/0285-description-support.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 { 9 {
diff --git a/server/initializers/migrations/0290-account-video-rate-url.ts b/server/initializers/migrations/0290-account-video-rate-url.ts
index bdabf2929..b974b1a81 100644
--- a/server/initializers/migrations/0290-account-video-rate-url.ts
+++ b/server/initializers/migrations/0290-account-video-rate-url.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 { 9 {
diff --git a/server/initializers/migrations/0295-video-file-extname.ts b/server/initializers/migrations/0295-video-file-extname.ts
index dbf249f66..e1999b072 100644
--- a/server/initializers/migrations/0295-video-file-extname.ts
+++ b/server/initializers/migrations/0295-video-file-extname.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 { 9 {
diff --git a/server/initializers/migrations/0300-user-videos-history-enabled.ts b/server/initializers/migrations/0300-user-videos-history-enabled.ts
index aa5fc21fb..5e35e14ba 100644
--- a/server/initializers/migrations/0300-user-videos-history-enabled.ts
+++ b/server/initializers/migrations/0300-user-videos-history-enabled.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 { 9 {
diff --git a/server/initializers/migrations/0305-fix-unfederated-videos.ts b/server/initializers/migrations/0305-fix-unfederated-videos.ts
index be206601f..9c5d56b7b 100644
--- a/server/initializers/migrations/0305-fix-unfederated-videos.ts
+++ b/server/initializers/migrations/0305-fix-unfederated-videos.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 { 9 {
diff --git a/server/initializers/migrations/0310-drop-unused-video-indexes.ts b/server/initializers/migrations/0310-drop-unused-video-indexes.ts
index d51f430c0..181858d3d 100644
--- a/server/initializers/migrations/0310-drop-unused-video-indexes.ts
+++ b/server/initializers/migrations/0310-drop-unused-video-indexes.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 const indexNames = [ 9 const indexNames = [
diff --git a/server/initializers/migrations/0315-user-notifications.ts b/server/initializers/migrations/0315-user-notifications.ts
index 8284c58a0..0e3f4fbef 100644
--- a/server/initializers/migrations/0315-user-notifications.ts
+++ b/server/initializers/migrations/0315-user-notifications.ts
@@ -1,8 +1,8 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize 6 sequelize: Sequelize.Sequelize
7}): Promise<void> { 7}): Promise<void> {
8 8
diff --git a/server/initializers/migrations/0320-blacklist-unfederate.ts b/server/initializers/migrations/0320-blacklist-unfederate.ts
index 6fb7bbb90..41de41c55 100644
--- a/server/initializers/migrations/0320-blacklist-unfederate.ts
+++ b/server/initializers/migrations/0320-blacklist-unfederate.ts
@@ -1,8 +1,8 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize 6 sequelize: Sequelize.Sequelize
7}): Promise<void> { 7}): Promise<void> {
8 8
diff --git a/server/initializers/migrations/0325-video-abuse-fields.ts b/server/initializers/migrations/0325-video-abuse-fields.ts
index fca6d666f..d88724a20 100644
--- a/server/initializers/migrations/0325-video-abuse-fields.ts
+++ b/server/initializers/migrations/0325-video-abuse-fields.ts
@@ -1,8 +1,8 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize 6 sequelize: Sequelize.Sequelize
7}): Promise<void> { 7}): Promise<void> {
8 8
diff --git a/server/initializers/migrations/0330-video-streaming-playlist.ts b/server/initializers/migrations/0330-video-streaming-playlist.ts
index c85a762ab..f75541a7f 100644
--- a/server/initializers/migrations/0330-video-streaming-playlist.ts
+++ b/server/initializers/migrations/0330-video-streaming-playlist.ts
@@ -1,8 +1,8 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize 6 sequelize: Sequelize.Sequelize
7}): Promise<void> { 7}): Promise<void> {
8 8
diff --git a/server/initializers/migrations/0335-video-downloading-enabled.ts b/server/initializers/migrations/0335-video-downloading-enabled.ts
index e79466447..c745f1f02 100644
--- a/server/initializers/migrations/0335-video-downloading-enabled.ts
+++ b/server/initializers/migrations/0335-video-downloading-enabled.ts
@@ -2,8 +2,8 @@ import * as Sequelize from 'sequelize'
2import { Migration } from '../../models/migrations' 2import { Migration } from '../../models/migrations'
3 3
4async function up (utils: { 4async function up (utils: {
5 transaction: Sequelize.Transaction, 5 transaction: Sequelize.Transaction
6 queryInterface: Sequelize.QueryInterface, 6 queryInterface: Sequelize.QueryInterface
7 sequelize: Sequelize.Sequelize 7 sequelize: Sequelize.Sequelize
8}): Promise<void> { 8}): Promise<void> {
9 const data = { 9 const data = {
diff --git a/server/initializers/migrations/0340-add-originally-published-at.ts b/server/initializers/migrations/0340-add-originally-published-at.ts
index fe4f4a5f9..7cbc14ab5 100644
--- a/server/initializers/migrations/0340-add-originally-published-at.ts
+++ b/server/initializers/migrations/0340-add-originally-published-at.ts
@@ -1,8 +1,8 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize 6 sequelize: Sequelize.Sequelize
7}): Promise<void> { 7}): Promise<void> {
8 8
diff --git a/server/initializers/migrations/0345-video-playlists.ts b/server/initializers/migrations/0345-video-playlists.ts
index de69f5b9e..76813f93f 100644
--- a/server/initializers/migrations/0345-video-playlists.ts
+++ b/server/initializers/migrations/0345-video-playlists.ts
@@ -4,8 +4,8 @@ import * as uuidv4 from 'uuid/v4'
4import { WEBSERVER } from '../constants' 4import { WEBSERVER } from '../constants'
5 5
6async function up (utils: { 6async function up (utils: {
7 transaction: Sequelize.Transaction, 7 transaction: Sequelize.Transaction
8 queryInterface: Sequelize.QueryInterface, 8 queryInterface: Sequelize.QueryInterface
9 sequelize: Sequelize.Sequelize 9 sequelize: Sequelize.Sequelize
10}): Promise<void> { 10}): Promise<void> {
11 const transaction = utils.transaction 11 const transaction = utils.transaction
diff --git a/server/initializers/migrations/0350-video-blacklist-type.ts b/server/initializers/migrations/0350-video-blacklist-type.ts
index 4849020ef..f79ae5ec7 100644
--- a/server/initializers/migrations/0350-video-blacklist-type.ts
+++ b/server/initializers/migrations/0350-video-blacklist-type.ts
@@ -2,9 +2,9 @@ import * as Sequelize from 'sequelize'
2import { VideoBlacklistType } from '../../../shared/models/videos' 2import { VideoBlacklistType } from '../../../shared/models/videos'
3 3
4async function up (utils: { 4async function up (utils: {
5 transaction: Sequelize.Transaction, 5 transaction: Sequelize.Transaction
6 queryInterface: Sequelize.QueryInterface, 6 queryInterface: Sequelize.QueryInterface
7 sequelize: Sequelize.Sequelize, 7 sequelize: Sequelize.Sequelize
8 db: any 8 db: any
9}): Promise<void> { 9}): Promise<void> {
10 { 10 {
diff --git a/server/initializers/migrations/0355-p2p-peer-version.ts b/server/initializers/migrations/0355-p2p-peer-version.ts
index 18f23d9b7..89af28d07 100644
--- a/server/initializers/migrations/0355-p2p-peer-version.ts
+++ b/server/initializers/migrations/0355-p2p-peer-version.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 9
diff --git a/server/initializers/migrations/0360-notification-instance-follower.ts b/server/initializers/migrations/0360-notification-instance-follower.ts
index 05caf8e1d..6f9a01a9c 100644
--- a/server/initializers/migrations/0360-notification-instance-follower.ts
+++ b/server/initializers/migrations/0360-notification-instance-follower.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 { 9 {
diff --git a/server/initializers/migrations/0365-user-admin-flags.ts b/server/initializers/migrations/0365-user-admin-flags.ts
index 20553100a..b705387da 100644
--- a/server/initializers/migrations/0365-user-admin-flags.ts
+++ b/server/initializers/migrations/0365-user-admin-flags.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 { 9 {
diff --git a/server/initializers/migrations/0370-thumbnail.ts b/server/initializers/migrations/0370-thumbnail.ts
index 384ca1a15..07c25436a 100644
--- a/server/initializers/migrations/0370-thumbnail.ts
+++ b/server/initializers/migrations/0370-thumbnail.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 { 9 {
diff --git a/server/initializers/migrations/0375-account-description.ts b/server/initializers/migrations/0375-account-description.ts
index 1258563fd..f9af942e0 100644
--- a/server/initializers/migrations/0375-account-description.ts
+++ b/server/initializers/migrations/0375-account-description.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 const data = { 9 const data = {
diff --git a/server/initializers/migrations/0380-cleanup-timestamps.ts b/server/initializers/migrations/0380-cleanup-timestamps.ts
index 2a9fd6f02..18ecfb997 100644
--- a/server/initializers/migrations/0380-cleanup-timestamps.ts
+++ b/server/initializers/migrations/0380-cleanup-timestamps.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 try { 9 try {
diff --git a/server/initializers/migrations/0385-remove-actor-uuid.ts b/server/initializers/migrations/0385-remove-actor-uuid.ts
index 032c0562b..eefbc386b 100644
--- a/server/initializers/migrations/0385-remove-actor-uuid.ts
+++ b/server/initializers/migrations/0385-remove-actor-uuid.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 await utils.queryInterface.removeColumn('actor', 'uuid') 9 await utils.queryInterface.removeColumn('actor', 'uuid')
diff --git a/server/initializers/migrations/0390-user-pending-email.ts b/server/initializers/migrations/0390-user-pending-email.ts
index 5ca871746..9cf0affa5 100644
--- a/server/initializers/migrations/0390-user-pending-email.ts
+++ b/server/initializers/migrations/0390-user-pending-email.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 const data = { 9 const data = {
diff --git a/server/initializers/migrations/0395-user-video-languages.ts b/server/initializers/migrations/0395-user-video-languages.ts
index 278698bf4..9c24fbc9a 100644
--- a/server/initializers/migrations/0395-user-video-languages.ts
+++ b/server/initializers/migrations/0395-user-video-languages.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 const data = { 9 const data = {
diff --git a/server/initializers/migrations/0400-user-theme.ts b/server/initializers/migrations/0400-user-theme.ts
index f74d76115..7addb1bb3 100644
--- a/server/initializers/migrations/0400-user-theme.ts
+++ b/server/initializers/migrations/0400-user-theme.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 const data = { 9 const data = {
diff --git a/server/initializers/migrations/0405-plugin.ts b/server/initializers/migrations/0405-plugin.ts
index c55b81960..5c290b986 100644
--- a/server/initializers/migrations/0405-plugin.ts
+++ b/server/initializers/migrations/0405-plugin.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 { 9 {
diff --git a/server/initializers/migrations/0410-video-playlist-element.ts b/server/initializers/migrations/0410-video-playlist-element.ts
index f536632a2..1b4692357 100644
--- a/server/initializers/migrations/0410-video-playlist-element.ts
+++ b/server/initializers/migrations/0410-video-playlist-element.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 { 9 {
diff --git a/server/initializers/migrations/0415-thumbnail-auto-generated.ts b/server/initializers/migrations/0415-thumbnail-auto-generated.ts
index f822a4c05..98d563c88 100644
--- a/server/initializers/migrations/0415-thumbnail-auto-generated.ts
+++ b/server/initializers/migrations/0415-thumbnail-auto-generated.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 { 9 {
diff --git a/server/initializers/migrations/0420-avatar-lazy.ts b/server/initializers/migrations/0420-avatar-lazy.ts
index 5fc57aac2..5c74819d2 100644
--- a/server/initializers/migrations/0420-avatar-lazy.ts
+++ b/server/initializers/migrations/0420-avatar-lazy.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 { 9 {
diff --git a/server/initializers/migrations/0425-nullable-actor-fields.ts b/server/initializers/migrations/0425-nullable-actor-fields.ts
index 4e5f9e6ab..720b99ccc 100644
--- a/server/initializers/migrations/0425-nullable-actor-fields.ts
+++ b/server/initializers/migrations/0425-nullable-actor-fields.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 const data = { 9 const data = {
diff --git a/server/initializers/migrations/0430-auto-follow-notification-setting.ts b/server/initializers/migrations/0430-auto-follow-notification-setting.ts
index 034bdd46d..1734828a4 100644
--- a/server/initializers/migrations/0430-auto-follow-notification-setting.ts
+++ b/server/initializers/migrations/0430-auto-follow-notification-setting.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 { 9 {
diff --git a/server/initializers/migrations/0435-user-modals.ts b/server/initializers/migrations/0435-user-modals.ts
index 5c2aa85b5..737440e9b 100644
--- a/server/initializers/migrations/0435-user-modals.ts
+++ b/server/initializers/migrations/0435-user-modals.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 { 9 {
diff --git a/server/initializers/migrations/0440-user-auto-play-next-video.ts b/server/initializers/migrations/0440-user-auto-play-next-video.ts
index f0baafe7b..f3f663f59 100644
--- a/server/initializers/migrations/0440-user-auto-play-next-video.ts
+++ b/server/initializers/migrations/0440-user-auto-play-next-video.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 { 9 {
diff --git a/server/initializers/migrations/0445-shared-inbox-optional.ts b/server/initializers/migrations/0445-shared-inbox-optional.ts
index dad2d6569..ade1a2a57 100644
--- a/server/initializers/migrations/0445-shared-inbox-optional.ts
+++ b/server/initializers/migrations/0445-shared-inbox-optional.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 { 9 {
diff --git a/server/initializers/migrations/0450-streaming-playlist-files.ts b/server/initializers/migrations/0450-streaming-playlist-files.ts
index 460dac8be..08e2e3989 100644
--- a/server/initializers/migrations/0450-streaming-playlist-files.ts
+++ b/server/initializers/migrations/0450-streaming-playlist-files.ts
@@ -1,15 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import { join } from 'path'
3import { HLS_STREAMING_PLAYLIST_DIRECTORY, WEBSERVER } from '@server/initializers/constants'
4import { CONFIG } from '@server/initializers/config'
5import { pathExists, stat, writeFile } from 'fs-extra'
6import * as parseTorrent from 'parse-torrent'
7import { createTorrentPromise } from '@server/helpers/webtorrent'
8 2
9async function up (utils: { 3async function up (utils: {
10 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
11 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
12 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
13 db: any 7 db: any
14}): Promise<void> { 8}): Promise<void> {
15 { 9 {
@@ -42,8 +36,8 @@ async function up (utils: {
42 { 36 {
43 const query = 'insert into "videoFile" ' + 37 const query = 'insert into "videoFile" ' +
44 '(resolution, size, "infoHash", "videoId", "createdAt", "updatedAt", fps, extname, "videoStreamingPlaylistId")' + 38 '(resolution, size, "infoHash", "videoId", "createdAt", "updatedAt", fps, extname, "videoStreamingPlaylistId")' +
45 '(SELECT "videoFile".resolution, "videoFile".size, \'fake\', NULL, "videoFile"."createdAt", "videoFile"."updatedAt", "videoFile"."fps", ' + 39 '(SELECT "videoFile".resolution, "videoFile".size, \'fake\', NULL, "videoFile"."createdAt", "videoFile"."updatedAt", ' +
46 '"videoFile".extname, "videoStreamingPlaylist".id FROM "videoStreamingPlaylist" ' + 40 '"videoFile"."fps", "videoFile".extname, "videoStreamingPlaylist".id FROM "videoStreamingPlaylist" ' +
47 'inner join video ON video.id = "videoStreamingPlaylist"."videoId" inner join "videoFile" ON "videoFile"."videoId" = video.id)' 41 'inner join video ON video.id = "videoStreamingPlaylist"."videoId" inner join "videoFile" ON "videoFile"."videoId" = video.id)'
48 42
49 await utils.sequelize.query(query, { transaction: utils.transaction }) 43 await utils.sequelize.query(query, { transaction: utils.transaction })
diff --git a/server/initializers/migrations/0455-soft-delete-video-comments.ts b/server/initializers/migrations/0455-soft-delete-video-comments.ts
index bcfb97b56..00e56015f 100644
--- a/server/initializers/migrations/0455-soft-delete-video-comments.ts
+++ b/server/initializers/migrations/0455-soft-delete-video-comments.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 { 9 {
diff --git a/server/initializers/migrations/0460-user-playlist-autoplay.ts b/server/initializers/migrations/0460-user-playlist-autoplay.ts
index 3067ac1a4..d6f5081ab 100644
--- a/server/initializers/migrations/0460-user-playlist-autoplay.ts
+++ b/server/initializers/migrations/0460-user-playlist-autoplay.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 { 9 {
diff --git a/server/initializers/migrations/0465-thumbnail-file-url-length.ts b/server/initializers/migrations/0465-thumbnail-file-url-length.ts
index db8c85c29..84a4fa0ba 100644
--- a/server/initializers/migrations/0465-thumbnail-file-url-length.ts
+++ b/server/initializers/migrations/0465-thumbnail-file-url-length.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 { 9 {
diff --git a/server/initializers/migrations/0470-cleaup-indexes.ts b/server/initializers/migrations/0470-cleaup-indexes.ts
index 53e401c2b..7365c30f8 100644
--- a/server/initializers/migrations/0470-cleaup-indexes.ts
+++ b/server/initializers/migrations/0470-cleaup-indexes.ts
@@ -1,9 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3async function up (utils: { 3async function up (utils: {
4 transaction: Sequelize.Transaction, 4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface, 5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize, 6 sequelize: Sequelize.Sequelize
7 db: any 7 db: any
8}): Promise<void> { 8}): Promise<void> {
9 await utils.sequelize.query('DROP INDEX IF EXISTS video_share_account_id;') 9 await utils.sequelize.query('DROP INDEX IF EXISTS video_share_account_id;')
diff --git a/server/initializers/migrations/0475-redundancy-expires-on.ts b/server/initializers/migrations/0475-redundancy-expires-on.ts
new file mode 100644
index 000000000..edbddba37
--- /dev/null
+++ b/server/initializers/migrations/0475-redundancy-expires-on.ts
@@ -0,0 +1,27 @@
1import * as Sequelize from 'sequelize'
2
3async function up (utils: {
4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize
7 db: any
8}): Promise<void> {
9 {
10 const data = {
11 type: Sequelize.DATE,
12 allowNull: true,
13 defaultValue: null
14 }
15
16 await utils.queryInterface.changeColumn('videoRedundancy', 'expiresOn', data)
17 }
18}
19
20function down (options) {
21 throw new Error('Not implemented.')
22}
23
24export {
25 up,
26 down
27}
diff --git a/server/initializers/migrations/0480-caption-file-url.ts b/server/initializers/migrations/0480-caption-file-url.ts
new file mode 100644
index 000000000..1f88206d3
--- /dev/null
+++ b/server/initializers/migrations/0480-caption-file-url.ts
@@ -0,0 +1,27 @@
1import * as Sequelize from 'sequelize'
2
3async function up (utils: {
4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize
7 db: any
8}): Promise<void> {
9 {
10 const data = {
11 type: Sequelize.STRING,
12 allowNull: true,
13 defaultValue: null
14 }
15
16 await utils.queryInterface.addColumn('videoCaption', 'fileUrl', data)
17 }
18}
19
20function down (options) {
21 throw new Error('Not implemented.')
22}
23
24export {
25 up,
26 down
27}
diff --git a/server/initializers/migrator.ts b/server/initializers/migrator.ts
index 1cb0116b7..77203ae24 100644
--- a/server/initializers/migrator.ts
+++ b/server/initializers/migrator.ts
@@ -20,7 +20,7 @@ async function migrate () {
20 } 20 }
21 21
22 const rows = await sequelizeTypescript.query<{ migrationVersion: number }>(query, options) 22 const rows = await sequelizeTypescript.query<{ migrationVersion: number }>(query, options)
23 if (rows && rows[0] && rows[0].migrationVersion) { 23 if (rows?.[0]?.migrationVersion) {
24 actualVersion = rows[0].migrationVersion 24 actualVersion = rows[0].migrationVersion
25 } 25 }
26 26
@@ -60,7 +60,7 @@ export {
60async function getMigrationScripts () { 60async function getMigrationScripts () {
61 const files = await readdir(path.join(__dirname, 'migrations')) 61 const files = await readdir(path.join(__dirname, 'migrations'))
62 const filesToMigrate: { 62 const filesToMigrate: {
63 version: string, 63 version: string
64 script: string 64 script: string
65 }[] = [] 65 }[] = []
66 66