ActivityPub-federated video streaming platform using P2P directly in your web browser
Move to eslint
Chocobozzza15871560f80
diff --git a/.eslintrc.json b/.eslintrc.jsonnew file mode 100644index 0000000000..a86c5bbbab--- /dev/null+++ b/.eslintrc.json@@ -0,0 +1,88 @@+{+ "extends": "standard-with-typescript",+ "rules": {+ "eol-last": [+ "error",+ "always"+ ],+ "indent": "off",+ "no-lone-blocks": "off",+ "no-mixed-operators": "off",+ "max-len": [+ "error",+ {+ "code": 140+ }+ ],+ "array-bracket-spacing": [+ "error",+ "always"+ ],+ "quote-props": [+ "error",+ "consistent-as-needed"+ ],+ "padded-blocks": "off",+ "no-async-promise-executor": "off",+ "dot-notation": "off",+ "promise/param-names": "off",+ "import/first": "off",+ "operator-linebreak": [+ "error",+ "after",+ {+ "overrides": {+ "?": "before",+ ":": "before"+ }+ }+ ],+ "@typescript-eslint/indent": [+ "error",+ 2,+ {+ "SwitchCase": 1,+ "MemberExpression": "off"+ }+ ],+ "@typescript-eslint/consistent-type-assertions": [+ "error",+ {+ "assertionStyle": "as"+ }+ ],+ "@typescript-eslint/array-type": [+ "error",+ {+ "default": "array"+ }+ ],+ "@typescript-eslint/restrict-template-expressions": [+ "off",+ {+ "allowNumber": "true"+ }+ ],+ "@typescript-eslint/quotes": "off",+ "@typescript-eslint/no-var-requires": "off",+ "@typescript-eslint/explicit-function-return-type": "off",+ "@typescript-eslint/promise-function-async": "off",+ "@typescript-eslint/no-dynamic-delete": "off",+ "@typescript-eslint/strict-boolean-expressions": "off",+ "@typescript-eslint/consistent-type-definitions": "off",+ "@typescript-eslint/no-misused-promises": "off",+ "@typescript-eslint/no-namespace": "off",+ "@typescript-eslint/no-extraneous-class": "off",+ // bugged but useful+ "@typescript-eslint/restrict-plus-operands": "off"+ },+ "ignorePatterns": [+ "node_modules/"+ ],+ "parserOptions": {+ "project": [+ "./tsconfig.json",+ "./server/tools/tsconfig.json"+ ]+ }+}diff --git a/package.json b/package.jsonindex a766f8d81d..0a5484d2a6 100644--- a/package.json+++ b/package.json@@ -63,7 +63,7 @@"ng": "ng","nodemon": "nodemon","ts-node": "ts-node",- "tslint": "tslint",+ "eslint": "eslint","concurrently": "concurrently","mocha-parallel-tests": "mocha-parallel-tests","sasslint": "sass-lint --verbose --no-exit",@@ -96,7 +96,7 @@"express": "^4.12.4","express-oauth-server": "^2.0.0","express-rate-limit": "^4.0.4",- "express-validator": "^6.1.1",+ "express-validator": "^6.4.0","flat": "^5.0.0","fluent-ffmpeg": "^2.1.0","fs-extra": "^8.0.1",@@ -139,7 +139,7 @@"webtorrent": "^0.107.16","winston": "3.2.1","ws": "^7.0.0",- "youtube-dl": "^3.0.1"+ "youtube-dl": "^3.0.2"},"devDependencies": {"@types/apicache": "^1.2.0",@@ -180,10 +180,17 @@"@types/validator": "^12.0.1","@types/webtorrent": "^0.107.0","@types/ws": "^7.2.1",+ "@typescript-eslint/eslint-plugin": "^2.18.0","chai": "^4.1.1","chai-json-schema": "^1.5.0","chai-xml": "^0.3.2","concurrently": "^5.0.0",+ "eslint": "^6.8.0",+ "eslint-config-standard-with-typescript": "^12.0.1",+ "eslint-plugin-import": "^2.20.1",+ "eslint-plugin-node": "^11.0.0",+ "eslint-plugin-promise": "^4.2.1",+ "eslint-plugin-standard": "^4.0.1","libxmljs": "0.19.7","maildev": "^1.0.0-rc3","marked": "^0.8.0",@@ -195,8 +202,6 @@"supertest": "^4.0.2","swagger-cli": "^3.0.1","ts-node": "8.6.2",- "tslint": "^6.0.0",- "tslint-config-standard": "^9.0.0","typescript": "^3.7.2"},"scripty": {diff --git a/scripts/ci.sh b/scripts/ci.shindex 4063a62418..aea009d9f4 100755--- a/scripts/ci.sh+++ b/scripts/ci.sh@@ -35,7 +35,7 @@ elif [ "$1" = "api-4" ]; thennpm run build:serversh ./server/tests/api/ci-4.sh 2elif [ "$1" = "lint" ]; then- npm run tslint -- --project ./tsconfig.json -c ./tslint.json server.ts "server/**/*.ts" "shared/**/*.ts"+ npm run eslint -- --ext .ts "server/**/*.ts" "shared/**/*.ts"npm run swagger-cli -- validate support/doc/api/openapi.yaml( cd clientdiff --git a/scripts/create-import-video-file-job.ts b/scripts/create-import-video-file-job.tsindex 204337d551..37738ca40c 100644--- a/scripts/create-import-video-file-job.ts+++ b/scripts/create-import-video-file-job.ts@@ -38,6 +38,6 @@ async function run () {}await JobQueue.Instance.init()- await JobQueue.Instance.createJob({ type: 'video-file-import', payload: dataInput })+ await JobQueue.Instance.createJobWithPromise({ type: 'video-file-import', payload: dataInput })console.log('Import job for video %s created.', video.uuid)}diff --git a/scripts/create-transcoding-job.ts b/scripts/create-transcoding-job.tsindex 27170299d6..fec58da2ee 100755--- a/scripts/create-transcoding-job.ts+++ b/scripts/create-transcoding-job.ts@@ -72,7 +72,7 @@ async function run () {await JobQueue.Instance.init()for (const d of dataInput) {- await JobQueue.Instance.createJob({ type: 'video-transcoding', payload: d })+ await JobQueue.Instance.createJobWithPromise({ type: 'video-transcoding', payload: d })console.log('Transcoding job for video %s created.', video.uuid)}}diff --git a/server/controllers/activitypub/client.ts b/server/controllers/activitypub/client.tsindex 95c2a26a68..39f6d7231a 100644--- a/server/controllers/activitypub/client.ts+++ b/server/controllers/activitypub/client.ts@@ -122,7 +122,7 @@ activityPubClientRouter.get('/videos/watch/:videoId/comments/:commentId/activityactivityPubClientRouter.get('/video-channels/:name',executeIfActivityPub,asyncMiddleware(localVideoChannelValidator),- asyncMiddleware(videoChannelController)+ videoChannelController)activityPubClientRouter.get('/video-channels/:name/followers',executeIfActivityPub,@@ -154,7 +154,7 @@ activityPubClientRouter.get('/video-playlists/:playlistId',activityPubClientRouter.get('/video-playlists/:playlistId/:videoId',executeIfActivityPub,asyncMiddleware(videoPlaylistElementAPGetValidator),- asyncMiddleware(videoPlaylistElementController)+ videoPlaylistElementController)// ---------------------------------------------------------------------------@@ -281,7 +281,7 @@ async function videoCommentsController (req: express.Request, res: express.Resporeturn activityPubResponse(activityPubContextify(json), res)}-async function videoChannelController (req: express.Request, res: express.Response) {+function videoChannelController (req: express.Request, res: express.Response) {const videoChannel = res.locals.videoChannelreturn activityPubResponse(activityPubContextify(videoChannel.toActivityPubObject()), res)@@ -353,7 +353,7 @@ async function videoPlaylistController (req: express.Request, res: express.Resporeturn activityPubResponse(activityPubContextify(object), res)}-async function videoPlaylistElementController (req: express.Request, res: express.Response) {+function videoPlaylistElementController (req: express.Request, res: express.Response) {const videoPlaylistElement = res.locals.videoPlaylistElementAPconst json = videoPlaylistElement.toActivityPubObject()diff --git a/server/controllers/activitypub/inbox.ts b/server/controllers/activitypub/inbox.tsindex 4fb180003a..3b8fb34a84 100644--- a/server/controllers/activitypub/inbox.ts+++ b/server/controllers/activitypub/inbox.ts@@ -46,6 +46,10 @@ const inboxQueue = queue<QueueParam, Error>((task, cb) => {processActivities(task.activities, options).then(() => cb())+ .catch(err => {+ logger.error('Error in process activities.', { err })+ cb()+ })})function inboxController (req: express.Request, res: express.Response) {diff --git a/server/controllers/api/accounts.ts b/server/controllers/api/accounts.tsindex 05740318ef..f354ccf24e 100644--- a/server/controllers/api/accounts.ts+++ b/server/controllers/api/accounts.ts@@ -16,21 +16,17 @@ import {accountNameWithHostGetValidator,accountsSortValidator,ensureAuthUserOwnsAccountValidator,- videosSortValidator,- videoChannelsSortValidator+ videoChannelsSortValidator,+ videosSortValidator} from '../../middlewares/validators'import { AccountModel } from '../../models/account/account'import { AccountVideoRateModel } from '../../models/account/account-video-rate'import { VideoModel } from '../../models/video/video'-import { buildNSFWFilter, isUserAbleToSearchRemoteURI, getCountVideos } from '../../helpers/express-utils'+import { buildNSFWFilter, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils'import { VideoChannelModel } from '../../models/video/video-channel'import { JobQueue } from '../../lib/job-queue'-import { logger } from '../../helpers/logger'import { VideoPlaylistModel } from '../../models/video/video-playlist'-import {- commonVideoPlaylistFiltersValidator,- videoPlaylistsSearchValidator-} from '../../middlewares/validators/videos/video-playlists'+import { commonVideoPlaylistFiltersValidator, videoPlaylistsSearchValidator } from '../../middlewares/validators/videos/video-playlists'const accountsRouter = express.Router()@@ -104,7 +100,6 @@ function getAccount (req: express.Request, res: express.Response) {if (account.isOutdated()) {JobQueue.Instance.createJob({ type: 'activitypub-refresher', payload: { type: 'actor', url: account.Actor.url } })- .catch(err => logger.error('Cannot create AP refresher job for actor %s.', account.Actor.url, { err }))}return res.json(account.toFormattedJSON())diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.tsindex ae4e002489..69940f3952 100644--- a/server/controllers/api/config.ts+++ b/server/controllers/api/config.ts@@ -31,12 +31,12 @@ configRouter.get('/',configRouter.get('/custom',authenticate,ensureUserHasRight(UserRight.MANAGE_CONFIGURATION),- asyncMiddleware(getCustomConfig)+ getCustomConfig)configRouter.put('/custom',authenticate,ensureUserHasRight(UserRight.MANAGE_CONFIGURATION),- asyncMiddleware(customConfigUpdateValidator),+ customConfigUpdateValidator,asyncMiddleware(updateCustomConfig))configRouter.delete('/custom',@@ -196,7 +196,7 @@ function getAbout (req: express.Request, res: express.Response) {return res.json(about).end()}-async function getCustomConfig (req: express.Request, res: express.Response) {+function getCustomConfig (req: express.Request, res: express.Response) {const data = customConfig()return res.json(data).end()@@ -250,7 +250,7 @@ function getRegisteredThemes () {function getEnabledResolutions () {return Object.keys(CONFIG.TRANSCODING.RESOLUTIONS)- .filter(key => CONFIG.TRANSCODING.ENABLED && CONFIG.TRANSCODING.RESOLUTIONS[ key ] === true)+ .filter(key => CONFIG.TRANSCODING.ENABLED && CONFIG.TRANSCODING.RESOLUTIONS[key] === true).map(r => parseInt(r, 10))}@@ -340,13 +340,13 @@ function customConfig (): CustomConfig {allowAudioFiles: CONFIG.TRANSCODING.ALLOW_AUDIO_FILES,threads: CONFIG.TRANSCODING.THREADS,resolutions: {- '0p': CONFIG.TRANSCODING.RESOLUTIONS[ '0p' ],- '240p': CONFIG.TRANSCODING.RESOLUTIONS[ '240p' ],- '360p': CONFIG.TRANSCODING.RESOLUTIONS[ '360p' ],- '480p': CONFIG.TRANSCODING.RESOLUTIONS[ '480p' ],- '720p': CONFIG.TRANSCODING.RESOLUTIONS[ '720p' ],- '1080p': CONFIG.TRANSCODING.RESOLUTIONS[ '1080p' ],- '2160p': CONFIG.TRANSCODING.RESOLUTIONS[ '2160p' ]+ '0p': CONFIG.TRANSCODING.RESOLUTIONS['0p'],+ '240p': CONFIG.TRANSCODING.RESOLUTIONS['240p'],+ '360p': CONFIG.TRANSCODING.RESOLUTIONS['360p'],+ '480p': CONFIG.TRANSCODING.RESOLUTIONS['480p'],+ '720p': CONFIG.TRANSCODING.RESOLUTIONS['720p'],+ '1080p': CONFIG.TRANSCODING.RESOLUTIONS['1080p'],+ '2160p': CONFIG.TRANSCODING.RESOLUTIONS['2160p']},webtorrent: {enabled: CONFIG.TRANSCODING.WEBTORRENT.ENABLEDdiff --git a/server/controllers/api/jobs.ts b/server/controllers/api/jobs.tsindex 05320311e9..13fc04d187 100644--- a/server/controllers/api/jobs.ts+++ b/server/controllers/api/jobs.ts@@ -50,7 +50,7 @@ async function listJobs (req: express.Request, res: express.Response) {})const total = await JobQueue.Instance.count(state)- const result: ResultList<any> = {+ const result: ResultList<Job> = {total,data: jobs.map(j => formatJob(j, state))}diff --git a/server/controllers/api/overviews.ts b/server/controllers/api/overviews.tsindex 46e76ac6b8..75f3baedbd 100644--- a/server/controllers/api/overviews.ts+++ b/server/controllers/api/overviews.ts@@ -24,7 +24,7 @@ export { overviewsRouter }const buildSamples = memoizee(async function () {const [ categories, channels, tags ] = await Promise.all([VideoModel.getRandomFieldSamples('category', OVERVIEWS.VIDEOS.SAMPLE_THRESHOLD, OVERVIEWS.VIDEOS.SAMPLES_COUNT),- VideoModel.getRandomFieldSamples('channelId', OVERVIEWS.VIDEOS.SAMPLE_THRESHOLD ,OVERVIEWS.VIDEOS.SAMPLES_COUNT),+ VideoModel.getRandomFieldSamples('channelId', OVERVIEWS.VIDEOS.SAMPLE_THRESHOLD, OVERVIEWS.VIDEOS.SAMPLES_COUNT),TagModel.getRandomSamples(OVERVIEWS.VIDEOS.SAMPLE_THRESHOLD, OVERVIEWS.VIDEOS.SAMPLES_COUNT)])diff --git a/server/controllers/api/server/debug.ts b/server/controllers/api/server/debug.tsindex 4450038f6a..e12fc1dd43 100644--- a/server/controllers/api/server/debug.ts+++ b/server/controllers/api/server/debug.ts@@ -1,13 +1,13 @@import * as express from 'express'import { UserRight } from '../../../../shared/models/users'-import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../../middlewares'+import { authenticate, ensureUserHasRight } from '../../../middlewares'const debugRouter = express.Router()debugRouter.get('/debug',authenticate,ensureUserHasRight(UserRight.MANAGE_DEBUG),- asyncMiddleware(getDebug)+ getDebug)// ---------------------------------------------------------------------------@@ -18,7 +18,7 @@ export {// ----------------------------------------------------------------------------async function getDebug (req: express.Request, res: express.Response) {+function getDebug (req: express.Request, res: express.Response) {return res.json({ip: req.ip}).end()diff --git a/server/controllers/api/server/follows.ts b/server/controllers/api/server/follows.tsindex c69de21fbf..0bc20bd605 100644--- a/server/controllers/api/server/follows.ts+++ b/server/controllers/api/server/follows.ts@@ -135,7 +135,6 @@ async function followInstance (req: express.Request, res: express.Response) {}JobQueue.Instance.createJob({ type: 'activitypub-follow', payload })- .catch(err => logger.error('Cannot create follow job for %s.', host, err))}return res.status(204).end()diff --git a/server/controllers/api/server/logs.ts b/server/controllers/api/server/logs.tsindex cd1e0f5bf0..4b543d686e 100644--- a/server/controllers/api/server/logs.ts+++ b/server/controllers/api/server/logs.ts@@ -59,9 +59,9 @@ async function getLogs (req: express.Request, res: express.Response) {}async function generateOutput (options: {- startDateQuery: string,- endDateQuery?: string,- level: LogLevel,+ startDateQuery: string+ endDateQuery?: string+ level: LogLevelnameFilter: RegExp}) {const { startDateQuery, level, nameFilter } = options@@ -111,7 +111,7 @@ async function getOutputFromFile (path: string, startDate: Date, endDate: Date,const output: any[] = []for (let i = lines.length - 1; i >= 0; i--) {- const line = lines[ i ]+ const line = lines[i]let log: anytry {@@ -122,7 +122,7 @@ async function getOutputFromFile (path: string, startDate: Date, endDate: Date,}logTime = new Date(log.timestamp).getTime()- if (logTime >= startTime && logTime <= endTime && logsLevel[ log.level ] >= logsLevel[ level ]) {+ if (logTime >= startTime && logTime <= endTime && logsLevel[log.level] >= logsLevel[level]) {output.push(log)currentSize += line.lengthdiff --git a/server/controllers/api/server/redundancy.ts b/server/controllers/api/server/redundancy.tsindex a11c1a74fc..1ced0759e9 100644--- a/server/controllers/api/server/redundancy.ts+++ b/server/controllers/api/server/redundancy.ts@@ -84,7 +84,7 @@ async function addVideoRedundancy (req: express.Request, res: express.Response)videoId: res.locals.onlyVideo.id}- await JobQueue.Instance.createJob({+ await JobQueue.Instance.createJobWithPromise({type: 'video-redundancy',payload})diff --git a/server/controllers/api/users/me.ts b/server/controllers/api/users/me.tsindex ac7c62aab7..23890e20ce 100644--- a/server/controllers/api/users/me.ts+++ b/server/controllers/api/users/me.ts@@ -39,7 +39,7 @@ meRouter.get('/me',)meRouter.delete('/me',authenticate,- asyncMiddleware(deleteMeValidator),+ deleteMeValidator,asyncMiddleware(deleteMe))@@ -214,7 +214,7 @@ async function updateMe (req: express.Request, res: express.Response) {}async function updateMyAvatar (req: express.Request, res: express.Response) {- const avatarPhysicalFile = req.files[ 'avatarfile' ][ 0 ]+ const avatarPhysicalFile = req.files['avatarfile'][0]const user = res.locals.oauth.token.userconst userAccount = await AccountModel.load(user.Account.id)diff --git a/server/controllers/api/users/my-subscriptions.ts b/server/controllers/api/users/my-subscriptions.tsindex 43c4c37d84..888392b8b3 100644--- a/server/controllers/api/users/my-subscriptions.ts+++ b/server/controllers/api/users/my-subscriptions.ts@@ -19,7 +19,6 @@ import { buildNSFWFilter, getCountVideos } from '../../../helpers/express-utils'import { VideoFilter } from '../../../../shared/models/videos/video-query.type'import { ActorFollowModel } from '../../../models/activitypub/actor-follow'import { JobQueue } from '../../../lib/job-queue'-import { logger } from '../../../helpers/logger'import { sequelizeTypescript } from '../../../initializers/database'const mySubscriptionsRouter = express.Router()@@ -52,7 +51,7 @@ mySubscriptionsRouter.get('/me/subscriptions',mySubscriptionsRouter.post('/me/subscriptions',authenticate,userSubscriptionAddValidator,- asyncMiddleware(addUserSubscription)+ addUserSubscription)mySubscriptionsRouter.get('/me/subscriptions/:uri',@@ -106,7 +105,7 @@ async function areSubscriptionsExist (req: express.Request, res: express.Responsreturn res.json(existObject)}-async function addUserSubscription (req: express.Request, res: express.Response) {+function addUserSubscription (req: express.Request, res: express.Response) {const user = res.locals.oauth.token.Userconst [ name, host ] = req.body.uri.split('@')@@ -117,7 +116,6 @@ async function addUserSubscription (req: express.Request, res: express.Response)}JobQueue.Instance.createJob({ type: 'activitypub-follow', payload })- .catch(err => logger.error('Cannot create follow job for subscription %s.', req.body.uri, err))return res.status(204).end()}diff --git a/server/controllers/api/video-channel.ts b/server/controllers/api/video-channel.tsindex e1f37a8fb7..a808896ffd 100644--- a/server/controllers/api/video-channel.ts+++ b/server/controllers/api/video-channel.ts@@ -119,7 +119,7 @@ async function listVideoChannels (req: express.Request, res: express.Response) {}async function updateVideoChannelAvatar (req: express.Request, res: express.Response) {- const avatarPhysicalFile = req.files[ 'avatarfile' ][ 0 ]+ const avatarPhysicalFile = req.files['avatarfile'][0]const videoChannel = res.locals.videoChannelconst oldVideoChannelAuditKeys = new VideoChannelAuditView(videoChannel.toFormattedJSON())@@ -232,7 +232,6 @@ async function getVideoChannel (req: express.Request, res: express.Response) {if (videoChannelWithVideos.isOutdated()) {JobQueue.Instance.createJob({ type: 'activitypub-refresher', payload: { type: 'actor', url: videoChannelWithVideos.Actor.url } })- .catch(err => logger.error('Cannot create AP refresher job for actor %s.', videoChannelWithVideos.Actor.url, { err }))}return res.json(videoChannelWithVideos.toFormattedJSON())diff --git a/server/controllers/api/video-playlist.ts b/server/controllers/api/video-playlist.tsindex d9f0ff9257..b51490bf91 100644--- a/server/controllers/api/video-playlist.ts+++ b/server/controllers/api/video-playlist.ts@@ -144,7 +144,6 @@ function getVideoPlaylist (req: express.Request, res: express.Response) {if (videoPlaylist.isOutdated()) {JobQueue.Instance.createJob({ type: 'activitypub-refresher', payload: { type: 'video-playlist', url: videoPlaylist.url } })- .catch(err => logger.error('Cannot create AP refresher job for playlist %s.', videoPlaylist.url, { err }))}return res.json(videoPlaylist.toFormattedJSON())diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.tsindex 28ced58368..ed223cbc90 100644--- a/server/controllers/api/videos/import.ts+++ b/server/controllers/api/videos/import.ts@@ -88,12 +88,12 @@ async function addTorrentImport (req: express.Request, res: express.Response, toconst buf = await readFile(torrentfile.path)const parsedTorrent = parseTorrent(buf)- videoName = isArray(parsedTorrent.name) ? parsedTorrent.name[ 0 ] : parsedTorrent.name as string+ videoName = isArray(parsedTorrent.name) ? parsedTorrent.name[0] : parsedTorrent.name as string} else {magnetUri = body.magnetUriconst parsed = magnetUtil.decode(magnetUri)- videoName = isArray(parsed.name) ? parsed.name[ 0 ] : parsed.name as string+ videoName = isArray(parsed.name) ? parsed.name[0] : parsed.name as string}const video = buildVideo(res.locals.videoChannel.id, body, { name: videoName })@@ -124,7 +124,7 @@ async function addTorrentImport (req: express.Request, res: express.Response, tovideoImportId: videoImport.id,magnetUri}- await JobQueue.Instance.createJob({ type: 'video-import', payload })+ await JobQueue.Instance.createJobWithPromise({ type: 'video-import', payload })auditLogger.create(getAuditIdFromRes(res), new VideoImportAuditView(videoImport.toFormattedJSON()))@@ -176,7 +176,7 @@ async function addYoutubeDLImport (req: express.Request, res: express.Response)downloadThumbnail: !thumbnailModel,downloadPreview: !previewModel}- await JobQueue.Instance.createJob({ type: 'video-import', payload })+ await JobQueue.Instance.createJobWithPromise({ type: 'video-import', payload })auditLogger.create(getAuditIdFromRes(res), new VideoImportAuditView(videoImport.toFormattedJSON()))@@ -211,7 +211,7 @@ function buildVideo (channelId: number, body: VideoImportCreate, importData: Youasync function processThumbnail (req: express.Request, video: VideoModel) {const thumbnailField = req.files ? req.files['thumbnailfile'] : undefinedif (thumbnailField) {- const thumbnailPhysicalFile = thumbnailField[ 0 ]+ const thumbnailPhysicalFile = thumbnailField[0]return createVideoMiniatureFromExisting(thumbnailPhysicalFile.path, video, ThumbnailType.MINIATURE, false)}@@ -231,12 +231,12 @@ async function processPreview (req: express.Request, video: VideoModel) {}function insertIntoDB (parameters: {- video: MVideoThumbnailAccountDefault,- thumbnailModel: MThumbnail,- previewModel: MThumbnail,- videoChannel: MChannelAccountDefault,- tags: string[],- videoImportAttributes: Partial<MVideoImport>,+ video: MVideoThumbnailAccountDefault+ thumbnailModel: MThumbnail+ previewModel: MThumbnail+ videoChannel: MChannelAccountDefault+ tags: string[]+ videoImportAttributes: Partial<MVideoImport>user: MUser}): Bluebird<MVideoImportFormattable> {const { video, thumbnailModel, previewModel, videoChannel, tags, videoImportAttributes, user } = parametersdiff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.tsindex a593f70766..1d61f84278 100644--- a/server/controllers/api/videos/index.ts+++ b/server/controllers/api/videos/index.ts@@ -12,8 +12,7 @@ import {VIDEO_CATEGORIES,VIDEO_LANGUAGES,VIDEO_LICENCES,- VIDEO_PRIVACIES,- VIDEO_TRANSCODING_FPS+ VIDEO_PRIVACIES} from '../../../initializers/constants'import {changeVideoChannelShare,@@ -308,7 +307,7 @@ async function addVideo (req: express.Request, res: express.Response) {}}- await JobQueue.Instance.createJob({ type: 'video-transcoding', payload: dataInput })+ await JobQueue.Instance.createJobWithPromise({ type: 'video-transcoding', payload: dataInput })}Hooks.runAction('action:api.video.uploaded', { video: videoCreated })@@ -453,7 +452,6 @@ async function getVideo (req: express.Request, res: express.Response) {if (video.isOutdated()) {JobQueue.Instance.createJob({ type: 'activitypub-refresher', payload: { type: 'video', url: video.url } })- .catch(err => logger.error('Cannot create AP refresher job for video %s.', video.url, { err }))}return res.json(video.toFormattedDetailsJSON())diff --git a/server/controllers/client.ts b/server/controllers/client.tsindex dc3ff18fc7..e4643e1711 100644--- a/server/controllers/client.ts+++ b/server/controllers/client.ts@@ -66,7 +66,7 @@ export {// ----------------------------------------------------------------------------async function serveServerTranslations (req: express.Request, res: express.Response) {+function serveServerTranslations (req: express.Request, res: express.Response) {const locale = req.params.localeconst file = req.params.filediff --git a/server/controllers/static.ts b/server/controllers/static.tsindex a4bb3a4d96..4c6cf95971 100644--- a/server/controllers/static.ts+++ b/server/controllers/static.ts@@ -45,12 +45,12 @@ staticRouter.use(staticRouter.use(STATIC_DOWNLOAD_PATHS.TORRENTS + ':id-:resolution([0-9]+).torrent',asyncMiddleware(videosDownloadValidator),- asyncMiddleware(downloadTorrent)+ downloadTorrent)staticRouter.use(STATIC_DOWNLOAD_PATHS.TORRENTS + ':id-:resolution([0-9]+)-hls.torrent',asyncMiddleware(videosDownloadValidator),- asyncMiddleware(downloadHLSVideoFileTorrent)+ downloadHLSVideoFileTorrent)// Videos path for webseeding@@ -68,13 +68,13 @@ staticRouter.use(staticRouter.use(STATIC_DOWNLOAD_PATHS.VIDEOS + ':id-:resolution([0-9]+).:extension',asyncMiddleware(videosDownloadValidator),- asyncMiddleware(downloadVideoFile)+ downloadVideoFile)staticRouter.use(STATIC_DOWNLOAD_PATHS.HLS_VIDEOS + ':id-:resolution([0-9]+)-fragmented.:extension',asyncMiddleware(videosDownloadValidator),- asyncMiddleware(downloadHLSVideoFile)+ downloadHLSVideoFile)// HLS@@ -325,7 +325,7 @@ async function generateNodeinfo (req: express.Request, res: express.Response) {return res.send(json).end()}-async function downloadTorrent (req: express.Request, res: express.Response) {+function downloadTorrent (req: express.Request, res: express.Response) {const video = res.locals.videoAllconst videoFile = getVideoFile(req, video.VideoFiles)@@ -334,7 +334,7 @@ async function downloadTorrent (req: express.Request, res: express.Response) {return res.download(getTorrentFilePath(video, videoFile), `${video.name}-${videoFile.resolution}p.torrent`)}-async function downloadHLSVideoFileTorrent (req: express.Request, res: express.Response) {+function downloadHLSVideoFileTorrent (req: express.Request, res: express.Response) {const video = res.locals.videoAllconst playlist = getHLSPlaylist(video)@@ -346,7 +346,7 @@ async function downloadHLSVideoFileTorrent (req: express.Request, res: express.Rreturn res.download(getTorrentFilePath(playlist, videoFile), `${video.name}-${videoFile.resolution}p-hls.torrent`)}-async function downloadVideoFile (req: express.Request, res: express.Response) {+function downloadVideoFile (req: express.Request, res: express.Response) {const video = res.locals.videoAllconst videoFile = getVideoFile(req, video.VideoFiles)@@ -355,7 +355,7 @@ async function downloadVideoFile (req: express.Request, res: express.Response) {return res.download(getVideoFilePath(video, videoFile), `${video.name}-${videoFile.resolution}p${videoFile.extname}`)}-async function downloadHLSVideoFile (req: express.Request, res: express.Response) {+function downloadHLSVideoFile (req: express.Request, res: express.Response) {const video = res.locals.videoAllconst playlist = getHLSPlaylist(video)if (!playlist) return res.status(404).enddiff --git a/server/controllers/tracker.ts b/server/controllers/tracker.tsindex 2ae1cf86c5..e9c8a13da2 100644--- a/server/controllers/tracker.ts+++ b/server/controllers/tracker.ts@@ -6,7 +6,6 @@ import * as proxyAddr from 'proxy-addr'import { Server as WebSocketServer } from 'ws'import { TRACKER_RATE_LIMITS } from '../initializers/constants'import { VideoFileModel } from '../models/video/video-file'-import { parse } from 'url'import { VideoStreamingPlaylistModel } from '../models/video/video-streaming-playlist'import { CONFIG } from '../initializers/config'@@ -38,11 +37,11 @@ const trackerServer = new TrackerServer({const key = ip + '-' + infoHash- peersIps[ ip ] = peersIps[ ip ] ? peersIps[ ip ] + 1 : 1- peersIpInfoHash[ key ] = peersIpInfoHash[ key ] ? peersIpInfoHash[ key ] + 1 : 1+ peersIps[ip] = peersIps[ip] ? peersIps[ip] + 1 : 1+ peersIpInfoHash[key] = peersIpInfoHash[key] ? peersIpInfoHash[key] + 1 : 1- if (CONFIG.TRACKER.REJECT_TOO_MANY_ANNOUNCES && peersIpInfoHash[ key ] > TRACKER_RATE_LIMITS.ANNOUNCES_PER_IP_PER_INFOHASH) {- return cb(new Error(`Too many requests (${peersIpInfoHash[ key ]} of ip ${ip} for torrent ${infoHash}`))+ if (CONFIG.TRACKER.REJECT_TOO_MANY_ANNOUNCES && peersIpInfoHash[key] > TRACKER_RATE_LIMITS.ANNOUNCES_PER_IP_PER_INFOHASH) {+ return cb(new Error(`Too many requests (${peersIpInfoHash[key]} of ip ${ip} for torrent ${infoHash}`))}try {@@ -87,10 +86,8 @@ function createWebsocketTrackerServer (app: express.Application) {trackerServer.onWebSocketConnection(ws)})- server.on('upgrade', (request, socket, head) => {- const pathname = parse(request.url).pathname-- if (pathname === '/tracker/socket') {+ server.on('upgrade', (request: express.Request, socket, head) => {+ if (request.path === '/tracker/socket') {wss.handleUpgrade(request, socket, head, ws => wss.emit('connection', ws, request))}diff --git a/server/helpers/activitypub.ts b/server/helpers/activitypub.tsindex 9f9e8fba79..22f8550caf 100644--- a/server/helpers/activitypub.ts+++ b/server/helpers/activitypub.ts@@ -5,7 +5,7 @@ import { Activity } from '../../shared/models/activitypub'import { ACTIVITY_PUB, REMOTE_SCHEME } from '../initializers/constants'import { signJsonLDObject } from './peertube-crypto'import { pageToStartAndCount } from './core-utils'-import { parse } from 'url'+import { URL } from 'url'import { MActor, MVideoAccountLight } from '../typings/models'function activityPubContextify <T> (data: T) {@@ -161,8 +161,8 @@ function getAPId (activity: string | { id: string }) {}function checkUrlsSameHost (url1: string, url2: string) {- const idHost = parse(url1).host- const actorHost = parse(url2).host+ const idHost = new URL(url1).host+ const actorHost = new URL(url2).hostreturn idHost && actorHost && idHost.toLowerCase() === actorHost.toLowerCase()}diff --git a/server/helpers/audit-logger.ts b/server/helpers/audit-logger.tsindex 9b258dc3ae..a4cfeef76c 100644--- a/server/helpers/audit-logger.ts+++ b/server/helpers/audit-logger.ts@@ -81,7 +81,8 @@ function auditLoggerFactory (domain: string) {}abstract class EntityAuditView {- constructor (private keysToKeep: Array<string>, private prefix: string, private entityInfos: object) { }+ constructor (private readonly keysToKeep: string[], private readonly prefix: string, private readonly entityInfos: object) { }+toLogKeys (): object {return chain(flatten(this.entityInfos, { delimiter: '-', safe: true })).pick(this.keysToKeep)@@ -121,7 +122,7 @@ const videoKeysToKeep = ['downloadEnabled']class VideoAuditView extends EntityAuditView {- constructor (private video: VideoDetails) {+ constructor (private readonly video: VideoDetails) {super(videoKeysToKeep, 'video', video)}}@@ -132,7 +133,7 @@ const videoImportKeysToKeep = ['video-name']class VideoImportAuditView extends EntityAuditView {- constructor (private videoImport: VideoImport) {+ constructor (private readonly videoImport: VideoImport) {super(videoImportKeysToKeep, 'video-import', videoImport)}}@@ -151,7 +152,7 @@ const commentKeysToKeep = ['account-name']class CommentAuditView extends EntityAuditView {- constructor (private comment: VideoComment) {+ constructor (private readonly comment: VideoComment) {super(commentKeysToKeep, 'comment', comment)}}@@ -180,7 +181,7 @@ const userKeysToKeep = ['videoChannels']class UserAuditView extends EntityAuditView {- constructor (private user: User) {+ constructor (private readonly user: User) {super(userKeysToKeep, 'user', user)}}@@ -206,7 +207,7 @@ const channelKeysToKeep = ['ownerAccount-displayedName']class VideoChannelAuditView extends EntityAuditView {- constructor (private channel: VideoChannel) {+ constructor (private readonly channel: VideoChannel) {super(channelKeysToKeep, 'channel', channel)}}@@ -221,7 +222,7 @@ const videoAbuseKeysToKeep = ['createdAt']class VideoAbuseAuditView extends EntityAuditView {- constructor (private videoAbuse: VideoAbuse) {+ constructor (private readonly videoAbuse: VideoAbuse) {super(videoAbuseKeysToKeep, 'abuse', videoAbuse)}}@@ -253,9 +254,12 @@ class CustomConfigAuditView extends EntityAuditView {const infos: any = customConfigconst resolutionsDict = infos.transcoding.resolutionsconst resolutionsArray = []- Object.entries(resolutionsDict).forEach(([resolution, isEnabled]) => {- if (isEnabled) resolutionsArray.push(resolution)- })++ Object.entries(resolutionsDict)+ .forEach(([ resolution, isEnabled ]) => {+ if (isEnabled) resolutionsArray.push(resolution)+ })+Object.assign({}, infos, { transcoding: { resolutions: resolutionsArray } })super(customConfigKeysToKeep, 'config', infos)}diff --git a/server/helpers/core-utils.ts b/server/helpers/core-utils.tsindex 7e8252aa40..2cecea4500 100644--- a/server/helpers/core-utils.ts+++ b/server/helpers/core-utils.ts@@ -1,9 +1,11 @@+/* eslint-disable no-useless-call */+/*Different from 'utils' because we don't not import other PeerTube modules.Useful to avoid circular dependencies.*/-import { createHash, HexBase64Latin1Encoding, pseudoRandomBytes } from 'crypto'+import { createHash, HexBase64Latin1Encoding, randomBytes } from 'crypto'import { basename, isAbsolute, join, resolve } from 'path'import * as pem from 'pem'import { URL } from 'url'@@ -22,31 +24,31 @@ const objectConverter = (oldObject: any, keyConverter: (e: string) => string, vaconst newObject = {}Object.keys(oldObject).forEach(oldKey => {const newKey = keyConverter(oldKey)- newObject[ newKey ] = objectConverter(oldObject[ oldKey ], keyConverter, valueConverter)+ newObject[newKey] = objectConverter(oldObject[oldKey], keyConverter, valueConverter)})return newObject}const timeTable = {- ms: 1,- second: 1000,- minute: 60000,- hour: 3600000,- day: 3600000 * 24,- week: 3600000 * 24 * 7,- month: 3600000 * 24 * 30+ ms: 1,+ second: 1000,+ minute: 60000,+ hour: 3600000,+ day: 3600000 * 24,+ week: 3600000 * 24 * 7,+ month: 3600000 * 24 * 30}export function parseDurationToMs (duration: number | string): number {if (typeof duration === 'number') return durationif (typeof duration === 'string') {- const split = duration.match(/^([\d\.,]+)\s?(\w+)$/)+ const split = duration.match(/^([\d.,]+)\s?(\w+)$/)if (split.length === 3) {const len = parseFloat(split[1])- let unit = split[2].replace(/s$/i,'').toLowerCase()+ let unit = split[2].replace(/s$/i, '').toLowerCase()if (unit === 'm') {unit = 'ms'}@@ -73,21 +75,21 @@ export function parseBytes (value: string | number): number {if (value.match(tgm)) {match = value.match(tgm)- return parseInt(match[1], 10) * 1024 * 1024 * 1024 * 1024- + parseInt(match[2], 10) * 1024 * 1024 * 1024- + parseInt(match[3], 10) * 1024 * 1024+ return parseInt(match[1], 10) * 1024 * 1024 * 1024 * 1024 ++ parseInt(match[2], 10) * 1024 * 1024 * 1024 ++ parseInt(match[3], 10) * 1024 * 1024} else if (value.match(tg)) {match = value.match(tg)- return parseInt(match[1], 10) * 1024 * 1024 * 1024 * 1024- + parseInt(match[2], 10) * 1024 * 1024 * 1024+ return parseInt(match[1], 10) * 1024 * 1024 * 1024 * 1024 ++ parseInt(match[2], 10) * 1024 * 1024 * 1024} else if (value.match(tm)) {match = value.match(tm)- return parseInt(match[1], 10) * 1024 * 1024 * 1024 * 1024- + parseInt(match[2], 10) * 1024 * 1024+ return parseInt(match[1], 10) * 1024 * 1024 * 1024 * 1024 ++ parseInt(match[2], 10) * 1024 * 1024} else if (value.match(gm)) {match = value.match(gm)- return parseInt(match[1], 10) * 1024 * 1024 * 1024- + parseInt(match[2], 10) * 1024 * 1024+ return parseInt(match[1], 10) * 1024 * 1024 * 1024 ++ parseInt(match[2], 10) * 1024 * 1024} else if (value.match(t)) {match = value.match(t)return parseInt(match[1], 10) * 1024 * 1024 * 1024 * 1024@@ -137,6 +139,7 @@ function getAppNumber () {}let rootPath: string+function root () {if (rootPath) return rootPath@@ -163,7 +166,7 @@ function escapeHTML (stringParam) {'=': '='}- return String(stringParam).replace(/[&<>"'`=\/]/g, s => entityMap[s])+ return String(stringParam).replace(/[&<>"'`=/]/g, s => entityMap[s])}function pageToStartAndCount (page: number, itemsPerPage: number) {@@ -202,6 +205,7 @@ function sha1 (str: string | Buffer, encoding: HexBase64Latin1Encoding = 'hex')function execShell (command: string, options?: ExecOptions) {return new Promise<{ err?: Error, stdout: string, stderr: string }>((res, rej) => {exec(command, options, (err, stdout, stderr) => {+ // eslint-disable-next-line prefer-promise-reject-errorsif (err) return rej({ err, stdout, stderr })return res({ stdout, stderr })@@ -226,14 +230,6 @@ function promisify1<T, A> (func: (arg: T, cb: (err: any, result: A) => void) =>}}-function promisify1WithVoid<T> (func: (arg: T, cb: (err: any) => void) => void): (arg: T) => Promise<void> {- return function promisified (arg: T): Promise<void> {- return new Promise<void>((resolve: () => void, reject: (err: any) => void) => {- func.apply(null, [ arg, (err: any) => err ? reject(err) : resolve() ])- })- }-}-function promisify2<T, U, A> (func: (arg1: T, arg2: U, cb: (err: any, result: A) => void) => void): (arg1: T, arg2: U) => Promise<A> {return function promisified (arg1: T, arg2: U): Promise<A> {return new Promise<A>((resolve: (arg: A) => void, reject: (err: any) => void) => {@@ -242,15 +238,7 @@ function promisify2<T, U, A> (func: (arg1: T, arg2: U, cb: (err: any, result: A)}}-function promisify2WithVoid<T, U> (func: (arg1: T, arg2: U, cb: (err: any) => void) => void): (arg1: T, arg2: U) => Promise<void> {- return function promisified (arg1: T, arg2: U): Promise<void> {- return new Promise<void>((resolve: () => void, reject: (err: any) => void) => {- func.apply(null, [ arg1, arg2, (err: any) => err ? reject(err) : resolve() ])- })- }-}--const pseudoRandomBytesPromise = promisify1<number, Buffer>(pseudoRandomBytes)+const randomBytesPromise = promisify1<number, Buffer>(randomBytes)const createPrivateKey = promisify1<number, { key: string }>(pem.createPrivateKey)const getPublicKey = promisify1<string, { publicKey: string }>(pem.getPublicKey)const execPromise2 = promisify2<string, any, string>(exec)@@ -280,7 +268,7 @@ export {promisify1,promisify2,- pseudoRandomBytesPromise,+ randomBytesPromise,createPrivateKey,getPublicKey,execPromise2,diff --git a/server/helpers/custom-jsonld-signature.ts b/server/helpers/custom-jsonld-signature.tsindex a407a9fec1..749c50cb3d 100644--- a/server/helpers/custom-jsonld-signature.ts+++ b/server/helpers/custom-jsonld-signature.ts@@ -5,52 +5,52 @@ import { logger } from './logger'const CACHE = {'https://w3id.org/security/v1': {'@context': {- 'id': '@id',- 'type': '@type',+ id: '@id',+ type: '@type',- 'dc': 'http://purl.org/dc/terms/',- 'sec': 'https://w3id.org/security#',- 'xsd': 'http://www.w3.org/2001/XMLSchema#',+ dc: 'http://purl.org/dc/terms/',+ sec: 'https://w3id.org/security#',+ xsd: 'http://www.w3.org/2001/XMLSchema#',- 'EcdsaKoblitzSignature2016': 'sec:EcdsaKoblitzSignature2016',- 'Ed25519Signature2018': 'sec:Ed25519Signature2018',- 'EncryptedMessage': 'sec:EncryptedMessage',- 'GraphSignature2012': 'sec:GraphSignature2012',- 'LinkedDataSignature2015': 'sec:LinkedDataSignature2015',- 'LinkedDataSignature2016': 'sec:LinkedDataSignature2016',- 'CryptographicKey': 'sec:Key',+ EcdsaKoblitzSignature2016: 'sec:EcdsaKoblitzSignature2016',+ Ed25519Signature2018: 'sec:Ed25519Signature2018',+ EncryptedMessage: 'sec:EncryptedMessage',+ GraphSignature2012: 'sec:GraphSignature2012',+ LinkedDataSignature2015: 'sec:LinkedDataSignature2015',+ LinkedDataSignature2016: 'sec:LinkedDataSignature2016',+ CryptographicKey: 'sec:Key',- 'authenticationTag': 'sec:authenticationTag',- 'canonicalizationAlgorithm': 'sec:canonicalizationAlgorithm',- 'cipherAlgorithm': 'sec:cipherAlgorithm',- 'cipherData': 'sec:cipherData',- 'cipherKey': 'sec:cipherKey',- 'created': { '@id': 'dc:created', '@type': 'xsd:dateTime' },- 'creator': { '@id': 'dc:creator', '@type': '@id' },- 'digestAlgorithm': 'sec:digestAlgorithm',- 'digestValue': 'sec:digestValue',- 'domain': 'sec:domain',- 'encryptionKey': 'sec:encryptionKey',- 'expiration': { '@id': 'sec:expiration', '@type': 'xsd:dateTime' },- 'expires': { '@id': 'sec:expiration', '@type': 'xsd:dateTime' },- 'initializationVector': 'sec:initializationVector',- 'iterationCount': 'sec:iterationCount',- 'nonce': 'sec:nonce',- 'normalizationAlgorithm': 'sec:normalizationAlgorithm',- 'owner': { '@id': 'sec:owner', '@type': '@id' },- 'password': 'sec:password',- 'privateKey': { '@id': 'sec:privateKey', '@type': '@id' },- 'privateKeyPem': 'sec:privateKeyPem',- 'publicKey': { '@id': 'sec:publicKey', '@type': '@id' },- 'publicKeyBase58': 'sec:publicKeyBase58',- 'publicKeyPem': 'sec:publicKeyPem',- 'publicKeyWif': 'sec:publicKeyWif',- 'publicKeyService': { '@id': 'sec:publicKeyService', '@type': '@id' },- 'revoked': { '@id': 'sec:revoked', '@type': 'xsd:dateTime' },- 'salt': 'sec:salt',- 'signature': 'sec:signature',- 'signatureAlgorithm': 'sec:signingAlgorithm',- 'signatureValue': 'sec:signatureValue'+ authenticationTag: 'sec:authenticationTag',+ canonicalizationAlgorithm: 'sec:canonicalizationAlgorithm',+ cipherAlgorithm: 'sec:cipherAlgorithm',+ cipherData: 'sec:cipherData',+ cipherKey: 'sec:cipherKey',+ created: { '@id': 'dc:created', '@type': 'xsd:dateTime' },+ creator: { '@id': 'dc:creator', '@type': '@id' },+ digestAlgorithm: 'sec:digestAlgorithm',+ digestValue: 'sec:digestValue',+ domain: 'sec:domain',+ encryptionKey: 'sec:encryptionKey',+ expiration: { '@id': 'sec:expiration', '@type': 'xsd:dateTime' },+ expires: { '@id': 'sec:expiration', '@type': 'xsd:dateTime' },+ initializationVector: 'sec:initializationVector',+ iterationCount: 'sec:iterationCount',+ nonce: 'sec:nonce',+ normalizationAlgorithm: 'sec:normalizationAlgorithm',+ owner: { '@id': 'sec:owner', '@type': '@id' },+ password: 'sec:password',+ privateKey: { '@id': 'sec:privateKey', '@type': '@id' },+ privateKeyPem: 'sec:privateKeyPem',+ publicKey: { '@id': 'sec:publicKey', '@type': '@id' },+ publicKeyBase58: 'sec:publicKeyBase58',+ publicKeyPem: 'sec:publicKeyPem',+ publicKeyWif: 'sec:publicKeyWif',+ publicKeyService: { '@id': 'sec:publicKeyService', '@type': '@id' },+ revoked: { '@id': 'sec:revoked', '@type': 'xsd:dateTime' },+ salt: 'sec:salt',+ signature: 'sec:signature',+ signatureAlgorithm: 'sec:signingAlgorithm',+ signatureValue: 'sec:signatureValue'}}}@@ -60,12 +60,12 @@ const nodeDocumentLoader = jsonld.documentLoaders.node()const lru = new AsyncLRU({max: 10,load: (url, cb) => {- if (CACHE[ url ] !== undefined) {+ if (CACHE[url] !== undefined) {logger.debug('Using cache for JSON-LD %s.', url)return cb(null, {contextUrl: null,- document: CACHE[ url ],+ document: CACHE[url],documentUrl: url})}diff --git a/server/helpers/custom-validators/activitypub/actor.ts b/server/helpers/custom-validators/activitypub/actor.tsindex fa58e163f7..fec67823d7 100644--- a/server/helpers/custom-validators/activitypub/actor.ts+++ b/server/helpers/custom-validators/activitypub/actor.ts@@ -6,7 +6,7 @@ import { isHostValid } from '../servers'import { peertubeTruncate } from '@server/helpers/core-utils'function isActorEndpointsObjectValid (endpointObject: any) {- if (endpointObject && endpointObject.sharedInbox) {+ if (endpointObject?.sharedInbox) {return isActivityPubUrlValid(endpointObject.sharedInbox)}@@ -101,8 +101,6 @@ function normalizeActor (actor: any) {actor.summary = null}}-- return}function isValidActorHandle (handle: string) {diff --git a/server/helpers/custom-validators/activitypub/video-comments.ts b/server/helpers/custom-validators/activitypub/video-comments.tsindex aa3c246b5f..ea852c4910 100644--- a/server/helpers/custom-validators/activitypub/video-comments.ts+++ b/server/helpers/custom-validators/activitypub/video-comments.ts@@ -48,8 +48,6 @@ function normalizeComment (comment: any) {if (typeof comment.url === 'object') comment.url = comment.url.href || comment.url.urlelse comment.url = comment.id}-- return}function isCommentTypeValid (comment: any): boolean {diff --git a/server/helpers/custom-validators/misc.ts b/server/helpers/custom-validators/misc.tsindex 89149b3e0a..cf32201c41 100644--- a/server/helpers/custom-validators/misc.ts+++ b/server/helpers/custom-validators/misc.ts@@ -94,13 +94,13 @@ function isFileValid (if (isArray(files)) return optional// Should have a file- const fileArray = files[ field ]+ const fileArray = files[field]if (!fileArray || fileArray.length === 0) {return optional}// The file should exist- const file = fileArray[ 0 ]+ const file = fileArray[0]if (!file || !file.originalname) return false// Check sizediff --git a/server/helpers/custom-validators/plugins.ts b/server/helpers/custom-validators/plugins.tsindex 3af72547b3..5a4531f72e 100644--- a/server/helpers/custom-validators/plugins.ts+++ b/server/helpers/custom-validators/plugins.ts@@ -14,7 +14,7 @@ function isPluginTypeValid (value: any) {function isPluginNameValid (value: string) {return exists(value) &&validator.isLength(value, PLUGINS_CONSTRAINTS_FIELDS.NAME) &&- validator.matches(value, /^[a-z\-]+$/)+ validator.matches(value, /^[a-z-]+$/)}function isNpmPluginNameValid (value: string) {@@ -146,8 +146,8 @@ function isPackageJSONValid (packageJSON: PluginPackageJson, pluginType: PluginT}function isLibraryCodeValid (library: any) {- return typeof library.register === 'function'- && typeof library.unregister === 'function'+ return typeof library.register === 'function' &&+ typeof library.unregister === 'function'}export {diff --git a/server/helpers/custom-validators/user-notifications.ts b/server/helpers/custom-validators/user-notifications.tsindex 5a4d10504e..8a33b895bc 100644--- a/server/helpers/custom-validators/user-notifications.ts+++ b/server/helpers/custom-validators/user-notifications.ts@@ -9,7 +9,8 @@ function isUserNotificationTypeValid (value: any) {function isUserNotificationSettingValid (value: any) {return exists(value) &&- validator.isInt('' + value) && (+ validator.isInt('' + value) &&+ (value === UserNotificationSettingValue.NONE ||value === UserNotificationSettingValue.WEB ||value === UserNotificationSettingValue.EMAIL ||diff --git a/server/helpers/custom-validators/video-abuses.ts b/server/helpers/custom-validators/video-abuses.tsindex a9478c76ac..5c7bc6fd93 100644--- a/server/helpers/custom-validators/video-abuses.ts+++ b/server/helpers/custom-validators/video-abuses.ts@@ -1,8 +1,6 @@-import { Response } from 'express'import validator from 'validator'import { CONSTRAINTS_FIELDS, VIDEO_ABUSE_STATES } from '../../initializers/constants'import { exists } from './misc'-import { VideoAbuseModel } from '../../models/video/video-abuse'const VIDEO_ABUSES_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_ABUSES@@ -15,7 +13,7 @@ function isVideoAbuseModerationCommentValid (value: string) {}function isVideoAbuseStateValid (value: string) {- return exists(value) && VIDEO_ABUSE_STATES[ value ] !== undefined+ return exists(value) && VIDEO_ABUSE_STATES[value] !== undefined}// ---------------------------------------------------------------------------diff --git a/server/helpers/custom-validators/video-captions.ts b/server/helpers/custom-validators/video-captions.tsindex d06eb36952..9abbce04a1 100644--- a/server/helpers/custom-validators/video-captions.ts+++ b/server/helpers/custom-validators/video-captions.ts@@ -2,7 +2,7 @@ import { CONSTRAINTS_FIELDS, MIMETYPES, VIDEO_LANGUAGES } from '../../initializeimport { exists, isFileValid } from './misc'function isVideoCaptionLanguageValid (value: any) {- return exists(value) && VIDEO_LANGUAGES[ value ] !== undefined+ return exists(value) && VIDEO_LANGUAGES[value] !== undefined}const videoCaptionTypes = Object.keys(MIMETYPES.VIDEO_CAPTIONS.MIMETYPE_EXT)diff --git a/server/helpers/custom-validators/video-imports.ts b/server/helpers/custom-validators/video-imports.tsindex ffad482b47..c571f5dddc 100644--- a/server/helpers/custom-validators/video-imports.ts+++ b/server/helpers/custom-validators/video-imports.ts@@ -20,7 +20,7 @@ function isVideoImportTargetUrlValid (url: string) {}function isVideoImportStateValid (value: any) {- return exists(value) && VIDEO_IMPORT_STATES[ value ] !== undefined+ return exists(value) && VIDEO_IMPORT_STATES[value] !== undefined}const videoTorrentImportTypes = Object.keys(MIMETYPES.TORRENT.MIMETYPE_EXT).map(m => `(${m})`)diff --git a/server/helpers/custom-validators/video-playlists.ts b/server/helpers/custom-validators/video-playlists.tsindex 4bb8384ab1..180018fc54 100644--- a/server/helpers/custom-validators/video-playlists.ts+++ b/server/helpers/custom-validators/video-playlists.ts@@ -1,8 +1,6 @@import { exists } from './misc'import validator from 'validator'import { CONSTRAINTS_FIELDS, VIDEO_PLAYLIST_PRIVACIES, VIDEO_PLAYLIST_TYPES } from '../../initializers/constants'-import * as express from 'express'-import { VideoPlaylistModel } from '../../models/video/video-playlist'const PLAYLISTS_CONSTRAINT_FIELDS = CONSTRAINTS_FIELDS.VIDEO_PLAYLISTS@@ -15,7 +13,7 @@ function isVideoPlaylistDescriptionValid (value: any) {}function isVideoPlaylistPrivacyValid (value: number) {- return validator.isInt(value + '') && VIDEO_PLAYLIST_PRIVACIES[ value ] !== undefined+ return validator.isInt(value + '') && VIDEO_PLAYLIST_PRIVACIES[value] !== undefined}function isVideoPlaylistTimestampValid (value: any) {@@ -23,7 +21,7 @@ function isVideoPlaylistTimestampValid (value: any) {}function isVideoPlaylistTypeValid (value: any) {- return exists(value) && VIDEO_PLAYLIST_TYPES[ value ] !== undefined+ return exists(value) && VIDEO_PLAYLIST_TYPES[value] !== undefined}// ---------------------------------------------------------------------------diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.tsindex a9e859e54a..cfb430c638 100644--- a/server/helpers/custom-validators/videos.ts+++ b/server/helpers/custom-validators/videos.ts@@ -20,15 +20,15 @@ function isVideoFilterValid (filter: VideoFilter) {}function isVideoCategoryValid (value: any) {- return value === null || VIDEO_CATEGORIES[ value ] !== undefined+ return value === null || VIDEO_CATEGORIES[value] !== undefined}function isVideoStateValid (value: any) {- return exists(value) && VIDEO_STATES[ value ] !== undefined+ return exists(value) && VIDEO_STATES[value] !== undefined}function isVideoLicenceValid (value: any) {- return value === null || VIDEO_LICENCES[ value ] !== undefined+ return value === null || VIDEO_LICENCES[value] !== undefined}function isVideoLanguageValid (value: any) {@@ -98,7 +98,7 @@ function isVideoImage (files: { [ fieldname: string ]: Express.Multer.File[] } |}function isVideoPrivacyValid (value: number) {- return VIDEO_PRIVACIES[ value ] !== undefined+ return VIDEO_PRIVACIES[value] !== undefined}function isScheduleVideoUpdatePrivacyValid (value: number) {diff --git a/server/helpers/express-utils.ts b/server/helpers/express-utils.tsindex 9bf6d85a87..f468129774 100644--- a/server/helpers/express-utils.ts+++ b/server/helpers/express-utils.ts@@ -12,7 +12,7 @@ function buildNSFWFilter (res?: express.Response, paramNSFW?: string) {if (paramNSFW === 'false') return falseif (paramNSFW === 'both') return undefined- if (res && res.locals.oauth) {+ if (res?.locals.oauth) {const user = res.locals.oauth.token.User// User does not want NSFW videos@@ -28,7 +28,7 @@ function buildNSFWFilter (res?: express.Response, paramNSFW?: string) {return null}-function cleanUpReqFiles (req: { files: { [ fieldname: string ]: Express.Multer.File[] } | Express.Multer.File[] }) {+function cleanUpReqFiles (req: { files: { [fieldname: string]: Express.Multer.File[] } | Express.Multer.File[] }) {const files = req.filesif (!files) return@@ -39,7 +39,7 @@ function cleanUpReqFiles (req: { files: { [ fieldname: string ]: Express.Multer.}for (const key of Object.keys(files)) {- const file = files[ key ]+ const file = files[key]if (isArray(file)) file.forEach(f => deleteFileAsync(f.path))else deleteFileAsync(file.path)@@ -65,18 +65,18 @@ function badRequest (req: express.Request, res: express.Response) {function createReqFiles (fieldNames: string[],- mimeTypes: { [ id: string ]: string },- destinations: { [ fieldName: string ]: string }+ mimeTypes: { [id: string]: string },+ destinations: { [fieldName: string]: string }) {const storage = multer.diskStorage({destination: (req, file, cb) => {- cb(null, destinations[ file.fieldname ])+ cb(null, destinations[file.fieldname])},filename: async (req, file, cb) => {let extension: stringconst fileExtension = extname(file.originalname)- const extensionFromMimetype = mimeTypes[ file.mimetype ]+ const extensionFromMimetype = mimeTypes[file.mimetype]// Take the file extension if we don't understand the mime type// We have the OGG/OGV exception too because firefox sends a bad mime type when sending an OGG file@@ -99,7 +99,7 @@ function createReqFiles (}})- let fields: { name: string, maxCount: number }[] = []+ const fields: { name: string, maxCount: number }[] = []for (const fieldName of fieldNames) {fields.push({name: fieldName,diff --git a/server/helpers/ffmpeg-utils.ts b/server/helpers/ffmpeg-utils.tsindex 7022d3e037..084516e553 100644--- a/server/helpers/ffmpeg-utils.ts+++ b/server/helpers/ffmpeg-utils.ts@@ -1,6 +1,6 @@import * as ffmpeg from 'fluent-ffmpeg'import { dirname, join } from 'path'-import { getTargetBitrate, getMaxBitrate, VideoResolution } from '../../shared/models/videos'+import { getMaxBitrate, getTargetBitrate, VideoResolution } from '../../shared/models/videos'import { FFMPEG_NICE, VIDEO_TRANSCODING_FPS } from '../initializers/constants'import { processImage } from './image-utils'import { logger } from './logger'@@ -8,6 +8,71 @@ import { checkFFmpegEncoders } from '../initializers/checker-before-init'import { readFile, remove, writeFile } from 'fs-extra'import { CONFIG } from '../initializers/config'+/**+ * A toolbox to play with audio+ */+namespace audio {+ export const get = (videoPath: string) => {+ // without position, ffprobe considers the last input only+ // we make it consider the first input only+ // if you pass a file path to pos, then ffprobe acts on that file directly+ return new Promise<{ absolutePath: string, audioStream?: any }>((res, rej) => {++ function parseFfprobe (err: any, data: ffmpeg.FfprobeData) {+ if (err) return rej(err)++ if ('streams' in data) {+ const audioStream = data.streams.find(stream => stream['codec_type'] === 'audio')+ if (audioStream) {+ return res({+ absolutePath: data.format.filename,+ audioStream+ })+ }+ }++ return res({ absolutePath: data.format.filename })+ }++ return ffmpeg.ffprobe(videoPath, parseFfprobe)+ })+ }++ export namespace bitrate {+ const baseKbitrate = 384++ const toBits = (kbits: number) => kbits * 8000++ export const aac = (bitrate: number): number => {+ switch (true) {+ case bitrate > toBits(baseKbitrate):+ return baseKbitrate++ default:+ return -1 // we interpret it as a signal to copy the audio stream as is+ }+ }++ export const mp3 = (bitrate: number): number => {+ /*+ a 192kbit/sec mp3 doesn't hold as much information as a 192kbit/sec aac.+ That's why, when using aac, we can go to lower kbit/sec. The equivalences+ made here are not made to be accurate, especially with good mp3 encoders.+ */+ switch (true) {+ case bitrate <= toBits(192):+ return 128++ case bitrate <= toBits(384):+ return 256++ default:+ return baseKbitrate+ }+ }+ }+}+function computeResolutionsToTranscode (videoFileHeight: number) {const resolutionsEnabled: number[] = []const configResolutions = CONFIG.TRANSCODING.RESOLUTIONS@@ -24,7 +89,7 @@ function computeResolutionsToTranscode (videoFileHeight: number) {]for (const resolution of resolutions) {- if (configResolutions[ resolution + 'p' ] === true && videoFileHeight > resolution) {+ if (configResolutions[resolution + 'p'] === true && videoFileHeight > resolution) {resolutionsEnabled.push(resolution)}}@@ -48,9 +113,9 @@ async function getVideoStreamCodec (path: string) {const videoCodec = videoStream.codec_tag_stringconst baseProfileMatrix = {- 'High': '6400',- 'Main': '4D40',- 'Baseline': '42E0'+ High: '6400',+ Main: '4D40',+ Baseline: '42E0'}let baseProfile = baseProfileMatrix[videoStream.profile]@@ -91,7 +156,7 @@ async function getVideoFileFPS (path: string) {if (videoStream === null) return 0for (const key of [ 'avg_frame_rate', 'r_frame_rate' ]) {- const valuesText: string = videoStream[ key ]+ const valuesText: string = videoStream[key]if (!valuesText) continueconst [ frames, seconds ] = valuesText.split('/')@@ -191,7 +256,8 @@ interface OnlyAudioTranscodeOptions extends BaseTranscodeOptions {type: 'only-audio'}-type TranscodeOptions = HLSTranscodeOptions+type TranscodeOptions =+ HLSTranscodeOptions| VideoTranscodeOptions| MergeAudioTranscodeOptions| OnlyAudioTranscodeOptions@@ -204,13 +270,13 @@ function transcode (options: TranscodeOptions) {.output(options.outputPath)if (options.type === 'quick-transcode') {- command = await buildQuickTranscodeCommand(command)+ command = buildQuickTranscodeCommand(command)} else if (options.type === 'hls') {command = await buildHLSCommand(command, options)} else if (options.type === 'merge-audio') {command = await buildAudioMergeCommand(command, options)} else if (options.type === 'only-audio') {- command = await buildOnlyAudioCommand(command, options)+ command = buildOnlyAudioCommand(command, options)} else {command = await buildx264Command(command, options)}@@ -247,17 +313,17 @@ async function canDoQuickTranscode (path: string): Promise<boolean> {// check video paramsif (videoStream == null) return false- if (videoStream[ 'codec_name' ] !== 'h264') return false- if (videoStream[ 'pix_fmt' ] !== 'yuv420p') return false+ if (videoStream['codec_name'] !== 'h264') return false+ if (videoStream['pix_fmt'] !== 'yuv420p') return falseif (fps < VIDEO_TRANSCODING_FPS.MIN || fps > VIDEO_TRANSCODING_FPS.MAX) return falseif (bitRate > getMaxBitrate(resolution.videoFileResolution, fps, VIDEO_TRANSCODING_FPS)) return false// check audio params (if audio stream exists)if (parsedAudio.audioStream) {- if (parsedAudio.audioStream[ 'codec_name' ] !== 'aac') return false+ if (parsedAudio.audioStream['codec_name'] !== 'aac') return false- const maxAudioBitrate = audio.bitrate[ 'aac' ](parsedAudio.audioStream[ 'bit_rate' ])- if (maxAudioBitrate !== -1 && parsedAudio.audioStream[ 'bit_rate' ] > maxAudioBitrate) return false+ const maxAudioBitrate = audio.bitrate['aac'](parsedAudio.audioStream['bit_rate'])+ if (maxAudioBitrate !== -1 && parsedAudio.audioStream['bit_rate'] > maxAudioBitrate) return false}return true@@ -333,14 +399,14 @@ async function buildAudioMergeCommand (command: ffmpeg.FfmpegCommand, options: Mreturn command}-async function buildOnlyAudioCommand (command: ffmpeg.FfmpegCommand, options: OnlyAudioTranscodeOptions) {- command = await presetOnlyAudio(command)+function buildOnlyAudioCommand (command: ffmpeg.FfmpegCommand, options: OnlyAudioTranscodeOptions) {+ command = presetOnlyAudio(command)return command}-async function buildQuickTranscodeCommand (command: ffmpeg.FfmpegCommand) {- command = await presetCopy(command)+function buildQuickTranscodeCommand (command: ffmpeg.FfmpegCommand) {+ command = presetCopy(command)command = command.outputOption('-map_metadata -1') // strip all metadata.outputOption('-movflags faststart')@@ -351,7 +417,7 @@ async function buildQuickTranscodeCommand (command: ffmpeg.FfmpegCommand) {async function buildHLSCommand (command: ffmpeg.FfmpegCommand, options: HLSTranscodeOptions) {const videoPath = getHLSVideoPath(options)- if (options.copyCodecs) command = await presetCopy(command)+ if (options.copyCodecs) command = presetCopy(command)else command = await buildx264Command(command, options)command = command.outputOption('-hls_time 4')@@ -418,71 +484,6 @@ async function presetH264VeryFast (command: ffmpeg.FfmpegCommand, input: string,return localCommand}-/**- * A toolbox to play with audio- */-namespace audio {- export const get = (videoPath: string) => {- // without position, ffprobe considers the last input only- // we make it consider the first input only- // if you pass a file path to pos, then ffprobe acts on that file directly- return new Promise<{ absolutePath: string, audioStream?: any }>((res, rej) => {-- function parseFfprobe (err: any, data: ffmpeg.FfprobeData) {- if (err) return rej(err)-- if ('streams' in data) {- const audioStream = data.streams.find(stream => stream[ 'codec_type' ] === 'audio')- if (audioStream) {- return res({- absolutePath: data.format.filename,- audioStream- })- }- }-- return res({ absolutePath: data.format.filename })- }-- return ffmpeg.ffprobe(videoPath, parseFfprobe)- })- }-- export namespace bitrate {- const baseKbitrate = 384-- const toBits = (kbits: number) => kbits * 8000-- export const aac = (bitrate: number): number => {- switch (true) {- case bitrate > toBits(baseKbitrate):- return baseKbitrate-- default:- return -1 // we interpret it as a signal to copy the audio stream as is- }- }-- export const mp3 = (bitrate: number): number => {- /*- a 192kbit/sec mp3 doesn't hold as much information as a 192kbit/sec aac.- That's why, when using aac, we can go to lower kbit/sec. The equivalences- made here are not made to be accurate, especially with good mp3 encoders.- */- switch (true) {- case bitrate <= toBits(192):- return 128-- case bitrate <= toBits(384):- return 256-- default:- return baseKbitrate- }- }- }-}-/*** Standard profile, with variable bitrate audio and faststart.*@@ -513,10 +514,10 @@ async function presetH264 (command: ffmpeg.FfmpegCommand, input: string, resolut// of course this is far from perfect, but it might save some space in the endlocalCommand = localCommand.audioCodec('aac')- const audioCodecName = parsedAudio.audioStream[ 'codec_name' ]+ const audioCodecName = parsedAudio.audioStream['codec_name']- if (audio.bitrate[ audioCodecName ]) {- const bitrate = audio.bitrate[ audioCodecName ](parsedAudio.audioStream[ 'bit_rate' ])+ if (audio.bitrate[audioCodecName]) {+ const bitrate = audio.bitrate[audioCodecName](parsedAudio.audioStream['bit_rate'])if (bitrate !== undefined && bitrate !== -1) localCommand = localCommand.audioBitrate(bitrate)}}@@ -537,14 +538,14 @@ async function presetH264 (command: ffmpeg.FfmpegCommand, input: string, resolutreturn localCommand}-async function presetCopy (command: ffmpeg.FfmpegCommand): Promise<ffmpeg.FfmpegCommand> {+function presetCopy (command: ffmpeg.FfmpegCommand): ffmpeg.FfmpegCommand {return command.format('mp4').videoCodec('copy').audioCodec('copy')}-async function presetOnlyAudio (command: ffmpeg.FfmpegCommand): Promise<ffmpeg.FfmpegCommand> {+function presetOnlyAudio (command: ffmpeg.FfmpegCommand): ffmpeg.FfmpegCommand {return command.format('mp4').audioCodec('copy')diff --git a/server/helpers/logger.ts b/server/helpers/logger.tsindex fd2988ad0b..b8ae28b3f1 100644--- a/server/helpers/logger.ts+++ b/server/helpers/logger.ts@@ -27,7 +27,7 @@ function getLoggerReplacer () {if (value instanceof Error) {const error = {}- Object.getOwnPropertyNames(value).forEach(key => error[ key ] = value[ key ])+ Object.getOwnPropertyNames(value).forEach(key => { error[key] = value[key] })return error}@@ -98,19 +98,20 @@ function bunyanLogFactory (level: string) {let args: any[] = []args.concat(arguments)- if (arguments[ 0 ] instanceof Error) {- meta = arguments[ 0 ].toString()+ if (arguments[0] instanceof Error) {+ meta = arguments[0].toString()args = Array.prototype.slice.call(arguments, 1)args.push(meta)- } else if (typeof (args[ 0 ]) !== 'string') {- meta = arguments[ 0 ]+ } else if (typeof (args[0]) !== 'string') {+ meta = arguments[0]args = Array.prototype.slice.call(arguments, 1)args.push(meta)}- logger[ level ].apply(logger, args)+ logger[level].apply(logger, args)}}+const bunyanLogger = {trace: bunyanLogFactory('debug'),debug: bunyanLogFactory('debug'),diff --git a/server/helpers/regexp.ts b/server/helpers/regexp.tsindex 2336654b0d..cfc2be4882 100644--- a/server/helpers/regexp.ts+++ b/server/helpers/regexp.ts@@ -1,8 +1,8 @@// Thanks to https://regex101.comfunction regexpCapture (str: string, regex: RegExp, maxIterations = 100) {+ const result: RegExpExecArray[] = []let m: RegExpExecArraylet i = 0- let result: RegExpExecArray[] = []// tslint:disable:no-conditional-assignmentwhile ((m = regex.exec(str)) !== null && i < maxIterations) {diff --git a/server/helpers/register-ts-paths.ts b/server/helpers/register-ts-paths.tsindex e8db369e33..eec7fed3ef 100644--- a/server/helpers/register-ts-paths.ts+++ b/server/helpers/register-ts-paths.ts@@ -1,5 +1,5 @@import { resolve } from 'path'-const tsConfigPaths = require('tsconfig-paths')+import tsConfigPaths = require('tsconfig-paths')const tsConfig = require('../../tsconfig.json')diff --git a/server/helpers/signup.ts b/server/helpers/signup.tsindex 7c73f7c5c0..d34ff2db5e 100644--- a/server/helpers/signup.ts+++ b/server/helpers/signup.ts@@ -21,7 +21,7 @@ async function isSignupAllowed (): Promise<{ allowed: boolean, errorMessage?: stfunction isSignupAllowedForCurrentIP (ip: string) {const addr = ipaddr.parse(ip)- let excludeList = [ 'blacklist' ]+ const excludeList = [ 'blacklist' ]let matched = ''// if there is a valid, non-empty whitelist, we exclude all unknown adresses toodiff --git a/server/helpers/utils.ts b/server/helpers/utils.tsindex 4c6f200f86..7a4c781ccb 100644--- a/server/helpers/utils.ts+++ b/server/helpers/utils.ts@@ -1,6 +1,6 @@import { ResultList } from '../../shared'import { ApplicationModel } from '../models/application/application'-import { execPromise, execPromise2, pseudoRandomBytesPromise, sha256 } from './core-utils'+import { execPromise, execPromise2, randomBytesPromise, sha256 } from './core-utils'import { logger } from './logger'import { join } from 'path'import { Instance as ParseTorrent } from 'parse-torrent'@@ -14,7 +14,7 @@ function deleteFileAsync (path: string) {}async function generateRandomString (size: number) {- const raw = await pseudoRandomBytesPromise(size)+ const raw = await randomBytesPromise(size)return raw.toString('hex')}diff --git a/server/helpers/webtorrent.ts b/server/helpers/webtorrent.tsindex 8a5d030dfd..b25e44fcd5 100644--- a/server/helpers/webtorrent.ts+++ b/server/helpers/webtorrent.ts@@ -39,7 +39,7 @@ async function downloadWebTorrentVideo (target: { magnetUri: string, torrentNameif (torrent.files.length !== 1) {if (timer) clearTimeout(timer)- for (let file of torrent.files) {+ for (const file of torrent.files) {deleteDownloadedFile({ directoryPath, filepath: file.path })}@@ -47,15 +47,16 @@ async function downloadWebTorrentVideo (target: { magnetUri: string, torrentName.then(() => rej(new Error('Cannot import torrent ' + torrentId + ': there are multiple files in it')))}- file = torrent.files[ 0 ]+ file = torrent.files[0]// FIXME: avoid creating another stream when https://github.com/webtorrent/webtorrent/issues/1517 is fixedconst writeStream = createWriteStream(path)writeStream.on('finish', () => {if (timer) clearTimeout(timer)- return safeWebtorrentDestroy(webtorrent, torrentId, { directoryPath, filepath: file.path }, target.torrentName)+ safeWebtorrentDestroy(webtorrent, torrentId, { directoryPath, filepath: file.path }, target.torrentName).then(() => res(path))+ .catch(err => logger.error('Cannot destroy webtorrent.', { err }))})file.createReadStream().pipe(writeStream)@@ -63,9 +64,16 @@ async function downloadWebTorrentVideo (target: { magnetUri: string, torrentNametorrent.on('error', err => rej(err))- timer = setTimeout(async () => {- return safeWebtorrentDestroy(webtorrent, torrentId, file ? { directoryPath, filepath: file.path } : undefined, target.torrentName)- .then(() => rej(new Error('Webtorrent download timeout.')))+ timer = setTimeout(() => {+ const err = new Error('Webtorrent download timeout.')++ safeWebtorrentDestroy(webtorrent, torrentId, file ? { directoryPath, filepath: file.path } : undefined, target.torrentName)+ .then(() => rej(err))+ .catch(destroyErr => {+ logger.error('Cannot destroy webtorrent.', { err: destroyErr })+ rej(err)+ })+}, timeout)})}diff --git a/server/helpers/youtube-dl.ts b/server/helpers/youtube-dl.tsindex 577a59dbf4..fc9d416a17 100644--- a/server/helpers/youtube-dl.ts+++ b/server/helpers/youtube-dl.ts@@ -24,20 +24,23 @@ const processOptions = {}function getYoutubeDLInfo (url: string, opts?: string[]): Promise<YoutubeDLInfo> {- return new Promise<YoutubeDLInfo>(async (res, rej) => {+ return new Promise<YoutubeDLInfo>((res, rej) => {let args = opts || [ '-j', '--flat-playlist' ]args = wrapWithProxyOptions(args)- const youtubeDL = await safeGetYoutubeDL()- youtubeDL.getInfo(url, args, processOptions, (err, info) => {- if (err) return rej(err)- if (info.is_live === true) return rej(new Error('Cannot download a live streaming.'))+ safeGetYoutubeDL()+ .then(youtubeDL => {+ youtubeDL.getInfo(url, args, processOptions, (err, info) => {+ if (err) return rej(err)+ if (info.is_live === true) return rej(new Error('Cannot download a live streaming.'))- const obj = buildVideoInfo(normalizeObject(info))- if (obj.name && obj.name.length < CONSTRAINTS_FIELDS.VIDEOS.NAME.min) obj.name += ' video'+ const obj = buildVideoInfo(normalizeObject(info))+ if (obj.name && obj.name.length < CONSTRAINTS_FIELDS.VIDEOS.NAME.min) obj.name += ' video'- return res(obj)- })+ return res(obj)+ })+ })+ .catch(err => rej(err))})}@@ -54,26 +57,34 @@ function downloadYoutubeDLVideo (url: string, timeout: number) {options = options.concat([ '--ffmpeg-location', process.env.FFMPEG_PATH ])}- return new Promise<string>(async (res, rej) => {- const youtubeDL = await safeGetYoutubeDL()- youtubeDL.exec(url, options, processOptions, err => {- clearTimeout(timer)+ return new Promise<string>((res, rej) => {+ safeGetYoutubeDL()+ .then(youtubeDL => {+ youtubeDL.exec(url, options, processOptions, err => {+ clearTimeout(timer)- if (err) {- remove(path)- .catch(err => logger.error('Cannot delete path on YoutubeDL error.', { err }))+ if (err) {+ remove(path)+ .catch(err => logger.error('Cannot delete path on YoutubeDL error.', { err }))- return rej(err)- }+ return rej(err)+ }- return res(path)- })+ return res(path)+ })- timer = setTimeout(async () => {- await remove(path)+ timer = setTimeout(() => {+ const err = new Error('YoutubeDL download timeout.')- return rej(new Error('YoutubeDL download timeout.'))- }, timeout)+ remove(path)+ .finally(() => rej(err))+ .catch(err => {+ logger.error('Cannot remove %s in youtubeDL timeout.', path, { err })+ return rej(err)+ })+ }, timeout)+ })+ .catch(err => rej(err))})}@@ -103,7 +114,7 @@ async function updateYoutubeDLBinary () {const url = result.headers.locationconst downloadFile = request.get(url)- const newVersion = /yt-dl\.org\/downloads\/(\d{4}\.\d\d\.\d\d(\.\d)?)\/youtube-dl/.exec(url)[ 1 ]+ const newVersion = /yt-dl\.org\/downloads\/(\d{4}\.\d\d\.\d\d(\.\d)?)\/youtube-dl/.exec(url)[1]downloadFile.on('response', result => {if (result.statusCode !== 200) {diff --git a/server/initializers/checker-after-init.ts b/server/initializers/checker-after-init.tsindex 44efd346cc..9780231293 100644--- a/server/initializers/checker-after-init.ts+++ b/server/initializers/checker-after-init.ts@@ -3,7 +3,7 @@ import { isProdInstance, isTestInstance } from '../helpers/core-utils'import { UserModel } from '../models/account/user'import { ApplicationModel } from '../models/application/application'import { OAuthClientModel } from '../models/oauth/oauth-client'-import { parse } from 'url'+import { URL } from 'url'import { CONFIG } from './config'import { logger } from '../helpers/logger'import { getServerActor } from '../helpers/utils'@@ -16,7 +16,7 @@ import { WEBSERVER } from './constants'async function checkActivityPubUrls () {const actor = await getServerActor()- const parsed = parse(actor.url)+ const parsed = new URL(actor.url)if (WEBSERVER.HOST !== parsed.host) {const NODE_ENV = config.util.getEnv('NODE_ENV')const NODE_CONFIG_DIR = config.util.getEnv('NODE_CONFIG_DIR')diff --git a/server/initializers/checker-before-init.ts b/server/initializers/checker-before-init.tsindex 9731a0af9d..a75f2cec2a 100644--- a/server/initializers/checker-before-init.ts+++ b/server/initializers/checker-before-init.ts@@ -35,8 +35,8 @@ function checkMissedConfig () {]const requiredAlternatives = [[ // set- ['redis.hostname', 'redis.port'], // alternative- ['redis.socket']+ [ 'redis.hostname', 'redis.port' ], // alternative+ [ 'redis.socket' ]]]const miss: string[] = []diff --git a/server/initializers/config.ts b/server/initializers/config.tsindex fd8bf09fc4..75372fa4ea 100644--- a/server/initializers/config.ts+++ b/server/initializers/config.ts@@ -301,7 +301,7 @@ function getLocalConfigFilePath () {if (process.env.NODE_ENV) filename += `-${process.env.NODE_ENV}`if (process.env.NODE_APP_INSTANCE) filename += `-${process.env.NODE_APP_INSTANCE}`- return join(dirname(configSources[ 0 ].name), filename + '.json')+ return join(dirname(configSources[0].name), filename + '.json')}function buildVideosRedundancy (objs: any[]): VideosRedundancyStrategy[] {@@ -330,7 +330,7 @@ export function reloadConfig () {function purge () {for (const fileName in require.cache) {- if (-1 === fileName.indexOf(directory())) {+ if (fileName.indexOf(directory()) === -1) {continue}diff --git a/server/initializers/constants.ts b/server/initializers/constants.tsindex 3a9946bbad..fb8ae7cd66 100644--- a/server/initializers/constants.ts+++ b/server/initializers/constants.ts@@ -4,7 +4,7 @@ import { ActivityPubActorType } from '../../shared/models/activitypub'import { FollowState } from '../../shared/models/actors'import { VideoAbuseState, VideoImportState, VideoPrivacy, VideoTranscodingFPS } from '../../shared/models/videos'// Do not use barrels, remain constants as independent as possible-import { isTestInstance, sanitizeHost, sanitizeUrl, root, parseDurationToMs } from '../helpers/core-utils'+import { isTestInstance, sanitizeHost, sanitizeUrl, root } from '../helpers/core-utils'import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type'import { invert } from 'lodash'import { CronRepeatOptions, EveryRepeatOptions } from 'bull'@@ -310,8 +310,8 @@ let CONTACT_FORM_LIFETIME = 60000 * 60 // 1 hourconst VIDEO_TRANSCODING_FPS: VideoTranscodingFPS = {MIN: 10,- STANDARD: [24, 25, 30],- HD_STANDARD: [50, 60],+ STANDARD: [ 24, 25, 30 ],+ HD_STANDARD: [ 50, 60 ],AVERAGE: 30,MAX: 60,KEEP_ORIGIN_FPS_RESOLUTION_MIN: 720 // We keep the original FPS on high resolutions (720 minimum)@@ -361,42 +361,42 @@ const VIDEO_LICENCES = {7: 'Public Domain Dedication'}-let VIDEO_LANGUAGES: { [id: string]: string } = {}+const VIDEO_LANGUAGES: { [id: string]: string } = {}const VIDEO_PRIVACIES = {- [ VideoPrivacy.PUBLIC ]: 'Public',- [ VideoPrivacy.UNLISTED ]: 'Unlisted',- [ VideoPrivacy.PRIVATE ]: 'Private',- [ VideoPrivacy.INTERNAL ]: 'Internal'+ [VideoPrivacy.PUBLIC]: 'Public',+ [VideoPrivacy.UNLISTED]: 'Unlisted',+ [VideoPrivacy.PRIVATE]: 'Private',+ [VideoPrivacy.INTERNAL]: 'Internal'}const VIDEO_STATES = {- [ VideoState.PUBLISHED ]: 'Published',- [ VideoState.TO_TRANSCODE ]: 'To transcode',- [ VideoState.TO_IMPORT ]: 'To import'+ [VideoState.PUBLISHED]: 'Published',+ [VideoState.TO_TRANSCODE]: 'To transcode',+ [VideoState.TO_IMPORT]: 'To import'}const VIDEO_IMPORT_STATES = {- [ VideoImportState.FAILED ]: 'Failed',- [ VideoImportState.PENDING ]: 'Pending',- [ VideoImportState.SUCCESS ]: 'Success'+ [VideoImportState.FAILED]: 'Failed',+ [VideoImportState.PENDING]: 'Pending',+ [VideoImportState.SUCCESS]: 'Success'}const VIDEO_ABUSE_STATES = {- [ VideoAbuseState.PENDING ]: 'Pending',- [ VideoAbuseState.REJECTED ]: 'Rejected',- [ VideoAbuseState.ACCEPTED ]: 'Accepted'+ [VideoAbuseState.PENDING]: 'Pending',+ [VideoAbuseState.REJECTED]: 'Rejected',+ [VideoAbuseState.ACCEPTED]: 'Accepted'}const VIDEO_PLAYLIST_PRIVACIES = {- [ VideoPlaylistPrivacy.PUBLIC ]: 'Public',- [ VideoPlaylistPrivacy.UNLISTED ]: 'Unlisted',- [ VideoPlaylistPrivacy.PRIVATE ]: 'Private'+ [VideoPlaylistPrivacy.PUBLIC]: 'Public',+ [VideoPlaylistPrivacy.UNLISTED]: 'Unlisted',+ [VideoPlaylistPrivacy.PRIVATE]: 'Private'}const VIDEO_PLAYLIST_TYPES = {- [ VideoPlaylistType.REGULAR ]: 'Regular',- [ VideoPlaylistType.WATCH_LATER ]: 'Watch later'+ [VideoPlaylistType.REGULAR]: 'Regular',+ [VideoPlaylistType.WATCH_LATER]: 'Watch later'}const MIMETYPES = {@@ -533,7 +533,7 @@ const LAZY_STATIC_PATHS = {}// Cache control-let STATIC_MAX_AGE = {+const STATIC_MAX_AGE = {SERVER: '2h',CLIENT: '30d'}@@ -671,14 +671,14 @@ if (isTestInstance() === true) {SCHEDULER_INTERVALS_MS.removeOldViews = 5000SCHEDULER_INTERVALS_MS.updateVideos = 5000SCHEDULER_INTERVALS_MS.autoFollowIndexInstances = 5000- REPEAT_JOBS[ 'videos-views' ] = { every: 5000 }+ REPEAT_JOBS['videos-views'] = { every: 5000 }REDUNDANCY.VIDEOS.RANDOMIZED_FACTOR = 1VIDEO_VIEW_LIFETIME = 1000 // 1 secondCONTACT_FORM_LIFETIME = 1000 // 1 second- JOB_ATTEMPTS[ 'email' ] = 1+ JOB_ATTEMPTS['email'] = 1FILES_CACHE.VIDEO_CAPTIONS.MAX_AGE = 3000MEMOIZE_TTL.OVERVIEWS_SAMPLE = 1@@ -838,42 +838,42 @@ function loadLanguages () {function buildLanguages () {const iso639 = require('iso-639-3')- const languages: { [ id: string ]: string } = {}+ const languages: { [id: string]: string } = {}const additionalLanguages = {- 'sgn': true, // Sign languages (macro language)- 'ase': true, // American sign language- 'sdl': true, // Arabian sign language- 'bfi': true, // British sign language- 'bzs': true, // Brazilian sign language- 'csl': true, // Chinese sign language- 'cse': true, // Czech sign language- 'dsl': true, // Danish sign language- 'fsl': true, // French sign language- 'gsg': true, // German sign language- 'pks': true, // Pakistan sign language- 'jsl': true, // Japanese sign language- 'sfs': true, // South African sign language- 'swl': true, // Swedish sign language- 'rsl': true, // Russian sign language: true-- 'epo': true, // Esperanto- 'tlh': true, // Klingon- 'jbo': true, // Lojban- 'avk': true // Kotava+ sgn: true, // Sign languages (macro language)+ ase: true, // American sign language+ sdl: true, // Arabian sign language+ bfi: true, // British sign language+ bzs: true, // Brazilian sign language+ csl: true, // Chinese sign language+ cse: true, // Czech sign language+ dsl: true, // Danish sign language+ fsl: true, // French sign language+ gsg: true, // German sign language+ pks: true, // Pakistan sign language+ jsl: true, // Japanese sign language+ sfs: true, // South African sign language+ swl: true, // Swedish sign language+ rsl: true, // Russian sign language: true++ epo: true, // Esperanto+ tlh: true, // Klingon+ jbo: true, // Lojban+ avk: true // Kotava}// Only add ISO639-1 languages and some sign languages (ISO639-3)iso639.filter(l => {return (l.iso6391 !== null && l.type === 'living') ||- additionalLanguages[ l.iso6393 ] === true+ additionalLanguages[l.iso6393] === true})- .forEach(l => languages[ l.iso6391 || l.iso6393 ] = l.name)+ .forEach(l => { languages[l.iso6391 || l.iso6393] = l.name })// Override Occitan label- languages[ 'oc' ] = 'Occitan'- languages[ 'el' ] = 'Greek'+ languages['oc'] = 'Occitan'+ languages['el'] = 'Greek'return languages}diff --git a/server/initializers/database.ts b/server/initializers/database.tsindex 9ec146ab18..eedaf3c4ee 100644--- a/server/initializers/database.ts+++ b/server/initializers/database.ts@@ -119,8 +119,6 @@ async function initDatabaseModels (silent: boolean) {await createFunctions()if (!silent) logger.info('Database %s is ready.', dbname)-- return}// ---------------------------------------------------------------------------diff --git a/server/initializers/migrations/0005-email-pod.ts b/server/initializers/migrations/0005-email-pod.tsindex c34a122559..417c33b1f7 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'import { Migration } from '../../models/migrations'function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {const q = utils.queryInterfacediff --git a/server/initializers/migrations/0010-email-user.ts b/server/initializers/migrations/0010-email-user.tsindex 37a7b0bb34..f7d01f6d67 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'import { Migration } from '../../models/migrations'function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {const q = utils.queryInterfacediff --git a/server/initializers/migrations/0015-video-views.ts b/server/initializers/migrations/0015-video-views.tsindex 25164ff4d5..47dd4069bf 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'import * as Promise from 'bluebird'function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {const q = utils.queryInterfacediff --git a/server/initializers/migrations/0020-video-likes.ts b/server/initializers/migrations/0020-video-likes.tsindex 945be5a98d..44333f3b04 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'import * as Promise from 'bluebird'function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {const q = utils.queryInterfacediff --git a/server/initializers/migrations/0025-video-dislikes.ts b/server/initializers/migrations/0025-video-dislikes.tsindex 27144c4373..2aa22e2d7d 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'import * as Promise from 'bluebird'function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {const q = utils.queryInterfacediff --git a/server/initializers/migrations/0030-video-category.ts b/server/initializers/migrations/0030-video-category.tsindex f784f820da..00cd2d8cf0 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'import { Migration } from '../../models/migrations'function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {const q = utils.queryInterfacediff --git a/server/initializers/migrations/0035-video-licence.ts b/server/initializers/migrations/0035-video-licence.tsindex 3d0b0bac98..61d666c5eb 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'import { Migration } from '../../models/migrations'function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {const q = utils.queryInterfacediff --git a/server/initializers/migrations/0040-video-nsfw.ts b/server/initializers/migrations/0040-video-nsfw.tsindex f7f70d3c4b..44aec8a6c3 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'import { Migration } from '../../models/migrations'function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {const q = utils.queryInterfacediff --git a/server/initializers/migrations/0045-user-display-nsfw.ts b/server/initializers/migrations/0045-user-display-nsfw.tsindex aef420f0e4..07795bd75e 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'import * as Promise from 'bluebird'function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {const q = utils.queryInterfacediff --git a/server/initializers/migrations/0050-video-language.ts b/server/initializers/migrations/0050-video-language.tsindex 796fa5f959..6f90abb44f 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'import * as Promise from 'bluebird'function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {const q = utils.queryInterfacediff --git a/server/initializers/migrations/0055-video-uuid.ts b/server/initializers/migrations/0055-video-uuid.tsindex e0f9040807..8a58aebb83 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'import { Migration } from '../../models/migrations'function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {const q = utils.queryInterfacediff --git a/server/initializers/migrations/0060-video-file.ts b/server/initializers/migrations/0060-video-file.tsindex c362cf71aa..00647e60e4 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'import * as Promise from 'bluebird'function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {const q = utils.queryInterfacediff --git a/server/initializers/migrations/0065-video-file-size.ts b/server/initializers/migrations/0065-video-file-size.tsindex e9ce77e507..0bdc675c21 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'import { getVideoFilePath } from '@server/lib/video-paths'function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {return utils.db.Video.listOwnedAndPopulateAuthorAndTags()diff --git a/server/initializers/migrations/0070-user-video-quota.ts b/server/initializers/migrations/0070-user-video-quota.tsindex 37683432f8..1d073f244c 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'import { Migration } from '../../models/migrations'function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {const q = utils.queryInterfacediff --git a/server/initializers/migrations/0075-video-resolutions.ts b/server/initializers/migrations/0075-video-resolutions.tsindex e4f26cb779..f56c1b2c30 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'import { readdir, rename } from 'fs-extra'function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {const torrentDir = CONFIG.STORAGE.TORRENTS_DIRdiff --git a/server/initializers/migrations/0080-video-channels.ts b/server/initializers/migrations/0080-video-channels.tsindex 5512bdcf15..b8e9bd6d06 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'import * as uuidv4 from 'uuid/v4'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {const q = utils.queryInterfacediff --git a/server/initializers/migrations/0085-user-role.ts b/server/initializers/migrations/0085-user-role.tsindex de75faec29..ec7428fd51 100644--- a/server/initializers/migrations/0085-user-role.ts+++ b/server/initializers/migrations/0085-user-role.ts@@ -1,9 +1,9 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {const q = utils.queryInterfacediff --git a/server/initializers/migrations/0090-videos-description.ts b/server/initializers/migrations/0090-videos-description.tsindex 6f98dcade4..32e518d75d 100644--- a/server/initializers/migrations/0090-videos-description.ts+++ b/server/initializers/migrations/0090-videos-description.ts@@ -1,9 +1,9 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {const q = utils.queryInterfacediff --git a/server/initializers/migrations/0095-videos-privacy.ts b/server/initializers/migrations/0095-videos-privacy.tsindex 4c2bf91d0e..c732d6f6a0 100644--- a/server/initializers/migrations/0095-videos-privacy.ts+++ b/server/initializers/migrations/0095-videos-privacy.ts@@ -1,9 +1,9 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {const q = utils.queryInterfacediff --git a/server/initializers/migrations/0100-activitypub.ts b/server/initializers/migrations/0100-activitypub.tsindex 96d44a7cee..05fd374068 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'import { SERVER_ACTOR_NAME } from '../constants'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {const q = utils.queryInterfacediff --git a/server/initializers/migrations/0105-server-mail.ts b/server/initializers/migrations/0105-server-mail.tsindex 4b9600e916..5ee37c418a 100644--- a/server/initializers/migrations/0105-server-mail.ts+++ b/server/initializers/migrations/0105-server-mail.ts@@ -1,9 +1,9 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {await utils.queryInterface.removeColumn('Servers', 'email')diff --git a/server/initializers/migrations/0110-server-key.ts b/server/initializers/migrations/0110-server-key.tsindex 5ff6daf694..354cd7e765 100644--- a/server/initializers/migrations/0110-server-key.ts+++ b/server/initializers/migrations/0110-server-key.ts@@ -1,9 +1,9 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {await utils.queryInterface.removeColumn('Servers', 'publicKey')diff --git a/server/initializers/migrations/0115-account-avatar.ts b/server/initializers/migrations/0115-account-avatar.tsindex b318e8163c..604b6394af 100644--- a/server/initializers/migrations/0115-account-avatar.ts+++ b/server/initializers/migrations/0115-account-avatar.ts@@ -1,9 +1,9 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {await utils.db.Avatar.sync()diff --git a/server/initializers/migrations/0120-video-null.ts b/server/initializers/migrations/0120-video-null.tsindex 6d253f04f7..1b407b270a 100644--- a/server/initializers/migrations/0120-video-null.ts+++ b/server/initializers/migrations/0120-video-null.ts@@ -1,9 +1,9 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {diff --git a/server/initializers/migrations/0125-table-lowercase.ts b/server/initializers/migrations/0125-table-lowercase.tsindex 78041ccb0c..f75a567919 100644--- a/server/initializers/migrations/0125-table-lowercase.ts+++ b/server/initializers/migrations/0125-table-lowercase.ts@@ -1,8 +1,8 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {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.tsindex 9f6878e391..d57934588c 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'import * as Promise from 'bluebird'function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {const q = utils.queryInterfacediff --git a/server/initializers/migrations/0135-video-channel-actor.ts b/server/initializers/migrations/0135-video-channel-actor.tsindex 5ace0f4d27..c0c343384b 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'import { createPrivateAndPublicKeys } from '../../helpers/peertube-crypto'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {// Create actor table@@ -64,10 +64,10 @@ async function up (utils: {type, uuid, "preferredUsername", url, "publicKey", "privateKey", "followersCount", "followingCount", "inboxUrl", "outboxUrl","sharedInboxUrl", "followersUrl", "followingUrl", "avatarId", "serverId", "createdAt", "updatedAt")- SELECT+ SELECT'Application', uuid, name, url, "publicKey", "privateKey", "followersCount", "followingCount", "inboxUrl", "outboxUrl",- "sharedInboxUrl", "followersUrl", "followingUrl", "avatarId", "serverId", "createdAt", "updatedAt"- FROM account+ "sharedInboxUrl", "followersUrl", "followingUrl", "avatarId", "serverId", "createdAt", "updatedAt"+ FROM accountWHERE "applicationId" IS NOT NULL`await utils.sequelize.query(query1)@@ -79,10 +79,10 @@ async function up (utils: {type, uuid, "preferredUsername", url, "publicKey", "privateKey", "followersCount", "followingCount", "inboxUrl", "outboxUrl","sharedInboxUrl", "followersUrl", "followingUrl", "avatarId", "serverId", "createdAt", "updatedAt")- SELECT+ SELECT'Person', uuid, name, url, "publicKey", "privateKey", "followersCount", "followingCount", "inboxUrl", "outboxUrl",- "sharedInboxUrl", "followersUrl", "followingUrl", "avatarId", "serverId", "createdAt", "updatedAt"- FROM account+ "sharedInboxUrl", "followersUrl", "followingUrl", "avatarId", "serverId", "createdAt", "updatedAt"+ FROM accountWHERE "applicationId" IS NULL`await utils.sequelize.query(query2)@@ -108,17 +108,17 @@ async function up (utils: {}{- const query = `- INSERT INTO actor+ const query = `+ INSERT INTO actor(- type, uuid, "preferredUsername", url, "publicKey", "privateKey", "followersCount", "followingCount", "inboxUrl", "outboxUrl",+ type, uuid, "preferredUsername", url, "publicKey", "privateKey", "followersCount", "followingCount", "inboxUrl", "outboxUrl","sharedInboxUrl", "followersUrl", "followingUrl", "avatarId", "serverId", "createdAt", "updatedAt")- SELECT- 'Group', "videoChannel".uuid, "videoChannel".uuid, "videoChannel".url, null, null, 0, 0, "videoChannel".url || '/inbox',+ SELECT+ 'Group', "videoChannel".uuid, "videoChannel".uuid, "videoChannel".url, null, null, 0, 0, "videoChannel".url || '/inbox',"videoChannel".url || '/outbox', "videoChannel".url || '/inbox', "videoChannel".url || '/followers', "videoChannel".url || '/following',- null, account."serverId", "videoChannel"."createdAt", "videoChannel"."updatedAt"- FROM "videoChannel"+ null, account."serverId", "videoChannel"."createdAt", "videoChannel"."updatedAt"+ FROM "videoChannel"INNER JOIN "account" on "videoChannel"."accountId" = "account".id`await utils.sequelize.query(query)@@ -157,13 +157,13 @@ async function up (utils: {}{- const query1 = `UPDATE "actorFollow"- SET "actorId" =+ const query1 = `UPDATE "actorFollow"+ SET "actorId" =(SELECT "account"."actorId" FROM account WHERE "account"."id" = "actorFollow"."actorId")`await utils.sequelize.query(query1)- const query2 = `UPDATE "actorFollow"- SET "targetActorId" =+ const query2 = `UPDATE "actorFollow"+ SET "targetActorId" =(SELECT "account"."actorId" FROM account WHERE "account"."id" = "actorFollow"."targetActorId")`await utils.sequelize.query(query2)@@ -189,8 +189,8 @@ async function up (utils: {await utils.queryInterface.removeConstraint('videoShare', 'videoShare_accountId_fkey')}- const query = `UPDATE "videoShare"- SET "actorId" =+ const query = `UPDATE "videoShare"+ SET "actorId" =(SELECT "actorId" FROM account WHERE id = "videoShare"."actorId")`await utils.sequelize.query(query)diff --git a/server/initializers/migrations/0140-actor-url.ts b/server/initializers/migrations/0140-actor-url.tsindex 0204993912..d790988adc 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'import { WEBSERVER } from '../constants'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {const toReplace = WEBSERVER.HOSTNAME + ':443'diff --git a/server/initializers/migrations/0145-delete-author.ts b/server/initializers/migrations/0145-delete-author.tsindex cb23d1cc2d..6c9427997b 100644--- a/server/initializers/migrations/0145-delete-author.ts+++ b/server/initializers/migrations/0145-delete-author.ts@@ -1,8 +1,8 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {await utils.queryInterface.dropTable('Authors')diff --git a/server/initializers/migrations/0150-avatar-cascade.ts b/server/initializers/migrations/0150-avatar-cascade.tsindex 8216967173..fb3b257738 100644--- a/server/initializers/migrations/0150-avatar-cascade.ts+++ b/server/initializers/migrations/0150-avatar-cascade.ts@@ -1,8 +1,8 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {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.tsindex 6949d3a0c2..691640b355 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'import { Migration } from '../../models/migrations'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {const data = {diff --git a/server/initializers/migrations/0160-account-route.ts b/server/initializers/migrations/0160-account-route.tsindex cab4c72f15..97469948b8 100644--- a/server/initializers/migrations/0160-account-route.ts+++ b/server/initializers/migrations/0160-account-route.ts@@ -1,8 +1,8 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {{diff --git a/server/initializers/migrations/0165-video-route.ts b/server/initializers/migrations/0165-video-route.tsindex 56d98bc690..aa7c751285 100644--- a/server/initializers/migrations/0165-video-route.ts+++ b/server/initializers/migrations/0165-video-route.ts@@ -1,8 +1,8 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {{diff --git a/server/initializers/migrations/0170-actor-follow-score.ts b/server/initializers/migrations/0170-actor-follow-score.tsindex a12b35da9d..901a3c7997 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'import { ACTOR_FOLLOW_SCORE } from '../constants'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {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.tsindex 4fb5241815..d7853f8dc1 100644--- a/server/initializers/migrations/0175-actor-follow-counts.ts+++ b/server/initializers/migrations/0175-actor-follow-counts.ts@@ -1,8 +1,8 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {const query = 'UPDATE "actor" SET ' +diff --git a/server/initializers/migrations/0180-job-table-delete.ts b/server/initializers/migrations/0180-job-table-delete.tsindex df29145d04..fb48a0c9d4 100644--- a/server/initializers/migrations/0180-job-table-delete.ts+++ b/server/initializers/migrations/0180-job-table-delete.ts@@ -1,8 +1,8 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {await utils.queryInterface.dropTable('job')diff --git a/server/initializers/migrations/0185-video-share-url.ts b/server/initializers/migrations/0185-video-share-url.tsindex f7eeb08786..f59931e0f3 100644--- a/server/initializers/migrations/0185-video-share-url.ts+++ b/server/initializers/migrations/0185-video-share-url.ts@@ -1,8 +1,8 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {{diff --git a/server/initializers/migrations/0190-video-comment-unique-url.ts b/server/initializers/migrations/0190-video-comment-unique-url.tsindex b196c93529..a8769ed415 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 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {{diff --git a/server/initializers/migrations/0195-support.ts b/server/initializers/migrations/0195-support.tsindex 3b9eabe793..3f7c75dce9 100644--- a/server/initializers/migrations/0195-support.ts+++ b/server/initializers/migrations/0195-support.ts@@ -1,8 +1,8 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {{diff --git a/server/initializers/migrations/0200-video-published-at.ts b/server/initializers/migrations/0200-video-published-at.tsindex 1701ea07a6..d8c7b42a76 100644--- a/server/initializers/migrations/0200-video-published-at.ts+++ b/server/initializers/migrations/0200-video-published-at.ts@@ -1,8 +1,8 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {diff --git a/server/initializers/migrations/0205-user-nsfw-policy.ts b/server/initializers/migrations/0205-user-nsfw-policy.tsindex d0f6e8962f..9c2786f120 100644--- a/server/initializers/migrations/0205-user-nsfw-policy.ts+++ b/server/initializers/migrations/0205-user-nsfw-policy.ts@@ -1,8 +1,8 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {diff --git a/server/initializers/migrations/0210-video-language.ts b/server/initializers/migrations/0210-video-language.tsindex ca95c75274..ee4ce92662 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'import { CONSTRAINTS_FIELDS } from '../constants'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {diff --git a/server/initializers/migrations/0215-video-support-length.ts b/server/initializers/migrations/0215-video-support-length.tsindex ba395050f6..26c0ca7007 100644--- a/server/initializers/migrations/0215-video-support-length.ts+++ b/server/initializers/migrations/0215-video-support-length.ts@@ -1,8 +1,8 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {{diff --git a/server/initializers/migrations/0255-video-blacklist-reason.ts b/server/initializers/migrations/0255-video-blacklist-reason.tsindex 69d6efb9ea..7de982f934 100644--- a/server/initializers/migrations/0255-video-blacklist-reason.ts+++ b/server/initializers/migrations/0255-video-blacklist-reason.ts@@ -1,5 +1,4 @@import * as Sequelize from 'sequelize'-import { VideoAbuseState } from '../../../shared/models/videos'async function up (utils: {transaction: Sequelize.Transactiondiff --git a/server/initializers/migrations/0285-description-support.ts b/server/initializers/migrations/0285-description-support.tsindex 85ef4ef39b..aab3a938f0 100644--- a/server/initializers/migrations/0285-description-support.ts+++ b/server/initializers/migrations/0285-description-support.ts@@ -1,9 +1,9 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {{diff --git a/server/initializers/migrations/0290-account-video-rate-url.ts b/server/initializers/migrations/0290-account-video-rate-url.tsindex bdabf2929b..b974b1a819 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 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {{diff --git a/server/initializers/migrations/0295-video-file-extname.ts b/server/initializers/migrations/0295-video-file-extname.tsindex dbf249f669..e1999b0724 100644--- a/server/initializers/migrations/0295-video-file-extname.ts+++ b/server/initializers/migrations/0295-video-file-extname.ts@@ -1,9 +1,9 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {{diff --git a/server/initializers/migrations/0300-user-videos-history-enabled.ts b/server/initializers/migrations/0300-user-videos-history-enabled.tsindex aa5fc21fb1..5e35e14ba5 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 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {{diff --git a/server/initializers/migrations/0305-fix-unfederated-videos.ts b/server/initializers/migrations/0305-fix-unfederated-videos.tsindex be206601fb..9c5d56b7bd 100644--- a/server/initializers/migrations/0305-fix-unfederated-videos.ts+++ b/server/initializers/migrations/0305-fix-unfederated-videos.ts@@ -1,9 +1,9 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {{diff --git a/server/initializers/migrations/0310-drop-unused-video-indexes.ts b/server/initializers/migrations/0310-drop-unused-video-indexes.tsindex d51f430c02..181858d3d6 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 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {const indexNames = [diff --git a/server/initializers/migrations/0315-user-notifications.ts b/server/initializers/migrations/0315-user-notifications.tsindex 8284c58a0f..0e3f4fbef6 100644--- a/server/initializers/migrations/0315-user-notifications.ts+++ b/server/initializers/migrations/0315-user-notifications.ts@@ -1,8 +1,8 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {diff --git a/server/initializers/migrations/0320-blacklist-unfederate.ts b/server/initializers/migrations/0320-blacklist-unfederate.tsindex 6fb7bbb901..41de41c558 100644--- a/server/initializers/migrations/0320-blacklist-unfederate.ts+++ b/server/initializers/migrations/0320-blacklist-unfederate.ts@@ -1,8 +1,8 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {diff --git a/server/initializers/migrations/0325-video-abuse-fields.ts b/server/initializers/migrations/0325-video-abuse-fields.tsindex fca6d666f9..d88724a20c 100644--- a/server/initializers/migrations/0325-video-abuse-fields.ts+++ b/server/initializers/migrations/0325-video-abuse-fields.ts@@ -1,8 +1,8 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {diff --git a/server/initializers/migrations/0330-video-streaming-playlist.ts b/server/initializers/migrations/0330-video-streaming-playlist.tsindex c85a762abb..f75541a7ff 100644--- a/server/initializers/migrations/0330-video-streaming-playlist.ts+++ b/server/initializers/migrations/0330-video-streaming-playlist.ts@@ -1,8 +1,8 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {diff --git a/server/initializers/migrations/0335-video-downloading-enabled.ts b/server/initializers/migrations/0335-video-downloading-enabled.tsindex e79466447a..c745f1f024 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'import { Migration } from '../../models/migrations'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {const data = {diff --git a/server/initializers/migrations/0340-add-originally-published-at.ts b/server/initializers/migrations/0340-add-originally-published-at.tsindex fe4f4a5f90..7cbc14ab52 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 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {diff --git a/server/initializers/migrations/0345-video-playlists.ts b/server/initializers/migrations/0345-video-playlists.tsindex de69f5b9ea..76813f93f0 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'import { WEBSERVER } from '../constants'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterfacesequelize: Sequelize.Sequelize}): Promise<void> {const transaction = utils.transactiondiff --git a/server/initializers/migrations/0350-video-blacklist-type.ts b/server/initializers/migrations/0350-video-blacklist-type.tsindex 4849020ef7..f79ae5ec7e 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'import { VideoBlacklistType } from '../../../shared/models/videos'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {{diff --git a/server/initializers/migrations/0355-p2p-peer-version.ts b/server/initializers/migrations/0355-p2p-peer-version.tsindex 18f23d9b7c..89af28d074 100644--- a/server/initializers/migrations/0355-p2p-peer-version.ts+++ b/server/initializers/migrations/0355-p2p-peer-version.ts@@ -1,9 +1,9 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {diff --git a/server/initializers/migrations/0360-notification-instance-follower.ts b/server/initializers/migrations/0360-notification-instance-follower.tsindex 05caf8e1d8..6f9a01a9cd 100644--- a/server/initializers/migrations/0360-notification-instance-follower.ts+++ b/server/initializers/migrations/0360-notification-instance-follower.ts@@ -1,9 +1,9 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {{diff --git a/server/initializers/migrations/0365-user-admin-flags.ts b/server/initializers/migrations/0365-user-admin-flags.tsindex 20553100a9..b705387da2 100644--- a/server/initializers/migrations/0365-user-admin-flags.ts+++ b/server/initializers/migrations/0365-user-admin-flags.ts@@ -1,9 +1,9 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {{diff --git a/server/initializers/migrations/0370-thumbnail.ts b/server/initializers/migrations/0370-thumbnail.tsindex 384ca1a15b..07c25436af 100644--- a/server/initializers/migrations/0370-thumbnail.ts+++ b/server/initializers/migrations/0370-thumbnail.ts@@ -1,9 +1,9 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {{diff --git a/server/initializers/migrations/0375-account-description.ts b/server/initializers/migrations/0375-account-description.tsindex 1258563fd4..f9af942e0e 100644--- a/server/initializers/migrations/0375-account-description.ts+++ b/server/initializers/migrations/0375-account-description.ts@@ -1,9 +1,9 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {const data = {diff --git a/server/initializers/migrations/0380-cleanup-timestamps.ts b/server/initializers/migrations/0380-cleanup-timestamps.tsindex 2a9fd6f02a..18ecfb9971 100644--- a/server/initializers/migrations/0380-cleanup-timestamps.ts+++ b/server/initializers/migrations/0380-cleanup-timestamps.ts@@ -1,9 +1,9 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {try {diff --git a/server/initializers/migrations/0385-remove-actor-uuid.ts b/server/initializers/migrations/0385-remove-actor-uuid.tsindex 032c0562bc..eefbc386b5 100644--- a/server/initializers/migrations/0385-remove-actor-uuid.ts+++ b/server/initializers/migrations/0385-remove-actor-uuid.ts@@ -1,9 +1,9 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {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.tsindex 5ca8717467..9cf0affa5b 100644--- a/server/initializers/migrations/0390-user-pending-email.ts+++ b/server/initializers/migrations/0390-user-pending-email.ts@@ -1,9 +1,9 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {const data = {diff --git a/server/initializers/migrations/0395-user-video-languages.ts b/server/initializers/migrations/0395-user-video-languages.tsindex 278698bf40..9c24fbc9a1 100644--- a/server/initializers/migrations/0395-user-video-languages.ts+++ b/server/initializers/migrations/0395-user-video-languages.ts@@ -1,9 +1,9 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {const data = {diff --git a/server/initializers/migrations/0400-user-theme.ts b/server/initializers/migrations/0400-user-theme.tsindex f74d761153..7addb1bb37 100644--- a/server/initializers/migrations/0400-user-theme.ts+++ b/server/initializers/migrations/0400-user-theme.ts@@ -1,9 +1,9 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {const data = {diff --git a/server/initializers/migrations/0405-plugin.ts b/server/initializers/migrations/0405-plugin.tsindex c55b819602..5c290b986b 100644--- a/server/initializers/migrations/0405-plugin.ts+++ b/server/initializers/migrations/0405-plugin.ts@@ -1,9 +1,9 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {{diff --git a/server/initializers/migrations/0410-video-playlist-element.ts b/server/initializers/migrations/0410-video-playlist-element.tsindex f536632a27..1b46923570 100644--- a/server/initializers/migrations/0410-video-playlist-element.ts+++ b/server/initializers/migrations/0410-video-playlist-element.ts@@ -1,9 +1,9 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {{diff --git a/server/initializers/migrations/0415-thumbnail-auto-generated.ts b/server/initializers/migrations/0415-thumbnail-auto-generated.tsindex f822a4c056..98d563c88e 100644--- a/server/initializers/migrations/0415-thumbnail-auto-generated.ts+++ b/server/initializers/migrations/0415-thumbnail-auto-generated.ts@@ -1,9 +1,9 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {{diff --git a/server/initializers/migrations/0420-avatar-lazy.ts b/server/initializers/migrations/0420-avatar-lazy.tsindex 5fc57aac2c..5c74819d20 100644--- a/server/initializers/migrations/0420-avatar-lazy.ts+++ b/server/initializers/migrations/0420-avatar-lazy.ts@@ -1,9 +1,9 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {{diff --git a/server/initializers/migrations/0425-nullable-actor-fields.ts b/server/initializers/migrations/0425-nullable-actor-fields.tsindex 4e5f9e6abe..720b99ccc8 100644--- a/server/initializers/migrations/0425-nullable-actor-fields.ts+++ b/server/initializers/migrations/0425-nullable-actor-fields.ts@@ -1,9 +1,9 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {const data = {diff --git a/server/initializers/migrations/0430-auto-follow-notification-setting.ts b/server/initializers/migrations/0430-auto-follow-notification-setting.tsindex 034bdd46d0..1734828a43 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 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {{diff --git a/server/initializers/migrations/0435-user-modals.ts b/server/initializers/migrations/0435-user-modals.tsindex 5c2aa85b58..737440e9b0 100644--- a/server/initializers/migrations/0435-user-modals.ts+++ b/server/initializers/migrations/0435-user-modals.ts@@ -1,9 +1,9 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {{diff --git a/server/initializers/migrations/0440-user-auto-play-next-video.ts b/server/initializers/migrations/0440-user-auto-play-next-video.tsindex f0baafe7b2..f3f663f59a 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 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {{diff --git a/server/initializers/migrations/0445-shared-inbox-optional.ts b/server/initializers/migrations/0445-shared-inbox-optional.tsindex dad2d65695..ade1a2a572 100644--- a/server/initializers/migrations/0445-shared-inbox-optional.ts+++ b/server/initializers/migrations/0445-shared-inbox-optional.ts@@ -1,9 +1,9 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {{diff --git a/server/initializers/migrations/0450-streaming-playlist-files.ts b/server/initializers/migrations/0450-streaming-playlist-files.tsindex 460dac8be9..08e2e3989b 100644--- a/server/initializers/migrations/0450-streaming-playlist-files.ts+++ b/server/initializers/migrations/0450-streaming-playlist-files.ts@@ -1,15 +1,9 @@import * as Sequelize from 'sequelize'-import { join } from 'path'-import { HLS_STREAMING_PLAYLIST_DIRECTORY, WEBSERVER } from '@server/initializers/constants'-import { CONFIG } from '@server/initializers/config'-import { pathExists, stat, writeFile } from 'fs-extra'-import * as parseTorrent from 'parse-torrent'-import { createTorrentPromise } from '@server/helpers/webtorrent'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {{@@ -42,8 +36,8 @@ async function up (utils: {{const query = 'insert into "videoFile" ' +'(resolution, size, "infoHash", "videoId", "createdAt", "updatedAt", fps, extname, "videoStreamingPlaylistId")' +- '(SELECT "videoFile".resolution, "videoFile".size, \'fake\', NULL, "videoFile"."createdAt", "videoFile"."updatedAt", "videoFile"."fps", ' +- '"videoFile".extname, "videoStreamingPlaylist".id FROM "videoStreamingPlaylist" ' ++ '(SELECT "videoFile".resolution, "videoFile".size, \'fake\', NULL, "videoFile"."createdAt", "videoFile"."updatedAt", ' ++ '"videoFile"."fps", "videoFile".extname, "videoStreamingPlaylist".id FROM "videoStreamingPlaylist" ' +'inner join video ON video.id = "videoStreamingPlaylist"."videoId" inner join "videoFile" ON "videoFile"."videoId" = video.id)'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.tsindex bcfb97b563..00e56015fb 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 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {{diff --git a/server/initializers/migrations/0460-user-playlist-autoplay.ts b/server/initializers/migrations/0460-user-playlist-autoplay.tsindex 3067ac1a41..d6f5081abf 100644--- a/server/initializers/migrations/0460-user-playlist-autoplay.ts+++ b/server/initializers/migrations/0460-user-playlist-autoplay.ts@@ -1,9 +1,9 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {{diff --git a/server/initializers/migrations/0465-thumbnail-file-url-length.ts b/server/initializers/migrations/0465-thumbnail-file-url-length.tsindex db8c85c292..84a4fa0ba9 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 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {{diff --git a/server/initializers/migrations/0470-cleaup-indexes.ts b/server/initializers/migrations/0470-cleaup-indexes.tsindex 53e401c2bf..7365c30f8a 100644--- a/server/initializers/migrations/0470-cleaup-indexes.ts+++ b/server/initializers/migrations/0470-cleaup-indexes.ts@@ -1,9 +1,9 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {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.tsindex 7e392c8c08..edbddba37c 100644--- a/server/initializers/migrations/0475-redundancy-expires-on.ts+++ b/server/initializers/migrations/0475-redundancy-expires-on.ts@@ -1,9 +1,9 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {{diff --git a/server/initializers/migrations/0480-caption-file-url.ts b/server/initializers/migrations/0480-caption-file-url.tsindex 7d8a3d4b97..1f88206d31 100644--- a/server/initializers/migrations/0480-caption-file-url.ts+++ b/server/initializers/migrations/0480-caption-file-url.ts@@ -1,9 +1,9 @@import * as Sequelize from 'sequelize'async function up (utils: {- transaction: Sequelize.Transaction,- queryInterface: Sequelize.QueryInterface,- sequelize: Sequelize.Sequelize,+ transaction: Sequelize.Transaction+ queryInterface: Sequelize.QueryInterface+ sequelize: Sequelize.Sequelizedb: any}): Promise<void> {{diff --git a/server/initializers/migrator.ts b/server/initializers/migrator.tsindex 1cb0116b7b..77203ae241 100644--- a/server/initializers/migrator.ts+++ b/server/initializers/migrator.ts@@ -20,7 +20,7 @@ async function migrate () {}const rows = await sequelizeTypescript.query<{ migrationVersion: number }>(query, options)- if (rows && rows[0] && rows[0].migrationVersion) {+ if (rows?.[0]?.migrationVersion) {actualVersion = rows[0].migrationVersion}@@ -60,7 +60,7 @@ export {async function getMigrationScripts () {const files = await readdir(path.join(__dirname, 'migrations'))const filesToMigrate: {- version: string,+ version: stringscript: string}[] = []diff --git a/server/lib/activitypub/actor.ts b/server/lib/activitypub/actor.tsindex f802658cfe..3f6edc070c 100644--- a/server/lib/activitypub/actor.ts+++ b/server/lib/activitypub/actor.ts@@ -1,6 +1,6 @@import * as Bluebird from 'bluebird'import { Transaction } from 'sequelize'-import * as url from 'url'+import { URL } from 'url'import * as uuidv4 from 'uuid/v4'import { ActivityPubActor, ActivityPubActorType } from '../../../shared/models/activitypub'import { ActivityPubAttributedTo } from '../../../shared/models/activitypub/objects'@@ -33,8 +33,7 @@ import {MActorFull,MActorFullActor,MActorId,- MChannel,- MChannelAccountDefault+ MChannel} from '../../typings/models'// Set account keys, this could be long so process after the account creation and do not block the client@@ -121,13 +120,13 @@ async function getOrCreateActorAndServerAndModel (if ((created === true || refreshed === true) && updateCollections === true) {const payload = { uri: actor.outboxUrl, type: 'activity' as 'activity' }- await JobQueue.Instance.createJob({ type: 'activitypub-http-fetcher', payload })+ await JobQueue.Instance.createJobWithPromise({ type: 'activitypub-http-fetcher', payload })}// We created a new account: fetch the playlistsif (created === true && actor.Account && accountPlaylistsUrl) {const payload = { uri: accountPlaylistsUrl, accountId: actor.Account.id, type: 'account-playlists' as 'account-playlists' }- await JobQueue.Instance.createJob({ type: 'activitypub-http-fetcher', payload })+ await JobQueue.Instance.createJobWithPromise({ type: 'activitypub-http-fetcher', payload })}return actorRefreshed@@ -215,7 +214,7 @@ async function fetchActorTotalItems (url: string) {}}-async function getAvatarInfoIfExists (actorJSON: ActivityPubActor) {+function getAvatarInfoIfExists (actorJSON: ActivityPubActor) {if (actorJSON.icon && actorJSON.icon.type === 'Image' && MIMETYPES.IMAGE.MIMETYPE_EXT[actorJSON.icon.mediaType] !== undefined &&isActivityPubUrlValid(actorJSON.icon.url)@@ -271,7 +270,10 @@ async function refreshActorIfNeeded <T extends MActorFull | MActorAccountChannelif (statusCode === 404) {logger.info('Deleting actor %s because there is a 404 in refresh actor.', actor.url)- actor.Account ? actor.Account.destroy() : actor.VideoChannel.destroy()+ actor.Account+ ? await actor.Account.destroy()+ : await actor.VideoChannel.destroy()+return { actor: undefined, refreshed: false }}@@ -337,14 +339,14 @@ function saveActorAndServerAndModelIfNotExist (ownerActor?: MActorFullActor,t?: Transaction): Bluebird<MActorFullActor> | Promise<MActorFullActor> {- let actor = result.actor+ const actor = result.actorif (t !== undefined) return save(t)return sequelizeTypescript.transaction(t => save(t))async function save (t: Transaction) {- const actorHost = url.parse(actor.url).host+ const actorHost = new URL(actor.url).hostconst serverOptions = {where: {@@ -402,7 +404,7 @@ type FetchRemoteActorResult = {support?: stringplaylists?: stringavatar?: {- name: string,+ name: stringfileUrl: string}attributedTo: ActivityPubAttributedTo[]diff --git a/server/lib/activitypub/crawl.ts b/server/lib/activitypub/crawl.tsindex 9e469e3e61..eeafdf4ba8 100644--- a/server/lib/activitypub/crawl.ts+++ b/server/lib/activitypub/crawl.ts@@ -3,7 +3,7 @@ import { doRequest } from '../../helpers/requests'import { logger } from '../../helpers/logger'import * as Bluebird from 'bluebird'import { ActivityPubOrderedCollection } from '../../../shared/models/activitypub'-import { parse } from 'url'+import { URL } from 'url'type HandlerFunction<T> = (items: T[]) => (Promise<any> | Bluebird<any>)type CleanerFunction = (startedDate: Date) => (Promise<any> | Bluebird<any>)@@ -24,7 +24,7 @@ async function crawlCollectionPage <T> (uri: string, handler: HandlerFunction<T>const response = await doRequest<ActivityPubOrderedCollection<T>>(options)const firstBody = response.body- let limit = ACTIVITY_PUB.FETCH_PAGE_LIMIT+ const limit = ACTIVITY_PUB.FETCH_PAGE_LIMITlet i = 0let nextLink = firstBody.firstwhile (nextLink && i < limit) {@@ -32,7 +32,7 @@ async function crawlCollectionPage <T> (uri: string, handler: HandlerFunction<T>if (typeof nextLink === 'string') {// Don't crawl ourselves- const remoteHost = parse(nextLink).host+ const remoteHost = new URL(nextLink).hostif (remoteHost === WEBSERVER.HOST) continueoptions.uri = nextLinkdiff --git a/server/lib/activitypub/follow.ts b/server/lib/activitypub/follow.tsindex 1abf43cd40..a1c95504e3 100644--- a/server/lib/activitypub/follow.ts+++ b/server/lib/activitypub/follow.ts@@ -27,7 +27,6 @@ async function autoFollowBackIfNeeded (actorFollow: MActorFollowActors) {}JobQueue.Instance.createJob({ type: 'activitypub-follow', payload })- .catch(err => logger.error('Cannot create auto follow back job for %s.', host, err))}}diff --git a/server/lib/activitypub/send/send-accept.ts b/server/lib/activitypub/send/send-accept.tsindex 9f0225b644..c4c6b849b9 100644--- a/server/lib/activitypub/send/send-accept.ts+++ b/server/lib/activitypub/send/send-accept.ts@@ -5,7 +5,7 @@ import { buildFollowActivity } from './send-follow'import { logger } from '../../../helpers/logger'import { MActor, MActorFollowActors } from '../../../typings/models'-async function sendAccept (actorFollow: MActorFollowActors) {+function sendAccept (actorFollow: MActorFollowActors) {const follower = actorFollow.ActorFollowerconst me = actorFollow.ActorFollowingdiff --git a/server/lib/activitypub/send/send-create.ts b/server/lib/activitypub/send/send-create.tsindex 1709d83484..3585d704ae 100644--- a/server/lib/activitypub/send/send-create.ts+++ b/server/lib/activitypub/send/send-create.ts@@ -130,10 +130,10 @@ export {// ---------------------------------------------------------------------------async function sendVideoRelatedCreateActivity (options: {- byActor: MActorLight,- video: MVideoAccountLight,- url: string,- object: any,+ byActor: MActorLight+ video: MVideoAccountLight+ url: string+ object: anytransaction?: Transaction}) {const activityBuilder = (audience: ActivityAudience) => {diff --git a/server/lib/activitypub/send/send-dislike.ts b/server/lib/activitypub/send/send-dislike.tsindex 6e41f241f7..600469c71c 100644--- a/server/lib/activitypub/send/send-dislike.ts+++ b/server/lib/activitypub/send/send-dislike.ts@@ -6,7 +6,7 @@ import { sendVideoRelatedActivity } from './utils'import { audiencify, getAudience } from '../audience'import { MActor, MActorAudience, MVideoAccountLight, MVideoUrl } from '../../../typings/models'-async function sendDislike (byActor: MActor, video: MVideoAccountLight, t: Transaction) {+function sendDislike (byActor: MActor, video: MVideoAccountLight, t: Transaction) {logger.info('Creating job to dislike %s.', video.url)const activityBuilder = (audience: ActivityAudience) => {diff --git a/server/lib/activitypub/send/send-flag.ts b/server/lib/activitypub/send/send-flag.tsindex da7638a7bb..e4e523631b 100644--- a/server/lib/activitypub/send/send-flag.ts+++ b/server/lib/activitypub/send/send-flag.ts@@ -7,7 +7,7 @@ import { Transaction } from 'sequelize'import { MActor, MVideoFullLight } from '../../../typings/models'import { MVideoAbuseVideo } from '../../../typings/models/video'-async function sendVideoAbuse (byActor: MActor, videoAbuse: MVideoAbuseVideo, video: MVideoFullLight, t: Transaction) {+function sendVideoAbuse (byActor: MActor, videoAbuse: MVideoAbuseVideo, video: MVideoFullLight, t: Transaction) {if (!video.VideoChannel.Account.Actor.serverId) return // Local userconst url = getVideoAbuseActivityPubUrl(videoAbuse)diff --git a/server/lib/activitypub/send/send-like.ts b/server/lib/activitypub/send/send-like.tsindex e84a6f98b0..5db2523251 100644--- a/server/lib/activitypub/send/send-like.ts+++ b/server/lib/activitypub/send/send-like.ts@@ -6,7 +6,7 @@ import { audiencify, getAudience } from '../audience'import { logger } from '../../../helpers/logger'import { MActor, MActorAudience, MVideoAccountLight, MVideoUrl } from '../../../typings/models'-async function sendLike (byActor: MActor, video: MVideoAccountLight, t: Transaction) {+function sendLike (byActor: MActor, video: MVideoAccountLight, t: Transaction) {logger.info('Creating job to like %s.', video.url)const activityBuilder = (audience: ActivityAudience) => {diff --git a/server/lib/activitypub/send/send-reject.ts b/server/lib/activitypub/send/send-reject.tsindex 4258a3c363..643c468a9d 100644--- a/server/lib/activitypub/send/send-reject.ts+++ b/server/lib/activitypub/send/send-reject.ts@@ -5,7 +5,7 @@ import { buildFollowActivity } from './send-follow'import { logger } from '../../../helpers/logger'import { MActor } from '../../../typings/models'-async function sendReject (follower: MActor, following: MActor) {+function sendReject (follower: MActor, following: MActor) {if (!follower.serverId) { // This should never happenlogger.warn('Do not sending reject to local follower.')returndiff --git a/server/lib/activitypub/send/send-undo.ts b/server/lib/activitypub/send/send-undo.tsindex e9ab5b3c59..33f1d4921b 100644--- a/server/lib/activitypub/send/send-undo.ts+++ b/server/lib/activitypub/send/send-undo.ts@@ -28,7 +28,7 @@ import {MVideoShare} from '../../../typings/models'-async function sendUndoFollow (actorFollow: MActorFollowActors, t: Transaction) {+function sendUndoFollow (actorFollow: MActorFollowActors, t: Transaction) {const me = actorFollow.ActorFollowerconst following = actorFollow.ActorFollowing@@ -118,10 +118,10 @@ function undoActivityData (}async function sendUndoVideoRelatedActivity (options: {- byActor: MActor,- video: MVideoAccountLight,- url: string,- activity: ActivityFollow | ActivityLike | ActivityDislike | ActivityCreate | ActivityAnnounce,+ byActor: MActor+ video: MVideoAccountLight+ url: string+ activity: ActivityFollow | ActivityLike | ActivityDislike | ActivityCreate | ActivityAnnouncetransaction: Transaction}) {const activityBuilder = (audience: ActivityAudience) => {diff --git a/server/lib/activitypub/send/send-update.ts b/server/lib/activitypub/send/send-update.tsindex 9c76671b5d..cb500bd347 100644--- a/server/lib/activitypub/send/send-update.ts+++ b/server/lib/activitypub/send/send-update.ts@@ -8,7 +8,6 @@ import { getUpdateActivityPubUrl } from '../url'import { broadcastToFollowers, sendVideoRelatedActivity } from './utils'import { audiencify, getActorsInvolvedInVideo, getAudience } from '../audience'import { logger } from '../../../helpers/logger'-import { VideoCaptionModel } from '../../../models/video/video-caption'import { VideoPlaylistPrivacy } from '../../../../shared/models/videos/playlist/video-playlist-privacy.model'import { getServerActor } from '../../../helpers/utils'import {@@ -29,7 +28,7 @@ async function sendUpdateVideo (videoArg: MVideoAPWithoutCaption, t: Transactionlogger.info('Creating job to update video %s.', video.url)- const byActor = overrodeByActor ? overrodeByActor : video.VideoChannel.Account.Actor+ const byActor = overrodeByActor || video.VideoChannel.Account.Actorconst url = getUpdateActivityPubUrl(video.url, video.updatedAt.toISOString())diff --git a/server/lib/activitypub/send/utils.ts b/server/lib/activitypub/send/utils.tsindex 77b7234796..6fb4efd60c 100644--- a/server/lib/activitypub/send/utils.ts+++ b/server/lib/activitypub/send/utils.ts@@ -10,8 +10,8 @@ import { afterCommitIfTransaction } from '../../../helpers/database-utils'import { MActorWithInboxes, MActor, MActorId, MActorLight, MVideo, MVideoAccountLight } from '../../../typings/models'async function sendVideoRelatedActivity (activityBuilder: (audience: ActivityAudience) => Activity, options: {- byActor: MActorLight,- video: MVideoAccountLight,+ byActor: MActorLight+ video: MVideoAccountLighttransaction?: Transaction}) {const { byActor, video, transaction } = optionsdiff --git a/server/lib/activitypub/video-comments.ts b/server/lib/activitypub/video-comments.tsindex d5c078a298..8642d2432d 100644--- a/server/lib/activitypub/video-comments.ts+++ b/server/lib/activitypub/video-comments.ts@@ -10,9 +10,9 @@ import { checkUrlsSameHost } from '../../helpers/activitypub'import { MCommentOwner, MCommentOwnerVideo, MVideoAccountLightBlacklistAllFiles } from '../../typings/models/video'type ResolveThreadParams = {- url: string,- comments?: MCommentOwner[],- isVideo?: boolean,+ url: string+ comments?: MCommentOwner[]+ isVideo?: booleancommentCreated?: boolean}type ResolveThreadResult = Promise<{ video: MVideoAccountLightBlacklistAllFiles, comment: MCommentOwnerVideo, commentCreated: boolean }>@@ -28,7 +28,7 @@ async function resolveThread (params: ResolveThreadParams): ResolveThreadResultif (params.commentCreated === undefined) params.commentCreated = falseif (params.comments === undefined) params.comments = []- // Already have this comment?+ // Already have this comment?if (isVideo !== true) {const result = await resolveCommentFromDB(params)if (result) return result@@ -87,7 +87,7 @@ async function tryResolveThreadFromVideo (params: ResolveThreadParams) {let resultComment: MCommentOwnerVideoif (comments.length !== 0) {- const firstReply = comments[ comments.length - 1 ] as MCommentOwnerVideo+ const firstReply = comments[comments.length - 1] as MCommentOwnerVideofirstReply.inReplyToCommentId = nullfirstReply.originCommentId = nullfirstReply.videoId = video.id@@ -97,9 +97,9 @@ async function tryResolveThreadFromVideo (params: ResolveThreadParams) {comments[comments.length - 1] = await firstReply.save()for (let i = comments.length - 2; i >= 0; i--) {- const comment = comments[ i ] as MCommentOwnerVideo+ const comment = comments[i] as MCommentOwnerVideocomment.originCommentId = firstReply.id- comment.inReplyToCommentId = comments[ i + 1 ].id+ comment.inReplyToCommentId = comments[i + 1].idcomment.videoId = video.idcomment.changed('updatedAt', true)comment.Video = videodiff --git a/server/lib/activitypub/video-rates.ts b/server/lib/activitypub/video-rates.tsindex 6bd46bb585..79ccfbc7ed 100644--- a/server/lib/activitypub/video-rates.ts+++ b/server/lib/activitypub/video-rates.ts@@ -58,8 +58,6 @@ async function createRates (ratesUrl: string[], video: MVideo, rate: VideoRateTyconst field = rate === 'like' ? 'likes' : 'dislikes'await video.increment(field, { by: rateCounts })}-- return}async function sendVideoRateChange (diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.tsindex 6bc2258cc7..9e43caa204 100644--- a/server/lib/activitypub/videos.ts+++ b/server/lib/activitypub/videos.ts@@ -197,25 +197,25 @@ async function syncVideoExternalAttributes (video: MVideo, fetchedVideo: VideoTojobPayloads.push({ uri: fetchedVideo.comments, videoId: video.id, type: 'video-comments' as 'video-comments' })}- await Bluebird.map(jobPayloads, payload => JobQueue.Instance.createJob({ type: 'activitypub-http-fetcher', payload }))+ await Bluebird.map(jobPayloads, payload => JobQueue.Instance.createJobWithPromise({ type: 'activitypub-http-fetcher', payload }))}function getOrCreateVideoAndAccountAndChannel (options: {- videoObject: { id: string } | string,- syncParam?: SyncParam,- fetchType?: 'all',+ videoObject: { id: string } | string+ syncParam?: SyncParam+ fetchType?: 'all'allowRefresh?: boolean}): Promise<{ video: MVideoAccountLightBlacklistAllFiles, created: boolean, autoBlacklisted?: boolean }>function getOrCreateVideoAndAccountAndChannel (options: {- videoObject: { id: string } | string,- syncParam?: SyncParam,- fetchType?: VideoFetchByUrlType,+ videoObject: { id: string } | string+ syncParam?: SyncParam+ fetchType?: VideoFetchByUrlTypeallowRefresh?: boolean}): Promise<{ video: MVideoAccountLightBlacklistAllFiles | MVideoThumbnail, created: boolean, autoBlacklisted?: boolean }>async function getOrCreateVideoAndAccountAndChannel (options: {- videoObject: { id: string } | string,- syncParam?: SyncParam,- fetchType?: VideoFetchByUrlType,+ videoObject: { id: string } | string+ syncParam?: SyncParam+ fetchType?: VideoFetchByUrlTypeallowRefresh?: boolean // true by default}): Promise<{ video: MVideoAccountLightBlacklistAllFiles | MVideoThumbnail, created: boolean, autoBlacklisted?: boolean }> {// Default params@@ -235,8 +235,14 @@ async function getOrCreateVideoAndAccountAndChannel (options: {syncParam}- if (syncParam.refreshVideo === true) videoFromDatabase = await refreshVideoIfNeeded(refreshOptions)- else await JobQueue.Instance.createJob({ type: 'activitypub-refresher', payload: { type: 'video', url: videoFromDatabase.url } })+ if (syncParam.refreshVideo === true) {+ videoFromDatabase = await refreshVideoIfNeeded(refreshOptions)+ } else {+ await JobQueue.Instance.createJobWithPromise({+ type: 'activitypub-refresher',+ payload: { type: 'video', url: videoFromDatabase.url }+ })+ }}return { video: videoFromDatabase, created: false }@@ -255,10 +261,10 @@ async function getOrCreateVideoAndAccountAndChannel (options: {}async function updateVideoFromAP (options: {- video: MVideoAccountLightBlacklistAllFiles,- videoObject: VideoTorrentObject,- account: MAccountIdActor,- channel: MChannelDefault,+ video: MVideoAccountLightBlacklistAllFiles+ videoObject: VideoTorrentObject+ account: MAccountIdActor+ channel: MChannelDefaultoverrideTo?: string[]}) {const { video, videoObject, account, channel, overrideTo } = options@@ -289,7 +295,7 @@ async function updateVideoFromAP (options: {throw new Error('Account ' + account.Actor.url + ' does not own video channel ' + videoChannel.Actor.url)}- const to = overrideTo ? overrideTo : videoObject.to+ const to = overrideTo || videoObject.toconst videoData = await videoActivityObjectToDBAttributes(channel, videoObject, to)video.name = videoData.namevideo.uuid = videoData.uuid@@ -412,8 +418,8 @@ async function updateVideoFromAP (options: {}async function refreshVideoIfNeeded (options: {- video: MVideoThumbnail,- fetchedType: VideoFetchByUrlType,+ video: MVideoThumbnail+ fetchedType: VideoFetchByUrlTypesyncParam: SyncParam}): Promise<MVideoThumbnail> {if (!options.video.isOutdated()) return options.video@@ -582,13 +588,13 @@ async function createVideo (videoObject: VideoTorrentObject, channel: MChannelActhumbnailModel = videoCreated.idreturn thumbnailModel.save()- })+ }).catch(err => logger.error('Cannot create miniature from url.', { err }))}return { autoBlacklisted, videoCreated }}-async function videoActivityObjectToDBAttributes (videoChannel: MChannelId, videoObject: VideoTorrentObject, to: string[] = []) {+function videoActivityObjectToDBAttributes (videoChannel: MChannelId, videoObject: VideoTorrentObject, to: string[] = []) {const privacy = to.indexOf(ACTIVITY_PUB.PUBLIC) !== -1 ? VideoPrivacy.PUBLIC : VideoPrivacy.UNLISTEDconst duration = videoObject.duration.replace(/[^\d]+/, '')@@ -661,7 +667,7 @@ function videoFileActivityUrlToDBAttributes (const mediaType = fileUrl.mediaTypeconst attribute = {- extname: MIMETYPES.VIDEO.MIMETYPE_EXT[ mediaType ],+ extname: MIMETYPES.VIDEO.MIMETYPE_EXT[mediaType],infoHash: parsed.infoHash,resolution: fileUrl.height,size: fileUrl.size,diff --git a/server/lib/client-html.ts b/server/lib/client-html.tsindex 1d8a08ed0b..572bd03bd3 100644--- a/server/lib/client-html.ts+++ b/server/lib/client-html.ts@@ -17,7 +17,7 @@ import { MAccountActor, MChannelActor, MVideo } from '../typings/models'export class ClientHtml {- private static htmlCache: { [ path: string ]: string } = {}+ private static htmlCache: { [path: string]: string } = {}static invalidCache () {logger.info('Cleaning HTML cache.')@@ -94,7 +94,7 @@ export class ClientHtml {private static async getIndexHTML (req: express.Request, res: express.Response, paramLang?: string) {const path = ClientHtml.getIndexPath(req, res, paramLang)- if (ClientHtml.htmlCache[ path ]) return ClientHtml.htmlCache[ path ]+ if (ClientHtml.htmlCache[path]) return ClientHtml.htmlCache[path]const buffer = await readFile(path)@@ -104,7 +104,7 @@ export class ClientHtml {html = ClientHtml.addCustomCSS(html)html = await ClientHtml.addAsyncPluginCSS(html)- ClientHtml.htmlCache[ path ] = html+ ClientHtml.htmlCache[path] = htmlreturn html}@@ -214,21 +214,21 @@ export class ClientHtml {const schemaTags = {'@context': 'http://schema.org','@type': 'VideoObject',- name: videoNameEscaped,- description: videoDescriptionEscaped,- thumbnailUrl: previewUrl,- uploadDate: video.createdAt.toISOString(),- duration: getActivityStreamDuration(video.duration),- contentUrl: videoUrl,- embedUrl: embedUrl,- interactionCount: video.views+ 'name': videoNameEscaped,+ 'description': videoDescriptionEscaped,+ 'thumbnailUrl': previewUrl,+ 'uploadDate': video.createdAt.toISOString(),+ 'duration': getActivityStreamDuration(video.duration),+ 'contentUrl': videoUrl,+ 'embedUrl': embedUrl,+ 'interactionCount': video.views}let tagsString = ''// OpengraphObject.keys(openGraphMetaTags).forEach(tagName => {- const tagValue = openGraphMetaTags[ tagName ]+ const tagValue = openGraphMetaTags[tagName]tagsString += `<meta property="${tagName}" content="${tagValue}" />`})diff --git a/server/lib/emailer.ts b/server/lib/emailer.tsindex 7484524a45..9ce6186b15 100644--- a/server/lib/emailer.ts+++ b/server/lib/emailer.ts@@ -32,7 +32,8 @@ class Emailer {private initialized = falseprivate transporter: Transporter- private constructor () {}+ private constructor () {+ }init () {// Already initialized@@ -97,12 +98,12 @@ class Emailer {const channelName = video.VideoChannel.getDisplayName()const videoUrl = WEBSERVER.URL + video.getWatchStaticPath()- const text = `Hi dear user,\n\n` ++ const text = 'Hi dear user,\n\n' +`Your subscription ${channelName} just published a new video: ${video.name}` +- `\n\n` ++ '\n\n' +`You can view it on ${videoUrl} ` +- `\n\n` +- `Cheers,\n` ++ '\n\n' ++ 'Cheers,\n' +`${CONFIG.EMAIL.BODY.SIGNATURE}`const emailPayload: EmailPayload = {@@ -118,10 +119,10 @@ class Emailer {const followerName = actorFollow.ActorFollower.Account.getDisplayName()const followingName = (actorFollow.ActorFollowing.VideoChannel || actorFollow.ActorFollowing.Account).getDisplayName()- const text = `Hi dear user,\n\n` ++ const text = 'Hi dear user,\n\n' +`Your ${followType} ${followingName} has a new subscriber: ${followerName}` +- `\n\n` +- `Cheers,\n` ++ '\n\n' ++ 'Cheers,\n' +`${CONFIG.EMAIL.BODY.SIGNATURE}`const emailPayload: EmailPayload = {@@ -136,10 +137,10 @@ class Emailer {addNewInstanceFollowerNotification (to: string[], actorFollow: MActorFollowActors) {const awaitingApproval = actorFollow.state === 'pending' ? ' awaiting manual approval.' : ''- const text = `Hi dear admin,\n\n` ++ const text = 'Hi dear admin,\n\n' +`Your instance has a new follower: ${actorFollow.ActorFollower.url}${awaitingApproval}` +- `\n\n` +- `Cheers,\n` ++ '\n\n' ++ 'Cheers,\n' +`${CONFIG.EMAIL.BODY.SIGNATURE}`const emailPayload: EmailPayload = {@@ -152,10 +153,10 @@ class Emailer {}addAutoInstanceFollowingNotification (to: string[], actorFollow: MActorFollowActors) {- const text = `Hi dear admin,\n\n` ++ const text = 'Hi dear admin,\n\n' +`Your instance automatically followed a new instance: ${actorFollow.ActorFollowing.url}` +- `\n\n` +- `Cheers,\n` ++ '\n\n' ++ 'Cheers,\n' +`${CONFIG.EMAIL.BODY.SIGNATURE}`const emailPayload: EmailPayload = {@@ -170,12 +171,12 @@ class Emailer {myVideoPublishedNotification (to: string[], video: MVideo) {const videoUrl = WEBSERVER.URL + video.getWatchStaticPath()- const text = `Hi dear user,\n\n` ++ const text = 'Hi dear user,\n\n' +`Your video ${video.name} has been published.` +- `\n\n` ++ '\n\n' +`You can view it on ${videoUrl} ` +- `\n\n` +- `Cheers,\n` ++ '\n\n' ++ 'Cheers,\n' +`${CONFIG.EMAIL.BODY.SIGNATURE}`const emailPayload: EmailPayload = {@@ -190,12 +191,12 @@ class Emailer {myVideoImportSuccessNotification (to: string[], videoImport: MVideoImportVideo) {const videoUrl = WEBSERVER.URL + videoImport.Video.getWatchStaticPath()- const text = `Hi dear user,\n\n` ++ const text = 'Hi dear user,\n\n' +`Your video import ${videoImport.getTargetIdentifier()} is finished.` +- `\n\n` ++ '\n\n' +`You can view the imported video on ${videoUrl} ` +- `\n\n` +- `Cheers,\n` ++ '\n\n' ++ 'Cheers,\n' +`${CONFIG.EMAIL.BODY.SIGNATURE}`const emailPayload: EmailPayload = {@@ -210,12 +211,12 @@ class Emailer {myVideoImportErrorNotification (to: string[], videoImport: MVideoImport) {const importUrl = WEBSERVER.URL + '/my-account/video-imports'- const text = `Hi dear user,\n\n` ++ const text = 'Hi dear user,\n\n' +`Your video import ${videoImport.getTargetIdentifier()} encountered an error.` +- `\n\n` ++ '\n\n' +`See your videos import dashboard for more information: ${importUrl}` +- `\n\n` +- `Cheers,\n` ++ '\n\n' ++ 'Cheers,\n' +`${CONFIG.EMAIL.BODY.SIGNATURE}`const emailPayload: EmailPayload = {@@ -232,12 +233,12 @@ class Emailer {const video = comment.Videoconst commentUrl = WEBSERVER.URL + comment.getCommentStaticPath()- const text = `Hi dear user,\n\n` ++ const text = 'Hi dear user,\n\n' +`A new comment has been posted by ${accountName} on your video ${video.name}` +- `\n\n` ++ '\n\n' +`You can view it on ${commentUrl} ` +- `\n\n` +- `Cheers,\n` ++ '\n\n' ++ 'Cheers,\n' +`${CONFIG.EMAIL.BODY.SIGNATURE}`const emailPayload: EmailPayload = {@@ -254,12 +255,12 @@ class Emailer {const video = comment.Videoconst commentUrl = WEBSERVER.URL + comment.getCommentStaticPath()- const text = `Hi dear user,\n\n` ++ const text = 'Hi dear user,\n\n' +`${accountName} mentioned you on video ${video.name}` +- `\n\n` ++ '\n\n' +`You can view the comment on ${commentUrl} ` +- `\n\n` +- `Cheers,\n` ++ '\n\n' ++ 'Cheers,\n' +`${CONFIG.EMAIL.BODY.SIGNATURE}`const emailPayload: EmailPayload = {@@ -274,9 +275,9 @@ class Emailer {addVideoAbuseModeratorsNotification (to: string[], videoAbuse: MVideoAbuseVideo) {const videoUrl = WEBSERVER.URL + videoAbuse.Video.getWatchStaticPath()- const text = `Hi,\n\n` ++ const text = 'Hi,\n\n' +`${WEBSERVER.HOST} received an abuse for the following video ${videoUrl}\n\n` +- `Cheers,\n` ++ 'Cheers,\n' +`${CONFIG.EMAIL.BODY.SIGNATURE}`const emailPayload: EmailPayload = {@@ -292,14 +293,14 @@ class Emailer {const VIDEO_AUTO_BLACKLIST_URL = WEBSERVER.URL + '/admin/moderation/video-auto-blacklist/list'const videoUrl = WEBSERVER.URL + videoBlacklist.Video.getWatchStaticPath()- const text = `Hi,\n\n` +- `A recently added video was auto-blacklisted and requires moderator review before publishing.` +- `\n\n` ++ const text = 'Hi,\n\n' ++ 'A recently added video was auto-blacklisted and requires moderator review before publishing.' ++ '\n\n' +`You can view it and take appropriate action on ${videoUrl}` +- `\n\n` ++ '\n\n' +`A full list of auto-blacklisted videos can be reviewed here: ${VIDEO_AUTO_BLACKLIST_URL}` +- `\n\n` +- `Cheers,\n` ++ '\n\n' ++ 'Cheers,\n' +`${CONFIG.EMAIL.BODY.SIGNATURE}`const emailPayload: EmailPayload = {@@ -312,9 +313,9 @@ class Emailer {}addNewUserRegistrationNotification (to: string[], user: MUser) {- const text = `Hi,\n\n` ++ const text = 'Hi,\n\n' +`User ${user.username} just registered on ${WEBSERVER.HOST} PeerTube instance.\n\n` +- `Cheers,\n` ++ 'Cheers,\n' +`${CONFIG.EMAIL.BODY.SIGNATURE}`const emailPayload: EmailPayload = {@@ -367,11 +368,11 @@ class Emailer {}addPasswordResetEmailJob (to: string, resetPasswordUrl: string) {- const text = `Hi dear user,\n\n` ++ const text = 'Hi dear user,\n\n' +`A reset password procedure for your account ${to} has been requested on ${WEBSERVER.HOST} ` +`Please follow this link to reset it: ${resetPasswordUrl} (the link will expire within 1 hour)\n\n` +- `If you are not the person who initiated this request, please ignore this email.\n\n` +- `Cheers,\n` ++ 'If you are not the person who initiated this request, please ignore this email.\n\n' ++ 'Cheers,\n' +`${CONFIG.EMAIL.BODY.SIGNATURE}`const emailPayload: EmailPayload = {@@ -384,11 +385,11 @@ class Emailer {}addVerifyEmailJob (to: string, verifyEmailUrl: string) {- const text = `Welcome to PeerTube,\n\n` ++ const text = 'Welcome to PeerTube,\n\n' +`To start using PeerTube on ${WEBSERVER.HOST} you must verify your email! ` +`Please follow this link to verify this email belongs to you: ${verifyEmailUrl}\n\n` +- `If you are not the person who initiated this request, please ignore this email.\n\n` +- `Cheers,\n` ++ 'If you are not the person who initiated this request, please ignore this email.\n\n' ++ 'Cheers,\n' +`${CONFIG.EMAIL.BODY.SIGNATURE}`const emailPayload: EmailPayload = {diff --git a/server/lib/files-cache/videos-preview-cache.ts b/server/lib/files-cache/videos-preview-cache.tsindex 7bfeb57833..d0d4fc5b55 100644--- a/server/lib/files-cache/videos-preview-cache.ts+++ b/server/lib/files-cache/videos-preview-cache.ts@@ -1,9 +1,8 @@import { join } from 'path'-import { FILES_CACHE, STATIC_PATHS } from '../../initializers/constants'+import { FILES_CACHE } from '../../initializers/constants'import { VideoModel } from '../../models/video/video'import { AbstractVideoStaticFileCache } from './abstract-video-static-file-cache'import { doRequestAndSaveToFile } from '@server/helpers/requests'-import { buildRemoteVideoBaseUrl } from '@server/helpers/activitypub'class VideosPreviewCache extends AbstractVideoStaticFileCache <string> {diff --git a/server/lib/job-queue/handlers/utils/activitypub-http-utils.ts b/server/lib/job-queue/handlers/utils/activitypub-http-utils.tsindex d3bde6e6a2..a28f3596f7 100644--- a/server/lib/job-queue/handlers/utils/activitypub-http-utils.ts+++ b/server/lib/job-queue/handlers/utils/activitypub-http-utils.ts@@ -42,7 +42,7 @@ async function buildSignedRequestOptions (payload: Payload) {function buildGlobalHeaders (body: any) {return {- 'Digest': buildDigest(body)+ Digest: buildDigest(body)}}diff --git a/server/lib/job-queue/handlers/video-file-import.ts b/server/lib/job-queue/handlers/video-file-import.tsindex 99c991e72a..be9e7d181b 100644--- a/server/lib/job-queue/handlers/video-file-import.ts+++ b/server/lib/job-queue/handlers/video-file-import.ts@@ -11,7 +11,7 @@ import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'import { getVideoFilePath } from '@server/lib/video-paths'export type VideoFileImportPayload = {- videoUUID: string,+ videoUUID: stringfilePath: string}diff --git a/server/lib/job-queue/handlers/video-import.ts b/server/lib/job-queue/handlers/video-import.tsindex 1fca17584f..09f225cec8 100644--- a/server/lib/job-queue/handlers/video-import.ts+++ b/server/lib/job-queue/handlers/video-import.ts@@ -221,7 +221,7 @@ async function processFile (downloader: () => Promise<string>, videoImport: MVidisNewVideo: true}- await JobQueue.Instance.createJob({ type: 'video-transcoding', payload: dataInput })+ await JobQueue.Instance.createJobWithPromise({ type: 'video-transcoding', payload: dataInput })}} catch (err) {diff --git a/server/lib/job-queue/handlers/video-transcoding.ts b/server/lib/job-queue/handlers/video-transcoding.tsindex 39b9fac98c..c020057c93 100644--- a/server/lib/job-queue/handlers/video-transcoding.ts+++ b/server/lib/job-queue/handlers/video-transcoding.ts@@ -6,7 +6,6 @@ import { JobQueue } from '../job-queue'import { federateVideoIfNeeded } from '../../activitypub'import { retryTransactionWrapper } from '../../../helpers/database-utils'import { sequelizeTypescript } from '../../../initializers'-import * as Bluebird from 'bluebird'import { computeResolutionsToTranscode } from '../../../helpers/ffmpeg-utils'import { generateHlsPlaylist, mergeAudioVideofile, optimizeOriginalVideofile, transcodeNewResolution } from '../../video-transcoding'import { Notifier } from '../../notifier'@@ -40,8 +39,11 @@ interface OptimizeTranscodingPayload extends BaseTranscodingPayload {type: 'optimize'}-export type VideoTranscodingPayload = HLSTranscodingPayload | NewResolutionTranscodingPayload- | OptimizeTranscodingPayload | MergeAudioTranscodingPayload+export type VideoTranscodingPayload =+ HLSTranscodingPayload+ | NewResolutionTranscodingPayload+ | OptimizeTranscodingPayload+ | MergeAudioTranscodingPayloadasync function processVideoTranscoding (job: Bull.Job) {const payload = job.data as VideoTranscodingPayload@@ -105,7 +107,7 @@ async function onVideoFileOptimizerSuccess (videoArg: MVideoWithFile, payload: Oconst { videoDatabase, videoPublished } = await sequelizeTypescript.transaction(async t => {// Maybe the video changed in database, refresh it- let videoDatabase = await VideoModel.loadAndPopulateAccountAndServerAndTags(videoArg.uuid, t)+ const videoDatabase = await VideoModel.loadAndPopulateAccountAndServerAndTags(videoArg.uuid, t)// Video does not exist anymoreif (!videoDatabase) return undefined@@ -122,8 +124,6 @@ async function onVideoFileOptimizerSuccess (videoArg: MVideoWithFile, payload: Oawait createHlsJobIfEnabled(hlsPayload)if (resolutionsEnabled.length !== 0) {- const tasks: (Bluebird<Bull.Job<any>> | Promise<Bull.Job<any>>)[] = []-for (const resolution of resolutionsEnabled) {let dataInput: VideoTranscodingPayload@@ -143,12 +143,9 @@ async function onVideoFileOptimizerSuccess (videoArg: MVideoWithFile, payload: O}}- const p = JobQueue.Instance.createJob({ type: 'video-transcoding', payload: dataInput })- tasks.push(p)+ JobQueue.Instance.createJob({ type: 'video-transcoding', payload: dataInput })}- await Promise.all(tasks)-logger.info('Transcoding jobs created for uuid %s.', videoDatabase.uuid, { resolutionsEnabled })} else {// No transcoding to do, it's now publisheddiff --git a/server/lib/job-queue/job-queue.ts b/server/lib/job-queue/job-queue.tsindex 61f07c4871..14acace7da 100644--- a/server/lib/job-queue/job-queue.ts+++ b/server/lib/job-queue/job-queue.ts@@ -28,7 +28,7 @@ type CreateJobArgument ={ type: 'videos-views', payload: {} } |{ type: 'video-redundancy', payload: VideoRedundancyPayload }-const handlers: { [ id in JobType ]: (job: Bull.Job) => Promise<any>} = {+const handlers: { [id in JobType]: (job: Bull.Job) => Promise<any> } = {'activitypub-http-broadcast': processActivityPubHttpBroadcast,'activitypub-http-unicast': processActivityPubHttpUnicast,'activitypub-http-fetcher': processActivityPubHttpFetcher,@@ -60,13 +60,14 @@ class JobQueue {private static instance: JobQueue- private queues: { [ id in JobType ]?: Bull.Queue } = {}+ private queues: { [id in JobType]?: Bull.Queue } = {}private initialized = falseprivate jobRedisPrefix: string- private constructor () {}+ private constructor () {+ }- async init () {+ init () {// Already initializedif (this.initialized === true) returnthis.initialized = true@@ -108,11 +109,16 @@ class JobQueue {}}- createJob (obj: CreateJobArgument) {+ createJob (obj: CreateJobArgument): void {+ this.createJobWithPromise(obj)+ .catch(err => logger.error('Cannot create job.', { err, obj }))+ }++ createJobWithPromise (obj: CreateJobArgument) {const queue = this.queues[obj.type]if (queue === undefined) {logger.error('Unknown queue %s: cannot create job.', obj.type)- throw Error('Unknown queue, cannot create job')+ return}const jobArgs: Bull.JobOptions = {@@ -125,10 +131,10 @@ class JobQueue {}async listForApi (options: {- state: JobState,- start: number,- count: number,- asc?: boolean,+ state: JobState+ start: number+ count: number+ asc?: booleanjobType: JobType}): Promise<Bull.Job[]> {const { state, start, count, asc, jobType } = options@@ -137,7 +143,7 @@ class JobQueue {const filteredJobTypes = this.filterJobTypes(jobType)for (const jobType of filteredJobTypes) {- const queue = this.queues[ jobType ]+ const queue = this.queues[jobType]if (queue === undefined) {logger.error('Unknown queue %s to list jobs.', jobType)continue@@ -165,7 +171,7 @@ class JobQueue {const filteredJobTypes = this.filterJobTypes(jobType)for (const type of filteredJobTypes) {- const queue = this.queues[ type ]+ const queue = this.queues[type]if (queue === undefined) {logger.error('Unknown queue %s to count jobs.', type)continue@@ -173,7 +179,7 @@ class JobQueue {const counts = await queue.getJobCounts()- total += counts[ state ]+ total += counts[state]}return total@@ -189,7 +195,7 @@ class JobQueue {private addRepeatableJobs () {this.queues['videos-views'].add({}, {repeat: REPEAT_JOBS['videos-views']- })+ }).catch(err => logger.error('Cannot add repeatable job.', { err }))}private filterJobTypes (jobType?: JobType) {diff --git a/server/lib/moderation.ts b/server/lib/moderation.tsindex b609f45851..55f7a985de 100644--- a/server/lib/moderation.ts+++ b/server/lib/moderation.ts@@ -15,41 +15,41 @@ export type AcceptResult = {// Can be filtered by pluginsfunction isLocalVideoAccepted (object: {- videoBody: VideoCreate,- videoFile: Express.Multer.File & { duration?: number },+ videoBody: VideoCreate+ videoFile: Express.Multer.File & { duration?: number }user: UserModel}): AcceptResult {return { accepted: true }}function isLocalVideoThreadAccepted (_object: {- commentBody: VideoCommentCreate,- video: VideoModel,+ commentBody: VideoCommentCreate+ video: VideoModeluser: UserModel}): AcceptResult {return { accepted: true }}function isLocalVideoCommentReplyAccepted (_object: {- commentBody: VideoCommentCreate,- parentComment: VideoCommentModel,- video: VideoModel,+ commentBody: VideoCommentCreate+ parentComment: VideoCommentModel+ video: VideoModeluser: UserModel}): AcceptResult {return { accepted: true }}function isRemoteVideoAccepted (_object: {- activity: ActivityCreate,- videoAP: VideoTorrentObject,+ activity: ActivityCreate+ videoAP: VideoTorrentObjectbyActor: ActorModel}): AcceptResult {return { accepted: true }}function isRemoteVideoCommentAccepted (_object: {- activity: ActivityCreate,- commentAP: VideoCommentObject,+ activity: ActivityCreate+ commentAP: VideoCommentObjectbyActor: ActorModel}): AcceptResult {return { accepted: true }diff --git a/server/lib/notifier.ts b/server/lib/notifier.tsindex 679b9bcf68..63197eee13 100644--- a/server/lib/notifier.ts+++ b/server/lib/notifier.ts@@ -6,7 +6,6 @@ import { UserModel } from '../models/account/user'import { PeerTubeSocket } from './peertube-socket'import { CONFIG } from '../initializers/config'import { VideoPrivacy, VideoState } from '../../shared/models/videos'-import * as Bluebird from 'bluebird'import { AccountBlocklistModel } from '../models/account/account-blocklist'import {MCommentOwnerVideo,@@ -17,7 +16,8 @@ import {MVideoFullLight} from '../typings/models/video'import {- MUser, MUserAccount,+ MUser,+ MUserAccount,MUserDefault,MUserNotifSettingAccount,MUserWithNotificationSetting,@@ -32,14 +32,15 @@ class Notifier {private static instance: Notifier- private constructor () {}+ private constructor () {+ }notifyOnNewVideoIfNeeded (video: MVideoAccountLight): void {// Only notify on public and published videos which are not blacklistedif (video.privacy !== VideoPrivacy.PUBLIC || video.state !== VideoState.PUBLISHED || video.isBlacklisted()) returnthis.notifySubscribersOfNewVideo(video)- .catch(err => logger.error('Cannot notify subscribers of new video %s.', video.url, { err }))+ .catch(err => logger.error('Cannot notify subscribers of new video %s.', video.url, { err }))}notifyOnVideoPublishedAfterTranscoding (video: MVideoFullLight): void {@@ -63,7 +64,9 @@ class Notifier {if (video.ScheduleVideoUpdate || (video.waitTranscoding && video.state !== VideoState.PUBLISHED)) returnthis.notifyOwnedVideoHasBeenPublished(video)- .catch(err => logger.error('Cannot notify owner that its video %s has been published after removed from auto-blacklist.', video.url, { err })) // tslint:disable-line:max-line-length+ .catch(err => {+ logger.error('Cannot notify owner that its video %s has been published after removed from auto-blacklist.', video.url, { err })+ })}notifyOnNewComment (comment: MCommentOwnerVideo): void {@@ -76,17 +79,17 @@ class Notifier {notifyOnNewVideoAbuse (videoAbuse: MVideoAbuseVideo): void {this.notifyModeratorsOfNewVideoAbuse(videoAbuse)- .catch(err => logger.error('Cannot notify of new video abuse of video %s.', videoAbuse.Video.url, { err }))+ .catch(err => logger.error('Cannot notify of new video abuse of video %s.', videoAbuse.Video.url, { err }))}notifyOnVideoAutoBlacklist (videoBlacklist: MVideoBlacklistLightVideo): void {this.notifyModeratorsOfVideoAutoBlacklist(videoBlacklist)- .catch(err => logger.error('Cannot notify of auto-blacklist of video %s.', videoBlacklist.Video.url, { err }))+ .catch(err => logger.error('Cannot notify of auto-blacklist of video %s.', videoBlacklist.Video.url, { err }))}notifyOnVideoBlacklist (videoBlacklist: MVideoBlacklistVideo): void {this.notifyVideoOwnerOfBlacklist(videoBlacklist)- .catch(err => logger.error('Cannot notify video owner of new video blacklist of %s.', videoBlacklist.Video.url, { err }))+ .catch(err => logger.error('Cannot notify video owner of new video blacklist of %s.', videoBlacklist.Video.url, { err }))}notifyOnVideoUnblacklist (video: MVideoFullLight): void {@@ -96,7 +99,7 @@ class Notifier {notifyOnFinishedVideoImport (videoImport: MVideoImportVideo, success: boolean): void {this.notifyOwnerVideoImportIsFinished(videoImport, success)- .catch(err => logger.error('Cannot notify owner that its video import %s is finished.', videoImport.getTargetIdentifier(), { err }))+ .catch(err => logger.error('Cannot notify owner that its video import %s is finished.', videoImport.getTargetIdentifier(), { err }))}notifyOnNewUserRegistration (user: MUserDefault): void {@@ -106,14 +109,14 @@ class Notifier {notifyOfNewUserFollow (actorFollow: MActorFollowFull): void {this.notifyUserOfNewActorFollow(actorFollow)- .catch(err => {- logger.error(- 'Cannot notify owner of channel %s of a new follow by %s.',- actorFollow.ActorFollowing.VideoChannel.getDisplayName(),- actorFollow.ActorFollower.Account.getDisplayName(),- { err }- )- })+ .catch(err => {+ logger.error(+ 'Cannot notify owner of channel %s of a new follow by %s.',+ actorFollow.ActorFollowing.VideoChannel.getDisplayName(),+ actorFollow.ActorFollower.Account.getDisplayName(),+ { err }+ )+ })}notifyOfNewInstanceFollow (actorFollow: MActorFollowFull): void {@@ -548,10 +551,10 @@ class Notifier {return this.notify({ users: moderators, settingGetter, notificationCreator, emailSender })}- private async notify <T extends MUserWithNotificationSetting> (options: {- users: T[],- notificationCreator: (user: T) => Promise<UserNotificationModelForApi>,- emailSender: (emails: string[]) => Promise<any> | Bluebird<any>,+ private async notify<T extends MUserWithNotificationSetting> (options: {+ users: T[]+ notificationCreator: (user: T) => Promise<UserNotificationModelForApi>+ emailSender: (emails: string[]) => voidsettingGetter: (user: T) => UserNotificationSettingValue}) {const emails: string[] = []@@ -569,7 +572,7 @@ class Notifier {}if (emails.length !== 0) {- await options.emailSender(emails)+ options.emailSender(emails)}}diff --git a/server/lib/plugins/plugin-index.ts b/server/lib/plugins/plugin-index.tsindex 25b4f3c617..dcdfba28c5 100644--- a/server/lib/plugins/plugin-index.ts+++ b/server/lib/plugins/plugin-index.ts@@ -31,7 +31,7 @@ async function listAvailablePluginsFromIndex (options: PeertubePluginIndexList)logger.debug('Got result from PeerTube index.', { body })- await addInstanceInformation(body)+ addInstanceInformation(body)return body as ResultList<PeerTubePluginIndex>} catch (err) {@@ -40,7 +40,7 @@ async function listAvailablePluginsFromIndex (options: PeertubePluginIndexList)}}-async function addInstanceInformation (result: ResultList<PeerTubePluginIndex>) {+function addInstanceInformation (result: ResultList<PeerTubePluginIndex>) {for (const d of result.data) {d.installed = PluginManager.Instance.isRegistered(d.npmName)d.name = PluginModel.normalizePluginName(d.npmName)diff --git a/server/lib/plugins/plugin-manager.ts b/server/lib/plugins/plugin-manager.tsindex 7ebdabd345..73f7a71cea 100644--- a/server/lib/plugins/plugin-manager.ts+++ b/server/lib/plugins/plugin-manager.ts@@ -55,30 +55,30 @@ export interface HookInformationValue {}type AlterableVideoConstant = 'language' | 'licence' | 'category'-type VideoConstant = { [ key in number | string ]: string }+type VideoConstant = { [key in number | string]: string }type UpdatedVideoConstant = {- [ name in AlterableVideoConstant ]: {- [ npmName: string ]: {- added: { key: number | string, label: string }[],+ [name in AlterableVideoConstant]: {+ [npmName: string]: {+ added: { key: number | string, label: string }[]deleted: { key: number | string, label: string }[]}}}type PluginLocalesTranslations = {- [ locale: string ]: PluginTranslation+ [locale: string]: PluginTranslation}export class PluginManager implements ServerHook {private static instance: PluginManager- private registeredPlugins: { [ name: string ]: RegisteredPlugin } = {}- private settings: { [ name: string ]: RegisterServerSettingOptions[] } = {}- private hooks: { [ name: string ]: HookInformationValue[] } = {}+ private registeredPlugins: { [name: string]: RegisteredPlugin } = {}+ private settings: { [name: string]: RegisterServerSettingOptions[] } = {}+ private hooks: { [name: string]: HookInformationValue[] } = {}private translations: PluginLocalesTranslations = {}- private updatedVideoConstants: UpdatedVideoConstant = {+ private readonly updatedVideoConstants: UpdatedVideoConstant = {language: {},licence: {},category: {}@@ -133,7 +133,7 @@ export class PluginManager implements ServerHook {// ###################### Hooks ######################- async runHook <T> (hookName: ServerHookName, result?: T, params?: any): Promise<T> {+ async runHook<T> (hookName: ServerHookName, result?: T, params?: any): Promise<T> {if (!this.hooks[hookName]) return Promise.resolve(result)const hookType = getHookType(hookName)@@ -312,7 +312,7 @@ export class PluginManager implements ServerHook {clientScripts[c.script] = c}- this.registeredPlugins[ npmName ] = {+ this.registeredPlugins[npmName] = {npmName,name: plugin.name,type: plugin.type,@@ -438,7 +438,7 @@ export class PluginManager implements ServerHook {const plugins: RegisteredPlugin[] = []for (const npmName of Object.keys(this.registeredPlugins)) {- const plugin = this.registeredPlugins[ npmName ]+ const plugin = this.registeredPlugins[npmName]if (plugin.type !== type) continueplugins.push(plugin)@@ -518,11 +518,11 @@ export class PluginManager implements ServerHook {}}- private addConstant <T extends string | number> (parameters: {- npmName: string,- type: AlterableVideoConstant,- obj: VideoConstant,- key: T,+ private addConstant<T extends string | number> (parameters: {+ npmName: string+ type: AlterableVideoConstant+ obj: VideoConstant+ key: Tlabel: string}) {const { npmName, type, obj, key, label } = parameters@@ -545,10 +545,10 @@ export class PluginManager implements ServerHook {return true}- private deleteConstant <T extends string | number> (parameters: {- npmName: string,- type: AlterableVideoConstant,- obj: VideoConstant,+ private deleteConstant<T extends string | number> (parameters: {+ npmName: string+ type: AlterableVideoConstant+ obj: VideoConstantkey: T}) {const { npmName, type, obj, key } = parameters@@ -604,7 +604,7 @@ export class PluginManager implements ServerHook {const { result: packageJSONValid, badFields } = isPackageJSONValid(packageJSON, pluginType)if (!packageJSONValid) {const formattedFields = badFields.map(f => `"${f}"`)- .join(', ')+ .join(', ')throw new Error(`PackageJSON is invalid (invalid fields: ${formattedFields}).`)}diff --git a/server/lib/redis.ts b/server/lib/redis.tsindex f77d0b62c2..0c5dbdd3ec 100644--- a/server/lib/redis.ts+++ b/server/lib/redis.ts@@ -12,7 +12,7 @@ import {import { CONFIG } from '../initializers/config'type CachedRoute = {- body: string,+ body: stringcontentType?: stringstatusCode?: string}@@ -24,7 +24,8 @@ class Redis {private client: RedisClientprivate prefix: string- private constructor () {}+ private constructor () {+ }init () {// Already initialized@@ -49,9 +50,9 @@ class Redis {return Object.assign({},(CONFIG.REDIS.AUTH && CONFIG.REDIS.AUTH != null) ? { password: CONFIG.REDIS.AUTH } : {},(CONFIG.REDIS.DB) ? { db: CONFIG.REDIS.DB } : {},- (CONFIG.REDIS.HOSTNAME && CONFIG.REDIS.PORT) ?- { host: CONFIG.REDIS.HOSTNAME, port: CONFIG.REDIS.PORT } :- { path: CONFIG.REDIS.SOCKET }+ (CONFIG.REDIS.HOSTNAME && CONFIG.REDIS.PORT)+ ? { host: CONFIG.REDIS.HOSTNAME, port: CONFIG.REDIS.PORT }+ : { path: CONFIG.REDIS.SOCKET })}@@ -63,7 +64,7 @@ class Redis {return this.prefix}- /************* Forgot password *************/+ /* ************ Forgot password ************ */async setResetPasswordVerificationString (userId: number) {const generatedString = await generateRandomString(32)@@ -77,7 +78,7 @@ class Redis {return this.getValue(this.generateResetPasswordKey(userId))}- /************* Email verification *************/+ /* ************ Email verification ************ */async setVerifyEmailVerificationString (userId: number) {const generatedString = await generateRandomString(32)@@ -91,7 +92,7 @@ class Redis {return this.getValue(this.generateVerifyEmailKey(userId))}- /************* Contact form per IP *************/+ /* ************ Contact form per IP ************ */async setContactFormIp (ip: string) {return this.setValue(this.generateContactFormKey(ip), '1', CONTACT_FORM_LIFETIME)@@ -101,7 +102,7 @@ class Redis {return this.exists(this.generateContactFormKey(ip))}- /************* Views per IP *************/+ /* ************ Views per IP ************ */setIPVideoView (ip: string, videoUUID: string) {return this.setValue(this.generateViewKey(ip, videoUUID), '1', VIDEO_VIEW_LIFETIME)@@ -111,7 +112,7 @@ class Redis {return this.exists(this.generateViewKey(ip, videoUUID))}- /************* API cache *************/+ /* ************ API cache ************ */async getCachedRoute (req: express.Request) {const cached = await this.getObject(this.generateCachedRouteKey(req))@@ -120,17 +121,17 @@ class Redis {}setCachedRoute (req: express.Request, body: any, lifetime: number, contentType?: string, statusCode?: number) {- const cached: CachedRoute = Object.assign({}, {- body: body.toString()- },- (contentType) ? { contentType } : null,- (statusCode) ? { statusCode: statusCode.toString() } : null+ const cached: CachedRoute = Object.assign(+ {},+ { body: body.toString() },+ (contentType) ? { contentType } : null,+ (statusCode) ? { statusCode: statusCode.toString() } : null)return this.setObject(this.generateCachedRouteKey(req), cached, lifetime)}- /************* Video views *************/+ /* ************ Video views ************ */addVideoView (videoId: number) {const keyIncr = this.generateVideoViewKey(videoId)@@ -173,7 +174,7 @@ class Redis {])}- /************* Keys generation *************/+ /* ************ Keys generation ************ */generateCachedRouteKey (req: express.Request) {return req.method + '-' + req.originalUrl@@ -207,7 +208,7 @@ class Redis {return 'contact-form-' + ip}- /************* Redis helpers *************/+ /* ************ Redis helpers ************ */private getValue (key: string) {return new Promise<string>((res, rej) => {@@ -265,7 +266,7 @@ class Redis {})}- private setObject (key: string, obj: { [ id: string ]: string }, expirationMilliseconds: number) {+ private setObject (key: string, obj: { [id: string]: string }, expirationMilliseconds: number) {return new Promise<void>((res, rej) => {this.client.hmset(this.prefix + key, obj, (err, ok) => {if (err) return rej(err)@@ -282,7 +283,7 @@ class Redis {}private getObject (key: string) {- return new Promise<{ [ id: string ]: string }>((res, rej) => {+ return new Promise<{ [id: string]: string }>((res, rej) => {this.client.hgetall(this.prefix + key, (err, value) => {if (err) return rej(err)diff --git a/server/lib/schedulers/auto-follow-index-instances.ts b/server/lib/schedulers/auto-follow-index-instances.tsindex dd326bc1e1..d700a99f0b 100644--- a/server/lib/schedulers/auto-follow-index-instances.ts+++ b/server/lib/schedulers/auto-follow-index-instances.ts@@ -57,8 +57,7 @@ export class AutoFollowIndexInstances extends AbstractScheduler {isAutoFollow: true}- await JobQueue.Instance.createJob({ type: 'activitypub-follow', payload })- .catch(err => logger.error('Cannot create follow job for %s.', unfollowedHost, err))+ JobQueue.Instance.createJob({ type: 'activitypub-follow', payload })}}diff --git a/server/lib/schedulers/plugins-check-scheduler.ts b/server/lib/schedulers/plugins-check-scheduler.tsindex 7ff41e6394..014993e94c 100644--- a/server/lib/schedulers/plugins-check-scheduler.ts+++ b/server/lib/schedulers/plugins-check-scheduler.ts@@ -43,7 +43,7 @@ export class PluginsCheckScheduler extends AbstractScheduler {const results = await getLatestPluginsVersion(npmNames)for (const result of results) {- const plugin = pluginIndex[ result.npmName ]+ const plugin = pluginIndex[result.npmName]if (!result.latestVersion) continueif (diff --git a/server/lib/schedulers/remove-old-views-scheduler.ts b/server/lib/schedulers/remove-old-views-scheduler.tsindex 39fbb9163b..5ae87fe504 100644--- a/server/lib/schedulers/remove-old-views-scheduler.ts+++ b/server/lib/schedulers/remove-old-views-scheduler.ts@@ -1,9 +1,7 @@import { logger } from '../../helpers/logger'import { AbstractScheduler } from './abstract-scheduler'import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants'-import { UserVideoHistoryModel } from '../../models/account/user-video-history'import { CONFIG } from '../../initializers/config'-import { isTestInstance } from '../../helpers/core-utils'import { VideoViewModel } from '../../models/video/video-views'export class RemoveOldViewsScheduler extends AbstractScheduler {diff --git a/server/lib/schedulers/videos-redundancy-scheduler.ts b/server/lib/schedulers/videos-redundancy-scheduler.tsindex 6e61cbe7d7..e33a4133ae 100644--- a/server/lib/schedulers/videos-redundancy-scheduler.ts+++ b/server/lib/schedulers/videos-redundancy-scheduler.ts@@ -28,9 +28,9 @@ import { getVideoFilename } from '../video-paths'import { VideoModel } from '@server/models/video/video'type CandidateToDuplicate = {- redundancy: VideosRedundancyStrategy,- video: MVideoWithAllFiles,- files: MVideoFile[],+ redundancy: VideosRedundancyStrategy+ video: MVideoWithAllFiles+ files: MVideoFile[]streamingPlaylists: MStreamingPlaylistFiles[]}diff --git a/server/lib/thumbnail.ts b/server/lib/thumbnail.tsindex a99f716290..8dbd417711 100644--- a/server/lib/thumbnail.ts+++ b/server/lib/thumbnail.ts@@ -69,7 +69,7 @@ function generateVideoMiniature (video: MVideoThumbnail, videoFile: MVideoFile,function createPlaceholderThumbnail (fileUrl: string, video: MVideoThumbnail, type: ThumbnailType, size: ImageSize) {const { filename, height, width, existingThumbnail } = buildMetadataFromVideo(video, type, size)- const thumbnail = existingThumbnail ? existingThumbnail : new ThumbnailModel()+ const thumbnail = existingThumbnail || new ThumbnailModel()thumbnail.filename = filenamethumbnail.height = height@@ -142,18 +142,18 @@ function buildMetadataFromVideo (video: MVideoThumbnail, type: ThumbnailType, si}async function createThumbnailFromFunction (parameters: {- thumbnailCreator: () => Promise<any>,- filename: string,- height: number,- width: number,- type: ThumbnailType,- automaticallyGenerated?: boolean,- fileUrl?: string,+ thumbnailCreator: () => Promise<any>+ filename: string+ height: number+ width: number+ type: ThumbnailType+ automaticallyGenerated?: boolean+ fileUrl?: stringexistingThumbnail?: MThumbnail}) {const { thumbnailCreator, filename, width, height, type, existingThumbnail, automaticallyGenerated = null, fileUrl = null } = parameters- const thumbnail = existingThumbnail ? existingThumbnail : new ThumbnailModel()+ const thumbnail = existingThumbnail || new ThumbnailModel()thumbnail.filename = filenamethumbnail.height = heightdiff --git a/server/lib/user.ts b/server/lib/user.tsindex c45438d95b..88e60a7df5 100644--- a/server/lib/user.ts+++ b/server/lib/user.ts@@ -18,9 +18,9 @@ import { MUser, MUserDefault, MUserId } from '../typings/models/user'type ChannelNames = { name: string, displayName: string }async function createUserAccountAndChannelAndPlaylist (parameters: {- userToCreate: MUser,- userDisplayName?: string,- channelNames?: ChannelNames,+ userToCreate: MUser+ userDisplayName?: string+ channelNames?: ChannelNamesvalidateUser?: boolean}): Promise<{ user: MUserDefault, account: MAccountDefault, videoChannel: MChannelActor }> {const { userToCreate, userDisplayName, channelNames, validateUser = true } = parameters@@ -63,11 +63,11 @@ async function createUserAccountAndChannelAndPlaylist (parameters: {}async function createLocalAccountWithoutKeys (parameters: {- name: string,- displayName?: string,- userId: number | null,- applicationId: number | null,- t: Transaction | undefined,+ name: string+ displayName?: string+ userId: number | null+ applicationId: number | null+ t: Transaction | undefinedtype?: ActivityPubActorType}) {const { name, displayName, userId, applicationId, t, type = 'Person' } = parametersdiff --git a/server/lib/video-blacklist.ts b/server/lib/video-blacklist.tsindex 1dd45b76d9..3b90b1b941 100644--- a/server/lib/video-blacklist.ts+++ b/server/lib/video-blacklist.ts@@ -9,15 +9,15 @@ import { Notifier } from './notifier'import { MUser, MVideoBlacklistVideo, MVideoWithBlacklistLight } from '@server/typings/models'async function autoBlacklistVideoIfNeeded (parameters: {- video: MVideoWithBlacklistLight,- user?: MUser,- isRemote: boolean,- isNew: boolean,- notify?: boolean,+ video: MVideoWithBlacklistLight+ user?: MUser+ isRemote: boolean+ isNew: boolean+ notify?: booleantransaction?: Transaction}) {const { video, user, isRemote, isNew, notify = true, transaction } = parameters- const doAutoBlacklist = await Hooks.wrapPromiseFun(+ const doAutoBlacklist = await Hooks.wrapFun(autoBlacklistNeeded,{ video, user, isRemote, isNew },'filter:video.auto-blacklist.result'@@ -49,10 +49,10 @@ async function autoBlacklistVideoIfNeeded (parameters: {return true}-async function autoBlacklistNeeded (parameters: {- video: MVideoWithBlacklistLight,- isRemote: boolean,- isNew: boolean,+function autoBlacklistNeeded (parameters: {+ video: MVideoWithBlacklistLight+ isRemote: boolean+ isNew: booleanuser?: MUser}) {const { user, video, isRemote, isNew } = parametersdiff --git a/server/lib/video-channel.ts b/server/lib/video-channel.tsindex 41eab456bb..14829c9d65 100644--- a/server/lib/video-channel.ts+++ b/server/lib/video-channel.ts@@ -6,8 +6,7 @@ import { buildActorInstance, federateVideoIfNeeded, getVideoChannelActivityPubUrimport { VideoModel } from '../models/video/video'import { MAccountId, MChannelDefault, MChannelId } from '../typings/models'-type CustomVideoChannelModelAccount <T extends MAccountId> = MChannelDefault &- { Account?: T }+type CustomVideoChannelModelAccount <T extends MAccountId> = MChannelDefault & { Account?: T }async function createLocalVideoChannel <T extends MAccountId> (videoChannelInfo: VideoChannelCreate,diff --git a/server/lib/video-comment.ts b/server/lib/video-comment.tsindex b8074e6d20..fe83d23e7b 100644--- a/server/lib/video-comment.ts+++ b/server/lib/video-comment.ts@@ -7,9 +7,9 @@ import { sendCreateVideoComment } from './activitypub/send'import { MAccountDefault, MComment, MCommentOwnerVideoReply, MVideoFullLight } from '../typings/models'async function createVideoComment (obj: {- text: string,- inReplyToComment: MComment | null,- video: MVideoFullLight,+ text: string+ inReplyToComment: MComment | null+ video: MVideoFullLightaccount: MAccountDefault}, t: Sequelize.Transaction) {let originCommentId: number | null = nulldiff --git a/server/middlewares/activitypub.ts b/server/middlewares/activitypub.tsindex f3feae41e2..ab7d04d25b 100644--- a/server/middlewares/activitypub.ts+++ b/server/middlewares/activitypub.ts@@ -6,6 +6,7 @@ import { ACCEPT_HEADERS, ACTIVITY_PUB, HTTP_SIGNATURE } from '../initializers/coimport { getOrCreateActorAndServerAndModel } from '../lib/activitypub'import { loadActorUrlOrGetFromWebfinger } from '../helpers/webfinger'import { isActorDeleteActivityValid } from '@server/helpers/custom-validators/activitypub/actor'+import { getAPId } from '@server/helpers/activitypub'async function checkSignature (req: Request, res: Response, next: NextFunction) {try {@@ -16,7 +17,7 @@ async function checkSignature (req: Request, res: Response, next: NextFunction)// Forwarded activityconst bodyActor = req.body.actor- const bodyActorId = bodyActor && bodyActor.id ? bodyActor.id : bodyActor+ const bodyActorId = getAPId(bodyActor)if (bodyActorId && bodyActorId !== actor.url) {const jsonLDSignatureChecked = await checkJsonLDSignature(req, res)if (jsonLDSignatureChecked !== true) returndiff --git a/server/middlewares/csp.ts b/server/middlewares/csp.tsindex d11d707900..f5de696031 100644--- a/server/middlewares/csp.ts+++ b/server/middlewares/csp.ts@@ -3,20 +3,20 @@ import { CONFIG } from '../initializers/config'const baseDirectives = Object.assign({},{- defaultSrc: ["'none'"], // by default, not specifying default-src = '*'- connectSrc: ['*', 'data:'],- mediaSrc: ["'self'", 'https:', 'blob:'],- fontSrc: ["'self'", 'data:'],- imgSrc: ["'self'", 'data:', 'blob:'],- scriptSrc: ["'self' 'unsafe-inline' 'unsafe-eval'", 'blob:'],- styleSrc: ["'self' 'unsafe-inline'"],- objectSrc: ["'none'"], // only define to allow plugins, else let defaultSrc 'none' block it- formAction: ["'self'"],- frameAncestors: ["'none'"],- baseUri: ["'self'"],- manifestSrc: ["'self'"],- frameSrc: ["'self'"], // instead of deprecated child-src / self because of test-embed- workerSrc: ["'self'", 'blob:'] // instead of deprecated child-src+ defaultSrc: [ '\'none\'' ], // by default, not specifying default-src = '*'+ connectSrc: [ '*', 'data:' ],+ mediaSrc: [ '\'self\'', 'https:', 'blob:' ],+ fontSrc: [ '\'self\'', 'data:' ],+ imgSrc: [ '\'self\'', 'data:', 'blob:' ],+ scriptSrc: [ '\'self\' \'unsafe-inline\' \'unsafe-eval\'', 'blob:' ],+ styleSrc: [ '\'self\' \'unsafe-inline\'' ],+ objectSrc: [ '\'none\'' ], // only define to allow plugins, else let defaultSrc 'none' block it+ formAction: [ '\'self\'' ],+ frameAncestors: [ '\'none\'' ],+ baseUri: [ '\'self\'' ],+ manifestSrc: [ '\'self\'' ],+ frameSrc: [ '\'self\'' ], // instead of deprecated child-src / self because of test-embed+ workerSrc: [ '\'self\'', 'blob:' ] // instead of deprecated child-src},CONFIG.CSP.REPORT_URI ? { reportUri: CONFIG.CSP.REPORT_URI } : {},CONFIG.WEBSERVER.SCHEME === 'https' ? { upgradeInsecureRequests: true } : {}@@ -29,7 +29,7 @@ const baseCSP = helmet.contentSecurityPolicy({})const embedCSP = helmet.contentSecurityPolicy({- directives: Object.assign({}, baseDirectives, { frameAncestors: ['*'] }),+ directives: Object.assign({}, baseDirectives, { frameAncestors: [ '*' ] }),browserSniff: false, // assumes a modern browser, but allows CDN in frontreportOnly: CONFIG.CSP.REPORT_ONLY})diff --git a/server/middlewares/dnt.ts b/server/middlewares/dnt.tsindex 607def8555..dd88005dd7 100644--- a/server/middlewares/dnt.ts+++ b/server/middlewares/dnt.ts@@ -1,6 +1,3 @@-import * as ipaddr from 'ipaddr.js'-import { format } from 'util'-const advertiseDoNotTrack = (_, res, next) => {res.setHeader('Tk', 'N')return next()diff --git a/server/middlewares/oauth.ts b/server/middlewares/oauth.tsindex 749f5cccd9..9eef03bb43 100644--- a/server/middlewares/oauth.ts+++ b/server/middlewares/oauth.ts@@ -51,6 +51,7 @@ function authenticateSocket (socket: Socket, next: (err?: any) => void) {return next()})+ .catch(err => logger.error('Cannot get access token.', { err }))}function authenticatePromiseIfNeeded (req: express.Request, res: express.Response, authenticateInQuery = false) {diff --git a/server/middlewares/sort.ts b/server/middlewares/sort.tsindex 75238228fe..fcbb2902cf 100644--- a/server/middlewares/sort.ts+++ b/server/middlewares/sort.ts@@ -8,7 +8,7 @@ const setDefaultVideoRedundanciesSort = setDefaultSortFactory('name')const setDefaultSearchSort = setDefaultSortFactory('-match')function setBlacklistSort (req: express.Request, res: express.Response, next: express.NextFunction) {- let newSort: SortType = { sortModel: undefined, sortValue: '' }+ const newSort: SortType = { sortModel: undefined, sortValue: '' }if (!req.query.sort) req.query.sort = '-createdAt'diff --git a/server/middlewares/validators/avatar.ts b/server/middlewares/validators/avatar.tsindex 8623d07e80..2acb974836 100644--- a/server/middlewares/validators/avatar.ts+++ b/server/middlewares/validators/avatar.ts@@ -8,8 +8,8 @@ import { cleanUpReqFiles } from '../../helpers/express-utils'const updateAvatarValidator = [body('avatarfile').custom((value, { req }) => isAvatarFile(req.files)).withMessage(- 'This file is not supported or too large. Please, make sure it is of the following type : '- + CONSTRAINTS_FIELDS.ACTORS.AVATAR.EXTNAME.join(', ')+ 'This file is not supported or too large. Please, make sure it is of the following type : ' ++ CONSTRAINTS_FIELDS.ACTORS.AVATAR.EXTNAME.join(', ')),(req: express.Request, res: express.Response, next: express.NextFunction) => {diff --git a/server/middlewares/validators/config.ts b/server/middlewares/validators/config.tsindex 2d1f619470..ceab646c0e 100644--- a/server/middlewares/validators/config.ts+++ b/server/middlewares/validators/config.ts@@ -55,7 +55,7 @@ const customConfigUpdateValidator = [body('theme.default').custom(v => isThemeNameValid(v) && isThemeRegistered(v)).withMessage('Should have a valid theme'),- async (req: express.Request, res: express.Response, next: express.NextFunction) => {+ (req: express.Request, res: express.Response, next: express.NextFunction) => {logger.debug('Checking customConfigUpdateValidator parameters', { parameters: req.body })if (areValidationErrors(req, res)) returndiff --git a/server/middlewares/validators/feeds.ts b/server/middlewares/validators/feeds.tsindex 29f6c87beb..f34c2b1745 100644--- a/server/middlewares/validators/feeds.ts+++ b/server/middlewares/validators/feeds.ts@@ -22,13 +22,13 @@ function setFeedFormatContentType (req: express.Request, res: express.Response,let acceptableContentTypes: string[]if (format === 'atom' || format === 'atom1') {- acceptableContentTypes = ['application/atom+xml', 'application/xml', 'text/xml']+ acceptableContentTypes = [ 'application/atom+xml', 'application/xml', 'text/xml' ]} else if (format === 'json' || format === 'json1') {- acceptableContentTypes = ['application/json']+ acceptableContentTypes = [ 'application/json' ]} else if (format === 'rss' || format === 'rss2') {- acceptableContentTypes = ['application/rss+xml', 'application/xml', 'text/xml']+ acceptableContentTypes = [ 'application/rss+xml', 'application/xml', 'text/xml' ]} else {- acceptableContentTypes = ['application/xml', 'text/xml']+ acceptableContentTypes = [ 'application/xml', 'text/xml' ]}if (req.accepts(acceptableContentTypes)) {diff --git a/server/middlewares/validators/redundancy.ts b/server/middlewares/validators/redundancy.tsindex 16b42fc0d0..8cd3bc33d2 100644--- a/server/middlewares/validators/redundancy.ts+++ b/server/middlewares/validators/redundancy.ts@@ -106,7 +106,7 @@ const listVideoRedundanciesValidator = [query('target').custom(isVideoRedundancyTarget).withMessage('Should have a valid video redundancies target'),- async (req: express.Request, res: express.Response, next: express.NextFunction) => {+ (req: express.Request, res: express.Response, next: express.NextFunction) => {logger.debug('Checking listVideoRedundanciesValidator parameters', { parameters: req.query })if (areValidationErrors(req, res)) returndiff --git a/server/middlewares/validators/users.ts b/server/middlewares/validators/users.tsindex c78c67a8cd..5d52b5804a 100644--- a/server/middlewares/validators/users.ts+++ b/server/middlewares/validators/users.ts@@ -36,7 +36,6 @@ import { doesVideoExist } from '../../helpers/middlewares'import { UserRole } from '../../../shared/models/users'import { MUserDefault } from '@server/typings/models'import { Hooks } from '@server/lib/plugins/hooks'-import { isLocalVideoAccepted } from '@server/lib/moderation'const usersAddValidator = [body('username').custom(isUserUsernameValid).withMessage('Should have a valid username (lowercase alphanumeric characters)'),@@ -149,7 +148,7 @@ const usersBlockingValidator = []const deleteMeValidator = [- async (req: express.Request, res: express.Response, next: express.NextFunction) => {+ (req: express.Request, res: express.Response, next: express.NextFunction) => {const user = res.locals.oauth.token.Userif (user.username === 'root') {return res.status(400)@@ -303,7 +302,7 @@ const ensureUserRegistrationAllowed = []const ensureUserRegistrationAllowedForIP = [- async (req: express.Request, res: express.Response, next: express.NextFunction) => {+ (req: express.Request, res: express.Response, next: express.NextFunction) => {const allowed = isSignupAllowedForCurrentIP(req.ip)if (allowed === false) {@@ -410,7 +409,7 @@ const userAutocompleteValidator = []const ensureAuthUserOwnsAccountValidator = [- async (req: express.Request, res: express.Response, next: express.NextFunction) => {+ (req: express.Request, res: express.Response, next: express.NextFunction) => {const user = res.locals.oauth.token.Userif (res.locals.account.id !== user.Account.id) {diff --git a/server/middlewares/validators/videos/video-captions.ts b/server/middlewares/validators/videos/video-captions.tsindex 7b0cd6f66c..872d9c2aba 100644--- a/server/middlewares/validators/videos/video-captions.ts+++ b/server/middlewares/validators/videos/video-captions.ts@@ -13,10 +13,12 @@ const addVideoCaptionValidator = [param('videoId').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid video id'),param('captionLanguage').custom(isVideoCaptionLanguageValid).not().isEmpty().withMessage('Should have a valid caption language'),body('captionfile')- .custom((_, { req }) => isVideoCaptionFile(req.files, 'captionfile')).withMessage(- `This caption file is not supported or too large. Please, make sure it is under ${CONSTRAINTS_FIELDS.VIDEO_CAPTIONS.CAPTION_FILE.FILE_SIZE} and one of the following mimetypes: `- + Object.keys(MIMETYPES.VIDEO_CAPTIONS.MIMETYPE_EXT).map(key => `${key} (${MIMETYPES.VIDEO_CAPTIONS.MIMETYPE_EXT[key]})`).join(', ')- ),+ .custom((_, { req }) => isVideoCaptionFile(req.files, 'captionfile'))+ .withMessage(+ 'This caption file is not supported or too large. ' ++ `Please, make sure it is under ${CONSTRAINTS_FIELDS.VIDEO_CAPTIONS.CAPTION_FILE.FILE_SIZE} and one of the following mimetypes: ` ++ Object.keys(MIMETYPES.VIDEO_CAPTIONS.MIMETYPE_EXT).map(key => `${key} (${MIMETYPES.VIDEO_CAPTIONS.MIMETYPE_EXT[key]})`).join(', ')+ ),async (req: express.Request, res: express.Response, next: express.NextFunction) => {logger.debug('Checking addVideoCaption parameters', { parameters: req.body })diff --git a/server/middlewares/validators/videos/video-comments.ts b/server/middlewares/validators/videos/video-comments.tsindex 77c5f940df..da2fafb10a 100644--- a/server/middlewares/validators/videos/video-comments.ts+++ b/server/middlewares/validators/videos/video-comments.ts@@ -50,7 +50,7 @@ const addVideoCommentThreadValidator = [if (areValidationErrors(req, res)) returnif (!await doesVideoExist(req.params.videoId, res)) returnif (!isVideoCommentsEnabled(res.locals.videoAll, res)) return- if (!await isVideoCommentAccepted(req, res, res.locals.videoAll,false)) return+ if (!await isVideoCommentAccepted(req, res, res.locals.videoAll, false)) returnreturn next()}diff --git a/server/middlewares/validators/videos/video-imports.ts b/server/middlewares/validators/videos/video-imports.tsindex 318dad1008..5dc5db5338 100644--- a/server/middlewares/validators/videos/video-imports.ts+++ b/server/middlewares/validators/videos/video-imports.ts@@ -22,10 +22,11 @@ const videoImportAddValidator = getCommonVideoEditAttributes().concat([.optional().custom(isVideoMagnetUriValid).withMessage('Should have a valid video magnet URI'),body('torrentfile')- .custom((value, { req }) => isVideoImportTorrentFile(req.files)).withMessage(- 'This torrent file is not supported or too large. Please, make sure it is of the following type: '- + CONSTRAINTS_FIELDS.VIDEO_IMPORTS.TORRENT_FILE.EXTNAME.join(', ')- ),+ .custom((value, { req }) => isVideoImportTorrentFile(req.files))+ .withMessage(+ 'This torrent file is not supported or too large. Please, make sure it is of the following type: ' ++ CONSTRAINTS_FIELDS.VIDEO_IMPORTS.TORRENT_FILE.EXTNAME.join(', ')+ ),body('name').optional().custom(isVideoNameValid).withMessage('Should have a valid name'),diff --git a/server/middlewares/validators/videos/video-playlists.ts b/server/middlewares/validators/videos/video-playlists.tsindex 1d67e8666f..6b15c5464a 100644--- a/server/middlewares/validators/videos/video-playlists.ts+++ b/server/middlewares/validators/videos/video-playlists.ts@@ -384,10 +384,11 @@ export {function getCommonPlaylistEditAttributes () {return [body('thumbnailfile')- .custom((value, { req }) => isVideoImage(req.files, 'thumbnailfile')).withMessage(- 'This thumbnail file is not supported or too large. Please, make sure it is of the following type: '- + CONSTRAINTS_FIELDS.VIDEO_PLAYLISTS.IMAGE.EXTNAME.join(', ')- ),+ .custom((value, { req }) => isVideoImage(req.files, 'thumbnailfile'))+ .withMessage(+ 'This thumbnail file is not supported or too large. Please, make sure it is of the following type: ' ++ CONSTRAINTS_FIELDS.VIDEO_PLAYLISTS.IMAGE.EXTNAME.join(', ')+ ),body('description').optional()diff --git a/server/middlewares/validators/videos/video-rates.ts b/server/middlewares/validators/videos/video-rates.tsindex 5d5fae8aab..cbc144f69e 100644--- a/server/middlewares/validators/videos/video-rates.ts+++ b/server/middlewares/validators/videos/video-rates.ts@@ -51,7 +51,7 @@ const getAccountVideoRateValidatorFactory = function (rateType: VideoRateType) {const videoRatingValidator = [query('rating').optional().custom(isRatingValid).withMessage('Value must be one of "like" or "dislike"'),- async (req: express.Request, res: express.Response, next: express.NextFunction) => {+ (req: express.Request, res: express.Response, next: express.NextFunction) => {logger.debug('Checking rating parameter', { parameters: req.params })if (areValidationErrors(req, res)) returndiff --git a/server/middlewares/validators/videos/videos.ts b/server/middlewares/validators/videos/videos.tsindex 6733d9dec4..11dd027065 100644--- a/server/middlewares/validators/videos/videos.ts+++ b/server/middlewares/validators/videos/videos.ts@@ -49,8 +49,8 @@ import { getVideoWithAttributes } from '../../../helpers/video'const videosAddValidator = getCommonVideoEditAttributes().concat([body('videofile').custom((value, { req }) => isVideoFile(req.files)).withMessage(- 'This file is not supported or too large. Please, make sure it is of the following type: '- + CONSTRAINTS_FIELDS.VIDEOS.EXTNAME.join(', ')+ 'This file is not supported or too large. Please, make sure it is of the following type: ' ++ CONSTRAINTS_FIELDS.VIDEOS.EXTNAME.join(', ')),body('name').custom(isVideoNameValid).withMessage('Should have a valid name'),body('channelId')@@ -245,19 +245,15 @@ const videosTerminateChangeOwnershipValidator = [// Check if the user who did the request is able to change the ownership of the videoif (!checkUserCanTerminateOwnershipChange(res.locals.oauth.token.User, res.locals.videoChangeOwnership, res)) return- return next()- },- async (req: express.Request, res: express.Response, next: express.NextFunction) => {const videoChangeOwnership = res.locals.videoChangeOwnership- if (videoChangeOwnership.status === VideoChangeOwnershipStatus.WAITING) {- return next()- } else {+ if (videoChangeOwnership.status !== VideoChangeOwnershipStatus.WAITING) {res.status(403)- .json({ error: 'Ownership already accepted or refused' })-+ .json({ error: 'Ownership already accepted or refused' })return}++ return next()}]@@ -284,14 +280,14 @@ function getCommonVideoEditAttributes () {return [body('thumbnailfile').custom((value, { req }) => isVideoImage(req.files, 'thumbnailfile')).withMessage(- 'This thumbnail file is not supported or too large. Please, make sure it is of the following type: '- + CONSTRAINTS_FIELDS.VIDEOS.IMAGE.EXTNAME.join(', ')- ),+ 'This thumbnail file is not supported or too large. Please, make sure it is of the following type: ' ++ CONSTRAINTS_FIELDS.VIDEOS.IMAGE.EXTNAME.join(', ')+ ),body('previewfile').custom((value, { req }) => isVideoImage(req.files, 'previewfile')).withMessage(- 'This preview file is not supported or too large. Please, make sure it is of the following type: '- + CONSTRAINTS_FIELDS.VIDEOS.IMAGE.EXTNAME.join(', ')- ),+ 'This preview file is not supported or too large. Please, make sure it is of the following type: ' ++ CONSTRAINTS_FIELDS.VIDEOS.IMAGE.EXTNAME.join(', ')+ ),body('category').optional()diff --git a/server/models/account/account-video-rate.ts b/server/models/account/account-video-rate.tsindex c593595b2b..8aeb486d1f 100644--- a/server/models/account/account-video-rate.ts+++ b/server/models/account/account-video-rate.ts@@ -99,7 +99,7 @@ export class AccountVideoRateModel extends Model<AccountVideoRateModel> {static loadByAccountAndVideoOrUrl (accountId: number, videoId: number, url: string, t?: Transaction): Bluebird<MAccountVideoRate> {const options: FindOptions = {where: {- [ Op.or]: [+ [Op.or]: [{accountId,videoId@@ -116,10 +116,10 @@ export class AccountVideoRateModel extends Model<AccountVideoRateModel> {}static listByAccountForApi (options: {- start: number,- count: number,- sort: string,- type?: string,+ start: number+ count: number+ sort: string+ type?: stringaccountId: number}) {const query: FindOptions = {@@ -135,7 +135,7 @@ export class AccountVideoRateModel extends Model<AccountVideoRateModel> {required: true,include: [{- model: VideoChannelModel.scope({ method: [VideoChannelScopeNames.SUMMARY, { withAccount: true } as SummaryOptions ] }),+ model: VideoChannelModel.scope({ method: [ VideoChannelScopeNames.SUMMARY, { withAccount: true } as SummaryOptions ] }),required: true}]diff --git a/server/models/account/account.ts b/server/models/account/account.tsindex 8a0ffeb633..0905a0fb2a 100644--- a/server/models/account/account.ts+++ b/server/models/account/account.ts@@ -53,7 +53,7 @@ export type SummaryOptions = {]}))@Scopes(() => ({- [ ScopeNames.SUMMARY ]: (options: SummaryOptions = {}) => {+ [ScopeNames.SUMMARY]: (options: SummaryOptions = {}) => {const whereActor = options.whereActor || undefinedconst serverInclude: IncludeOptions = {@@ -254,15 +254,15 @@ export class AccountModel extends Model<AccountModel> {const query = {where: {- [ Op.or ]: [+ [Op.or]: [{userId: {- [ Op.ne ]: null+ [Op.ne]: null}},{applicationId: {- [ Op.ne ]: null+ [Op.ne]: null}}]diff --git a/server/models/account/user-notification.ts b/server/models/account/user-notification.tsindex f649b8f95a..5a725187a2 100644--- a/server/models/account/user-notification.ts+++ b/server/models/account/user-notification.ts@@ -379,7 +379,7 @@ export class UserNotificationModel extends Model<UserNotificationModel> {toFormattedJSON (this: UserNotificationModelForApi): UserNotification {const video = this.Video- ? Object.assign(this.formatVideo(this.Video),{ channel: this.formatActor(this.Video.VideoChannel) })+ ? Object.assign(this.formatVideo(this.Video), { channel: this.formatActor(this.Video.VideoChannel) }): undefinedconst videoImport = this.VideoImport ? {diff --git a/server/models/account/user.ts b/server/models/account/user.tsindex 4c2c5e2786..fb4c15aef0 100644--- a/server/models/account/user.ts+++ b/server/models/account/user.ts@@ -1,4 +1,4 @@-import { FindOptions, literal, Op, QueryTypes, where, fn, col } from 'sequelize'+import { FindOptions, literal, Op, QueryTypes, where, fn, col, WhereOptions } from 'sequelize'import {AfterDestroy,AfterUpdate,@@ -101,7 +101,7 @@ enum ScopeNames {required: true,where: {type: {- [ Op.ne ]: VideoPlaylistType.REGULAR+ [Op.ne]: VideoPlaylistType.REGULAR}}}@@ -186,7 +186,10 @@ export class UserModel extends Model<UserModel> {@AllowNull(false)@Default(true)- @Is('UserAutoPlayNextVideoPlaylist', value => throwIfNotValid(value, isUserAutoPlayNextVideoPlaylistValid, 'auto play next video for playlists boolean'))+ @Is(+ 'UserAutoPlayNextVideoPlaylist',+ value => throwIfNotValid(value, isUserAutoPlayNextVideoPlaylistValid, 'auto play next video for playlists boolean')+ )@ColumnautoPlayNextVideoPlaylist: boolean@@ -308,7 +311,8 @@ export class UserModel extends Model<UserModel> {}static listForApi (start: number, count: number, sort: string, search?: string) {- let where = undefined+ let where: WhereOptions+if (search) {where = {[Op.or]: [@@ -319,7 +323,7 @@ export class UserModel extends Model<UserModel> {},{username: {- [ Op.iLike ]: '%' + search + '%'+ [Op.iLike]: '%' + search + '%'}}]@@ -332,14 +336,14 @@ export class UserModel extends Model<UserModel> {[literal('(' +- 'SELECT COALESCE(SUM("size"), 0) ' +- 'FROM (' +- 'SELECT MAX("videoFile"."size") AS "size" FROM "videoFile" ' +- 'INNER JOIN "video" ON "videoFile"."videoId" = "video"."id" ' +- 'INNER JOIN "videoChannel" ON "videoChannel"."id" = "video"."channelId" ' +- 'INNER JOIN "account" ON "videoChannel"."accountId" = "account"."id" ' +- 'WHERE "account"."userId" = "UserModel"."id" GROUP BY "video"."id"' +- ') t' ++ 'SELECT COALESCE(SUM("size"), 0) ' ++ 'FROM (' ++ 'SELECT MAX("videoFile"."size") AS "size" FROM "videoFile" ' ++ 'INNER JOIN "video" ON "videoFile"."videoId" = "video"."id" ' ++ 'INNER JOIN "videoChannel" ON "videoChannel"."id" = "video"."channelId" ' ++ 'INNER JOIN "account" ON "videoChannel"."accountId" = "account"."id" ' ++ 'WHERE "account"."userId" = "UserModel"."id" GROUP BY "video"."id"' ++ ') t' +')'),'videoQuotaUsed'@@ -353,18 +357,18 @@ export class UserModel extends Model<UserModel> {}return UserModel.findAndCountAll(query)- .then(({ rows, count }) => {- return {- data: rows,- total: count- }- })+ .then(({ rows, count }) => {+ return {+ data: rows,+ total: count+ }+ })}static listWithRight (right: UserRight): Bluebird<MUserDefault[]> {const roles = Object.keys(USER_ROLE_LABELS)- .map(k => parseInt(k, 10) as UserRole)- .filter(role => hasUserRight(role, right))+ .map(k => parseInt(k, 10) as UserRole)+ .filter(role => hasUserRight(role, right))const query = {where: {@@ -390,7 +394,7 @@ export class UserModel extends Model<UserModel> {required: true,include: [{- attributes: [ ],+ attributes: [],model: ActorModel.unscoped(),required: true,where: {@@ -398,7 +402,7 @@ export class UserModel extends Model<UserModel> {},include: [{- attributes: [ ],+ attributes: [],as: 'ActorFollowings',model: ActorFollowModel.unscoped(),required: true,@@ -433,7 +437,7 @@ export class UserModel extends Model<UserModel> {static loadByUsername (username: string): Bluebird<MUserDefault> {const query = {where: {- username: { [ Op.iLike ]: username }+ username: { [Op.iLike]: username }}}@@ -443,7 +447,7 @@ export class UserModel extends Model<UserModel> {static loadForMeAPI (username: string): Bluebird<MUserNotifSettingChannelDefault> {const query = {where: {- username: { [ Op.iLike ]: username }+ username: { [Op.iLike]: username }}}@@ -465,7 +469,7 @@ export class UserModel extends Model<UserModel> {const query = {where: {- [ Op.or ]: [+ [Op.or]: [where(fn('lower', col('username')), fn('lower', username)),{ email }@@ -592,7 +596,7 @@ export class UserModel extends Model<UserModel> {const query = {where: {username: {- [ Op.like ]: `%${search}%`+ [Op.like]: `%${search}%`}},limit: 10@@ -652,7 +656,7 @@ export class UserModel extends Model<UserModel> {videoLanguages: this.videoLanguages,role: this.role,- roleLabel: USER_ROLE_LABELS[ this.role ],+ roleLabel: USER_ROLE_LABELS[this.role],videoQuota: this.videoQuota,videoQuotaDaily: this.videoQuotaDaily,@@ -686,13 +690,13 @@ export class UserModel extends Model<UserModel> {if (Array.isArray(this.Account.VideoChannels) === true) {json.videoChannels = this.Account.VideoChannels- .map(c => c.toFormattedJSON())- .sort((v1, v2) => {- if (v1.createdAt < v2.createdAt) return -1- if (v1.createdAt === v2.createdAt) return 0+ .map(c => c.toFormattedJSON())+ .sort((v1, v2) => {+ if (v1.createdAt < v2.createdAt) return -1+ if (v1.createdAt === v2.createdAt) return 0- return 1- })+ return 1+ })}return json@@ -702,7 +706,7 @@ export class UserModel extends Model<UserModel> {const formatted = this.toFormattedJSON()const specialPlaylists = this.Account.VideoPlaylists- .map(p => ({ id: p.id, name: p.name, type: p.type }))+ .map(p => ({ id: p.id, name: p.name, type: p.type }))return Object.assign(formatted, { specialPlaylists })}@@ -729,12 +733,12 @@ export class UserModel extends Model<UserModel> {return 'SELECT SUM("size") AS "total" ' +'FROM (' +- 'SELECT MAX("videoFile"."size") AS "size" FROM "videoFile" ' +- 'INNER JOIN "video" ON "videoFile"."videoId" = "video"."id" ' +- 'INNER JOIN "videoChannel" ON "videoChannel"."id" = "video"."channelId" ' +- 'INNER JOIN "account" ON "videoChannel"."accountId" = "account"."id" ' +- 'WHERE "account"."userId" = $userId ' + andWhere +- 'GROUP BY "video"."id"' ++ 'SELECT MAX("videoFile"."size") AS "size" FROM "videoFile" ' ++ 'INNER JOIN "video" ON "videoFile"."videoId" = "video"."id" ' ++ 'INNER JOIN "videoChannel" ON "videoChannel"."id" = "video"."channelId" ' ++ 'INNER JOIN "account" ON "videoChannel"."accountId" = "account"."id" ' ++ 'WHERE "account"."userId" = $userId ' + andWhere ++ 'GROUP BY "video"."id"' +') t'}diff --git a/server/models/activitypub/actor-follow.ts b/server/models/activitypub/actor-follow.tsindex f21d2b8a29..27643704e1 100644--- a/server/models/activitypub/actor-follow.ts+++ b/server/models/activitypub/actor-follow.ts@@ -1,5 +1,5 @@import * as Bluebird from 'bluebird'-import { values, difference } from 'lodash'+import { difference, values } from 'lodash'import {AfterCreate,AfterDestroy,@@ -23,7 +23,7 @@ import { logger } from '../../helpers/logger'import { getServerActor } from '../../helpers/utils'import { ACTOR_FOLLOW_SCORE, FOLLOW_STATES, SERVER_ACTOR_NAME } from '../../initializers/constants'import { ServerModel } from '../server/server'-import { createSafeIn, getSort, getFollowsSort } from '../utils'+import { createSafeIn, getFollowsSort, getSort } from '../utils'import { ActorModel, unusedActorAttributesForAPI } from './actor'import { VideoChannelModel } from '../video/video-channel'import { AccountModel } from '../account/account'@@ -36,7 +36,6 @@ import {MActorFollowSubscriptions} from '@server/typings/models'import { ActivityPubActorType } from '@shared/models'-import { afterCommitIfTransaction } from '@server/helpers/database-utils'@Table({tableName: 'actorFollow',@@ -226,7 +225,7 @@ export class ActorFollowModel extends Model<ActorFollowModel> {return ActorFollowModel.findOne(query).then(result => {- if (result && result.ActorFollowing.VideoChannel) {+ if (result?.ActorFollowing.VideoChannel) {result.ActorFollowing.VideoChannel.Actor = result.ActorFollowing}@@ -239,24 +238,24 @@ export class ActorFollowModel extends Model<ActorFollowModel> {.map(t => {if (t.host) {return {- [ Op.and ]: [+ [Op.and]: [{- '$preferredUsername$': t.name+ $preferredUsername$: t.name},{- '$host$': t.host+ $host$: t.host}]}}return {- [ Op.and ]: [+ [Op.and]: [{- '$preferredUsername$': t.name+ $preferredUsername$: t.name},{- '$serverId$': null+ $serverId$: null}]}@@ -265,9 +264,9 @@ export class ActorFollowModel extends Model<ActorFollowModel> {const query = {attributes: [],where: {- [ Op.and ]: [+ [Op.and]: [{- [ Op.or ]: whereTab+ [Op.or]: whereTab},{actorId@@ -295,12 +294,12 @@ export class ActorFollowModel extends Model<ActorFollowModel> {}static listFollowingForApi (options: {- id: number,- start: number,- count: number,- sort: string,- state?: FollowState,- actorType?: ActivityPubActorType,+ id: number+ start: number+ count: number+ sort: string+ state?: FollowState+ actorType?: ActivityPubActorTypesearch?: string}) {const { id, start, count, sort, search, state, actorType } = options@@ -312,7 +311,7 @@ export class ActorFollowModel extends Model<ActorFollowModel> {if (search) {Object.assign(followingServerWhere, {host: {- [ Op.iLike ]: '%' + search + '%'+ [Op.iLike]: '%' + search + '%'}})}@@ -362,12 +361,12 @@ export class ActorFollowModel extends Model<ActorFollowModel> {}static listFollowersForApi (options: {- actorId: number,- start: number,- count: number,- sort: string,- state?: FollowState,- actorType?: ActivityPubActorType,+ actorId: number+ start: number+ count: number+ sort: string+ state?: FollowState+ actorType?: ActivityPubActorTypesearch?: string}) {const { actorId, start, count, sort, search, state, actorType } = options@@ -379,7 +378,7 @@ export class ActorFollowModel extends Model<ActorFollowModel> {if (search) {Object.assign(followerServerWhere, {host: {- [ Op.iLike ]: '%' + search + '%'+ [Op.iLike]: '%' + search + '%'}})}@@ -631,7 +630,7 @@ export class ActorFollowModel extends Model<ActorFollowModel> {const tasks: Bluebird<any>[] = []- for (let selection of selections) {+ for (const selection of selections) {let query = 'SELECT ' + selection + ' FROM "actor" ' +'INNER JOIN "actorFollow" ON "actorFollow"."' + firstJoin + '" = "actor"."id" ' +'INNER JOIN "actor" AS "Follows" ON "actorFollow"."' + secondJoin + '" = "Follows"."id" ' +diff --git a/server/models/activitypub/actor.ts b/server/models/activitypub/actor.tsindex d651a281aa..00e8dc9541 100644--- a/server/models/activitypub/actor.ts+++ b/server/models/activitypub/actor.ts@@ -16,7 +16,7 @@ import {Table,UpdatedAt} from 'sequelize-typescript'-import { ActivityPubActorType } from '../../../shared/models/activitypub'+import { ActivityIconObject, ActivityPubActorType } from '../../../shared/models/activitypub'import { Avatar } from '../../../shared/models/avatars/avatar.model'import { activityPubContextify } from '../../helpers/activitypub'import {@@ -335,7 +335,7 @@ export class ActorModel extends Model<ActorModel> {const query = {where: {followersUrl: {- [ Op.in ]: followersUrls+ [Op.in]: followersUrls}},transaction@@ -362,7 +362,7 @@ export class ActorModel extends Model<ActorModel> {.findOne(query).then(actor => {if (preferredUsername === SERVER_ACTOR_NAME) {- ActorModel.localNameCache[ preferredUsername ] = actor+ ActorModel.localNameCache[preferredUsername] = actor}return actor@@ -388,7 +388,7 @@ export class ActorModel extends Model<ActorModel> {.findOne(query).then(actor => {if (preferredUsername === SERVER_ACTOR_NAME) {- ActorModel.localUrlCache[ preferredUsername ] = actor+ ActorModel.localUrlCache[preferredUsername] = actor}return actor@@ -500,9 +500,11 @@ export class ActorModel extends Model<ActorModel> {}toActivityPubObject (this: MActorAP, name: string) {- let icon = undefined+ let icon: ActivityIconObject+if (this.avatarId) {const extension = extname(this.Avatar.filename)+icon = {type: 'Image',mediaType: extension === '.png' ? 'image/png' : 'image/jpeg',diff --git a/server/models/oauth/oauth-token.ts b/server/models/oauth/oauth-token.tsindex b680be237a..d2101ce86f 100644--- a/server/models/oauth/oauth-token.ts+++ b/server/models/oauth/oauth-token.ts@@ -23,10 +23,10 @@ import { MOAuthTokenUser } from '@server/typings/models/oauth/oauth-token'export type OAuthTokenInfo = {refreshToken: string- refreshTokenExpiresAt: Date,+ refreshTokenExpiresAt: Dateclient: {id: number- },+ }user: {id: number}diff --git a/server/models/redundancy/video-redundancy.ts b/server/models/redundancy/video-redundancy.tsindex 4e66d72e31..1b63d38189 100644--- a/server/models/redundancy/video-redundancy.ts+++ b/server/models/redundancy/video-redundancy.ts@@ -43,7 +43,7 @@ export enum ScopeNames {}@Scopes(() => ({- [ ScopeNames.WITH_VIDEO ]: {+ [ScopeNames.WITH_VIDEO]: {include: [{model: VideoFileModel,@@ -167,7 +167,7 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> {logger.info('Removing duplicated video streaming playlist %s.', videoUUID)videoStreamingPlaylist.Video.removeStreamingPlaylistFiles(videoStreamingPlaylist, true)- .catch(err => logger.error('Cannot delete video streaming playlist files of %s.', videoUUID, { err }))+ .catch(err => logger.error('Cannot delete video streaming playlist files of %s.', videoUUID, { err }))}return undefined@@ -230,12 +230,12 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> {},include: [{- attributes: [ ],+ attributes: [],model: VideoFileModel,required: true,include: [{- attributes: [ ],+ attributes: [],model: VideoModel,required: true,where: {@@ -248,7 +248,7 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> {}return VideoRedundancyModel.findOne(query)- .then(r => !!r)+ .then(r => !!r)}static async getVideoSample (p: Bluebird<VideoModel[]>) {@@ -310,7 +310,7 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> {where: {privacy: VideoPrivacy.PUBLIC,views: {- [ Op.gte ]: minViews+ [Op.gte]: minViews}},include: [@@ -333,7 +333,7 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> {actorId: actor.id,strategy,createdAt: {- [ Op.lt ]: expiredDate+ [Op.lt]: expiredDate}}}@@ -392,7 +392,7 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> {where: {actorId: actor.id,expiresOn: {- [ Op.lt ]: new Date()+ [Op.lt]: new Date()}}}@@ -409,8 +409,8 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> {[Op.ne]: actor.id},expiresOn: {- [ Op.lt ]: new Date(),- [ Op.ne ]: null+ [Op.lt]: new Date(),+ [Op.ne]: null}}}@@ -464,15 +464,15 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> {}static listForApi (options: {- start: number,- count: number,- sort: string,- target: VideoRedundanciesTarget,+ start: number+ count: number+ sort: string+ target: VideoRedundanciesTargetstrategy?: string}) {const { start, count, sort, target, strategy } = options- let redundancyWhere: WhereOptions = {}- let videosWhere: WhereOptions = {}+ const redundancyWhere: WhereOptions = {}+ const videosWhere: WhereOptions = {}let redundancySqlSuffix = ''if (target === 'my-videos') {@@ -490,10 +490,10 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> {const videoFilterWhere = {[Op.and]: [{- [ Op.or ]: [+ [Op.or]: [{id: {- [ Op.in ]: literal(+ [Op.in]: literal('(' +'SELECT "videoId" FROM "videoFile" ' +'INNER JOIN "videoRedundancy" ON "videoRedundancy"."videoFileId" = "videoFile".id' +@@ -504,7 +504,7 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> {},{id: {- [ Op.in ]: literal(+ [Op.in]: literal('(' +'select "videoId" FROM "videoStreamingPlaylist" ' +'INNER JOIN "videoRedundancy" ON "videoRedundancy"."videoStreamingPlaylistId" = "videoStreamingPlaylist".id' +@@ -592,16 +592,16 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> {}return VideoRedundancyModel.findOne(query)- .then((r: any) => ({- totalUsed: parseAggregateResult(r.totalUsed),- totalVideos: r.totalVideos,- totalVideoFiles: r.totalVideoFiles- }))+ .then((r: any) => ({+ totalUsed: parseAggregateResult(r.totalUsed),+ totalVideos: r.totalVideos,+ totalVideoFiles: r.totalVideoFiles+ }))}static toFormattedJSONStatic (video: MVideoForRedundancyAPI): VideoRedundancy {- let filesRedundancies: FileRedundancyInformation[] = []- let streamingPlaylistsRedundancies: StreamingPlaylistRedundancyInformation[] = []+ const filesRedundancies: FileRedundancyInformation[] = []+ const streamingPlaylistsRedundancies: StreamingPlaylistRedundancyInformation[] = []for (const file of video.VideoFiles) {for (const redundancy of file.RedundancyVideos) {@@ -678,7 +678,7 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> {expires: this.expiresOn ? this.expiresOn.toISOString() : null,url: {type: 'Link',- mediaType: MIMETYPES.VIDEO.EXT_MIMETYPE[ this.VideoFile.extname ] as any,+ mediaType: MIMETYPES.VIDEO.EXT_MIMETYPE[this.VideoFile.extname] as any,href: this.fileUrl,height: this.VideoFile.resolution,size: this.VideoFile.size,@@ -693,7 +693,7 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> {const notIn = literal('(' +- `SELECT "videoFileId" FROM "videoRedundancy" WHERE "actorId" = ${actor.id} AND "videoFileId" IS NOT NULL` ++ `SELECT "videoFileId" FROM "videoRedundancy" WHERE "actorId" = ${actor.id} AND "videoFileId" IS NOT NULL` +')')@@ -703,7 +703,7 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> {required: true,where: {id: {- [ Op.notIn ]: notIn+ [Op.notIn]: notIn}}}diff --git a/server/models/server/plugin.ts b/server/models/server/plugin.tsindex d094da1f56..95774a4674 100644--- a/server/models/server/plugin.ts+++ b/server/models/server/plugin.ts@@ -189,10 +189,10 @@ export class PluginModel extends Model<PluginModel> {}static listForApi (options: {- pluginType?: PluginType,- uninstalled?: boolean,- start: number,- count: number,+ pluginType?: PluginType+ uninstalled?: boolean+ start: number+ count: numbersort: string}) {const { uninstalled = false } = optionsdiff --git a/server/models/utils.ts b/server/models/utils.tsindex f89b80011a..f7afb8d4b8 100644--- a/server/models/utils.ts+++ b/server/models/utils.ts@@ -67,7 +67,7 @@ function getVideoSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): Orfunction getBlacklistSort (model: any, value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): OrderItem[] {const [ firstSort ] = getSort(value)- if (model) return [ [ literal(`"${model}.${firstSort[ 0 ]}" ${firstSort[ 1 ]}`) ], lastSort ] as any[] // FIXME: typings+ if (model) return [ [ literal(`"${model}.${firstSort[0]}" ${firstSort[1]}`) ], lastSort ] as any[] // FIXME: typingsreturn [ firstSort, lastSort ]}@@ -139,7 +139,7 @@ function buildServerIdsFollowedBy (actorId: any) {'SELECT "actor"."serverId" FROM "actorFollow" ' +'INNER JOIN "actor" ON actor.id = "actorFollow"."targetActorId" ' +'WHERE "actorFollow"."actorId" = ' + actorIdNumber +- ')'+ ')'}function buildWhereIdOrUUID (id: number | string) {diff --git a/server/models/video/thumbnail.ts b/server/models/video/thumbnail.tsindex b69bc08726..e396784d29 100644--- a/server/models/video/thumbnail.ts+++ b/server/models/video/thumbnail.ts@@ -92,7 +92,7 @@ export class ThumbnailModel extends Model<ThumbnailModel> {@UpdatedAtupdatedAt: Date- private static types: { [ id in ThumbnailType ]: { label: string, directory: string, staticPath: string } } = {+ private static readonly types: { [ id in ThumbnailType ]: { label: string, directory: string, staticPath: string } } = {[ThumbnailType.MINIATURE]: {label: 'miniature',directory: CONFIG.STORAGE.THUMBNAILS_DIR,diff --git a/server/models/video/video-abuse.ts b/server/models/video/video-abuse.tsindex 3636db18de..da8c1577cc 100644--- a/server/models/video/video-abuse.ts+++ b/server/models/video/video-abuse.ts@@ -87,9 +87,9 @@ export class VideoAbuseModel extends Model<VideoAbuseModel> {}static listForApi (parameters: {- start: number,- count: number,- sort: string,+ start: number+ count: number+ sort: stringserverAccountId: numberuser?: MUserAccountId}) {diff --git a/server/models/video/video-caption.ts b/server/models/video/video-caption.tsindex 1307c27f10..59d3e10508 100644--- a/server/models/video/video-caption.ts+++ b/server/models/video/video-caption.ts@@ -4,7 +4,8 @@ import {BeforeDestroy,BelongsTo,Column,- CreatedAt, DataType,+ CreatedAt,+ DataType,ForeignKey,Is,Model,@@ -16,13 +17,13 @@ import { buildWhereIdOrUUID, throwIfNotValid } from '../utils'import { VideoModel } from './video'import { isVideoCaptionLanguageValid } from '../../helpers/custom-validators/video-captions'import { VideoCaption } from '../../../shared/models/videos/caption/video-caption.model'-import { CONSTRAINTS_FIELDS, LAZY_STATIC_PATHS, STATIC_PATHS, VIDEO_LANGUAGES, WEBSERVER } from '../../initializers/constants'+import { CONSTRAINTS_FIELDS, LAZY_STATIC_PATHS, VIDEO_LANGUAGES, WEBSERVER } from '../../initializers/constants'import { join } from 'path'import { logger } from '../../helpers/logger'import { remove } from 'fs-extra'import { CONFIG } from '../../initializers/config'import * as Bluebird from 'bluebird'-import { MVideo, MVideoAccountLight, MVideoCaptionFormattable, MVideoCaptionVideo } from '@server/typings/models'+import { MVideoAccountLight, MVideoCaptionFormattable, MVideoCaptionVideo } from '@server/typings/models'import { buildRemoteVideoBaseUrl } from '@server/helpers/activitypub'export enum ScopeNames {diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.tsindex 4e98e7ba3f..8352166717 100644--- a/server/models/video/video-channel.ts+++ b/server/models/video/video-channel.ts@@ -30,7 +30,7 @@ import { buildServerIdsFollowedBy, buildTrigramSearchIndex, createSimilarityAttrimport { VideoModel } from './video'import { CONSTRAINTS_FIELDS, WEBSERVER } from '../../initializers/constants'import { ServerModel } from '../server/server'-import { FindOptions, ModelIndexesOptions, Op } from 'sequelize'+import { FindOptions, Op } from 'sequelize'import { AvatarModel } from '../avatar/avatar'import { VideoPlaylistModel } from './video-playlist'import * as Bluebird from 'bluebird'@@ -121,7 +121,7 @@ export type SummaryOptions = {},{serverId: {- [ Op.in ]: Sequelize.literal(inQueryInstanceFollow)+ [Op.in]: Sequelize.literal(inQueryInstanceFollow)}}]@@ -348,9 +348,9 @@ export class VideoChannelModel extends Model<VideoChannelModel> {}static listByAccount (options: {- accountId: number,- start: number,- count: number,+ accountId: number+ start: number+ count: numbersort: string}) {const query = {diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.tsindex fb4d16b4d1..b33c33d5ef 100644--- a/server/models/video/video-comment.ts+++ b/server/models/video/video-comment.ts@@ -257,10 +257,10 @@ export class VideoCommentModel extends Model<VideoCommentModel> {}static async listThreadsForApi (parameters: {- videoId: number,- start: number,- count: number,- sort: string,+ videoId: number+ start: number+ count: number+ sort: stringuser?: MUserAccountId}) {const { videoId, start, count, sort, user } = parameters@@ -300,8 +300,8 @@ export class VideoCommentModel extends Model<VideoCommentModel> {}static async listThreadCommentsForApi (parameters: {- videoId: number,- threadId: number,+ videoId: number+ threadId: numberuser?: MUserAccountId}) {const { videoId, threadId, user } = parameters@@ -314,7 +314,7 @@ export class VideoCommentModel extends Model<VideoCommentModel> {order: [ [ 'createdAt', 'ASC' ], [ 'updatedAt', 'ASC' ] ] as Order,where: {videoId,- [ Op.or ]: [+ [Op.or]: [{ id: threadId },{ originCommentId: threadId }],@@ -346,7 +346,7 @@ export class VideoCommentModel extends Model<VideoCommentModel> {order: [ [ 'createdAt', order ] ] as Order,where: {id: {- [ Op.in ]: Sequelize.literal('(' ++ [Op.in]: Sequelize.literal('(' +'WITH RECURSIVE children (id, "inReplyToCommentId") AS ( ' +`SELECT id, "inReplyToCommentId" FROM "videoComment" WHERE id = ${comment.id} ` +'UNION ' +@@ -355,7 +355,7 @@ export class VideoCommentModel extends Model<VideoCommentModel> {') ' +'SELECT id FROM children' +')'),- [ Op.ne ]: comment.id+ [Op.ne]: comment.id}},transaction: t@@ -461,7 +461,7 @@ export class VideoCommentModel extends Model<VideoCommentModel> {}isDeleted () {- return null !== this.deletedAt+ return this.deletedAt !== null}extractMentions () {diff --git a/server/models/video/video-format-utils.ts b/server/models/video/video-format-utils.tsindex bb50edcaab..55b0ed0625 100644--- a/server/models/video/video-format-utils.ts+++ b/server/models/video/video-format-utils.ts@@ -27,12 +27,13 @@ import { generateMagnetUri } from '@server/helpers/webtorrent'export type VideoFormattingJSONOptions = {completeDescription?: booleanadditionalAttributes: {- state?: boolean,- waitTranscoding?: boolean,- scheduledUpdate?: boolean,+ state?: boolean+ waitTranscoding?: boolean+ scheduledUpdate?: booleanblacklistInfo?: boolean}}+function videoModelToFormattedJSON (video: MVideoFormattable, options?: VideoFormattingJSONOptions): Video {const userHistory = isArray(video.UserVideoHistories) ? video.UserVideoHistories[0] : undefined@@ -181,12 +182,10 @@ function videoFilesModelToFormattedJSON (): VideoFile[] {return videoFiles.map(videoFile => {- let resolutionLabel = videoFile.resolution + 'p'-return {resolution: {id: videoFile.resolution,- label: resolutionLabel+ label: videoFile.resolution + 'p'},magnetUri: generateMagnetUri(model, videoFile, baseUrlHttp, baseUrlWs),size: videoFile.size,@@ -214,7 +213,7 @@ function addVideoFilesInAPAcc (for (const file of files) {acc.push({type: 'Link',- mediaType: MIMETYPES.VIDEO.EXT_MIMETYPE[ file.extname ] as any,+ mediaType: MIMETYPES.VIDEO.EXT_MIMETYPE[file.extname] as any,href: model.getVideoFileUrl(file, baseUrlHttp),height: file.resolution,size: file.size,@@ -274,10 +273,8 @@ function videoModelToActivityPubObject (video: MVideoAP): VideoTorrentObject {addVideoFilesInAPAcc(url, video, baseUrlHttp, baseUrlWs, video.VideoFiles || [])for (const playlist of (video.VideoStreamingPlaylists || [])) {- let tag: ActivityTagObject[]-- tag = playlist.p2pMediaLoaderInfohashes- .map(i => ({ type: 'Infohash' as 'Infohash', name: i }))+ const tag = playlist.p2pMediaLoaderInfohashes+ .map(i => ({ type: 'Infohash' as 'Infohash', name: i })) as ActivityTagObject[]tag.push({type: 'Link',name: 'sha256',diff --git a/server/models/video/video-playlist-element.ts b/server/models/video/video-playlist-element.tsindex f2d71357f6..4ba16f5fd4 100644--- a/server/models/video/video-playlist-element.ts+++ b/server/models/video/video-playlist-element.ts@@ -120,10 +120,10 @@ export class VideoPlaylistElementModel extends Model<VideoPlaylistElementModel>}static listForApi (options: {- start: number,- count: number,- videoPlaylistId: number,- serverAccount: AccountModel,+ start: number+ count: number+ videoPlaylistId: number+ serverAccount: AccountModeluser?: MUserAccountId}) {const accountIds = [ options.serverAccount.id ]diff --git a/server/models/video/video-playlist.ts b/server/models/video/video-playlist.tsindex ba1fc23eac..4ca17ebec0 100644--- a/server/models/video/video-playlist.ts+++ b/server/models/video/video-playlist.ts@@ -68,12 +68,12 @@ type AvailableForListOptions = {type?: VideoPlaylistTypeaccountId?: numbervideoChannelId?: number- listMyPlaylists?: boolean,+ listMyPlaylists?: booleansearch?: string}@Scopes(() => ({- [ ScopeNames.WITH_THUMBNAIL ]: {+ [ScopeNames.WITH_THUMBNAIL]: {include: [{model: ThumbnailModel,@@ -81,7 +81,7 @@ type AvailableForListOptions = {}]},- [ ScopeNames.WITH_VIDEOS_LENGTH ]: {+ [ScopeNames.WITH_VIDEOS_LENGTH]: {attributes: {include: [[@@ -91,7 +91,7 @@ type AvailableForListOptions = {]}} as FindOptions,- [ ScopeNames.WITH_ACCOUNT ]: {+ [ScopeNames.WITH_ACCOUNT]: {include: [{model: AccountModel,@@ -99,7 +99,7 @@ type AvailableForListOptions = {}]},- [ ScopeNames.WITH_ACCOUNT_AND_CHANNEL_SUMMARY ]: {+ [ScopeNames.WITH_ACCOUNT_AND_CHANNEL_SUMMARY]: {include: [{model: AccountModel.scope(AccountScopeNames.SUMMARY),@@ -111,7 +111,7 @@ type AvailableForListOptions = {}]},- [ ScopeNames.WITH_ACCOUNT_AND_CHANNEL ]: {+ [ScopeNames.WITH_ACCOUNT_AND_CHANNEL]: {include: [{model: AccountModel,@@ -123,7 +123,7 @@ type AvailableForListOptions = {}]},- [ ScopeNames.AVAILABLE_FOR_LIST ]: (options: AvailableForListOptions) => {+ [ScopeNames.AVAILABLE_FOR_LIST]: (options: AvailableForListOptions) => {let whereActor: WhereOptions = {}@@ -138,13 +138,13 @@ type AvailableForListOptions = {const inQueryInstanceFollow = buildServerIdsFollowedBy(options.followerActorId)whereActor = {- [ Op.or ]: [+ [Op.or]: [{serverId: null},{serverId: {- [ Op.in ]: literal(inQueryInstanceFollow)+ [Op.in]: literal(inQueryInstanceFollow)}}]@@ -172,7 +172,7 @@ type AvailableForListOptions = {if (options.search) {whereAnd.push({name: {- [ Op.iLike ]: '%' + options.search + '%'+ [Op.iLike]: '%' + options.search + '%'}})}@@ -299,13 +299,13 @@ export class VideoPlaylistModel extends Model<VideoPlaylistModel> {static listForApi (options: {followerActorId: number- start: number,- count: number,- sort: string,- type?: VideoPlaylistType,- accountId?: number,- videoChannelId?: number,- listMyPlaylists?: boolean,+ start: number+ count: number+ sort: string+ type?: VideoPlaylistType+ accountId?: number+ videoChannelId?: number+ listMyPlaylists?: booleansearch?: string}) {const query = {diff --git a/server/models/video/video.ts b/server/models/video/video.tsindex 1a924e6c9f..1ec8d717e5 100644--- a/server/models/video/video.ts+++ b/server/models/video/video.ts@@ -187,7 +187,7 @@ export type AvailableForListIDsOptions = {}@Scopes(() => ({- [ ScopeNames.FOR_API ]: (options: ForAPIOptions) => {+ [ScopeNames.FOR_API]: (options: ForAPIOptions) => {const query: FindOptions = {include: [{@@ -212,7 +212,7 @@ export type AvailableForListIDsOptions = {if (options.ids) {query.where = {id: {- [ Op.in ]: options.ids+ [Op.in]: options.ids}}}@@ -236,7 +236,7 @@ export type AvailableForListIDsOptions = {return query},- [ ScopeNames.AVAILABLE_FOR_LIST_IDS ]: (options: AvailableForListIDsOptions) => {+ [ScopeNames.AVAILABLE_FOR_LIST_IDS]: (options: AvailableForListIDsOptions) => {const whereAnd = options.baseWhere ? [].concat(options.baseWhere) : []const query: FindOptions = {@@ -247,11 +247,11 @@ export type AvailableForListIDsOptions = {const attributesType = options.attributesType || 'id'if (attributesType === 'id') query.attributes = [ 'id' ]- else if (attributesType === 'none') query.attributes = [ ]+ else if (attributesType === 'none') query.attributes = []whereAnd.push({id: {- [ Op.notIn ]: Sequelize.literal(+ [Op.notIn]: Sequelize.literal('(SELECT "videoBlacklist"."videoId" FROM "videoBlacklist")')}@@ -260,7 +260,7 @@ export type AvailableForListIDsOptions = {if (options.serverAccountId) {whereAnd.push({channelId: {- [ Op.notIn ]: Sequelize.literal(+ [Op.notIn]: Sequelize.literal('(' +'SELECT id FROM "videoChannel" WHERE "accountId" IN (' +buildBlockedAccountSQL(options.serverAccountId, options.user ? options.user.Account.id : undefined) +@@ -273,15 +273,14 @@ export type AvailableForListIDsOptions = {// Only list public/published videosif (!options.filter || options.filter !== 'all-local') {-const publishWhere = {// Always list published videos, or videos that are being transcoded but on which we don't want to wait for transcoding- [ Op.or ]: [+ [Op.or]: [{state: VideoState.PUBLISHED},{- [ Op.and ]: {+ [Op.and]: {state: VideoState.TO_TRANSCODE,waitTranscoding: false}@@ -368,7 +367,7 @@ export type AvailableForListIDsOptions = {[Op.or]: [{id: {- [ Op.in ]: Sequelize.literal(+ [Op.in]: Sequelize.literal('(' +'SELECT "videoShare"."videoId" AS "id" FROM "videoShare" ' +'INNER JOIN "actorFollow" ON "actorFollow"."targetActorId" = "videoShare"."actorId" ' +@@ -379,7 +378,7 @@ export type AvailableForListIDsOptions = {},{id: {- [ Op.in ]: Sequelize.literal(+ [Op.in]: Sequelize.literal('(' +'SELECT "video"."id" AS "id" FROM "video" ' +'INNER JOIN "videoChannel" ON "videoChannel"."id" = "video"."channelId" ' +@@ -399,7 +398,7 @@ export type AvailableForListIDsOptions = {if (options.withFiles === true) {whereAnd.push({id: {- [ Op.in ]: Sequelize.literal(+ [Op.in]: Sequelize.literal('(SELECT "videoId" FROM "videoFile")')}@@ -413,7 +412,7 @@ export type AvailableForListIDsOptions = {whereAnd.push({id: {- [ Op.in ]: Sequelize.literal(+ [Op.in]: Sequelize.literal('(' +'SELECT "videoId" FROM "videoTag" ' +'INNER JOIN "tag" ON "tag"."id" = "videoTag"."tagId" ' +@@ -429,7 +428,7 @@ export type AvailableForListIDsOptions = {whereAnd.push({id: {- [ Op.in ]: Sequelize.literal(+ [Op.in]: Sequelize.literal('(' +'SELECT "videoId" FROM "videoTag" ' +'INNER JOIN "tag" ON "tag"."id" = "videoTag"."tagId" ' +@@ -449,7 +448,7 @@ export type AvailableForListIDsOptions = {if (options.categoryOneOf) {whereAnd.push({category: {- [ Op.or ]: options.categoryOneOf+ [Op.or]: options.categoryOneOf}})}@@ -457,7 +456,7 @@ export type AvailableForListIDsOptions = {if (options.licenceOneOf) {whereAnd.push({licence: {- [ Op.or ]: options.licenceOneOf+ [Op.or]: options.licenceOneOf}})}@@ -472,12 +471,12 @@ export type AvailableForListIDsOptions = {[Op.or]: [{language: {- [ Op.or ]: videoLanguages+ [Op.or]: videoLanguages}},{id: {- [ Op.in ]: Sequelize.literal(+ [Op.in]: Sequelize.literal('(' +'SELECT "videoId" FROM "videoCaption" ' +'WHERE "language" IN (' + createSafeIn(VideoModel, options.languageOneOf) + ') ' +@@ -511,12 +510,12 @@ export type AvailableForListIDsOptions = {}query.where = {- [ Op.and ]: whereAnd+ [Op.and]: whereAnd}return query},- [ ScopeNames.WITH_THUMBNAILS ]: {+ [ScopeNames.WITH_THUMBNAILS]: {include: [{model: ThumbnailModel,@@ -524,7 +523,7 @@ export type AvailableForListIDsOptions = {}]},- [ ScopeNames.WITH_USER_ID ]: {+ [ScopeNames.WITH_USER_ID]: {include: [{attributes: [ 'accountId' ],@@ -540,7 +539,7 @@ export type AvailableForListIDsOptions = {}]},- [ ScopeNames.WITH_ACCOUNT_DETAILS ]: {+ [ScopeNames.WITH_ACCOUNT_DETAILS]: {include: [{model: VideoChannelModel.unscoped(),@@ -592,10 +591,10 @@ export type AvailableForListIDsOptions = {}]},- [ ScopeNames.WITH_TAGS ]: {+ [ScopeNames.WITH_TAGS]: {include: [ TagModel ]},- [ ScopeNames.WITH_BLACKLISTED ]: {+ [ScopeNames.WITH_BLACKLISTED]: {include: [{attributes: [ 'id', 'reason', 'unfederated' ],@@ -604,7 +603,7 @@ export type AvailableForListIDsOptions = {}]},- [ ScopeNames.WITH_WEBTORRENT_FILES ]: (withRedundancies = false) => {+ [ScopeNames.WITH_WEBTORRENT_FILES]: (withRedundancies = false) => {let subInclude: any[] = []if (withRedundancies === true) {@@ -628,7 +627,7 @@ export type AvailableForListIDsOptions = {]}},- [ ScopeNames.WITH_STREAMING_PLAYLISTS ]: (withRedundancies = false) => {+ [ScopeNames.WITH_STREAMING_PLAYLISTS]: (withRedundancies = false) => {const subInclude: IncludeOptions[] = [{model: VideoFileModel.unscoped(),@@ -655,7 +654,7 @@ export type AvailableForListIDsOptions = {]}},- [ ScopeNames.WITH_SCHEDULED_UPDATE ]: {+ [ScopeNames.WITH_SCHEDULED_UPDATE]: {include: [{model: ScheduleVideoUpdateModel.unscoped(),@@ -663,7 +662,7 @@ export type AvailableForListIDsOptions = {}]},- [ ScopeNames.WITH_USER_HISTORY ]: (userId: number) => {+ [ScopeNames.WITH_USER_HISTORY]: (userId: number) => {return {include: [{@@ -1016,7 +1015,7 @@ export class VideoModel extends Model<VideoModel> {},onDelete: 'cascade',hooks: true,- [ 'separate' as any ]: true+ ['separate' as any]: true})VideoCaptions: VideoCaptionModel[]@@ -1112,9 +1111,9 @@ export class VideoModel extends Model<VideoModel> {order: getVideoSort('createdAt', [ 'Tags', 'name', 'ASC' ] as any), // FIXME: sequelize typingswhere: {id: {- [ Op.in ]: Sequelize.literal('(' + rawQuery + ')')+ [Op.in]: Sequelize.literal('(' + rawQuery + ')')},- [ Op.or ]: [+ [Op.or]: [{ privacy: VideoPrivacy.PUBLIC },{ privacy: VideoPrivacy.UNLISTED }]@@ -1131,10 +1130,10 @@ export class VideoModel extends Model<VideoModel> {required: false,// We only want videos shared by this actorwhere: {- [ Op.and ]: [+ [Op.and]: [{id: {- [ Op.not ]: null+ [Op.not]: null}},{@@ -1184,8 +1183,8 @@ export class VideoModel extends Model<VideoModel> {// totals: totalVideos + totalVideoShareslet totalVideos = 0let totalVideoShares = 0- if (totals[ 0 ]) totalVideos = parseInt(totals[ 0 ].total, 10)- if (totals[ 1 ]) totalVideoShares = parseInt(totals[ 1 ].total, 10)+ if (totals[0]) totalVideos = parseInt(totals[0].total, 10)+ if (totals[1]) totalVideoShares = parseInt(totals[1].total, 10)const total = totalVideos + totalVideoSharesreturn {@@ -1228,7 +1227,7 @@ export class VideoModel extends Model<VideoModel> {baseQuery = Object.assign(baseQuery, {where: {name: {- [ Op.iLike ]: '%' + search + '%'+ [Op.iLike]: '%' + search + '%'}}})@@ -1258,25 +1257,25 @@ export class VideoModel extends Model<VideoModel> {}static async listForApi (options: {- start: number,- count: number,- sort: string,- nsfw: boolean,- includeLocalVideos: boolean,- withFiles: boolean,- categoryOneOf?: number[],- licenceOneOf?: number[],- languageOneOf?: string[],- tagsOneOf?: string[],- tagsAllOf?: string[],- filter?: VideoFilter,- accountId?: number,- videoChannelId?: number,+ start: number+ count: number+ sort: string+ nsfw: boolean+ includeLocalVideos: boolean+ withFiles: boolean+ categoryOneOf?: number[]+ licenceOneOf?: number[]+ languageOneOf?: string[]+ tagsOneOf?: string[]+ tagsAllOf?: string[]+ filter?: VideoFilter+ accountId?: number+ videoChannelId?: numberfollowerActorId?: number- videoPlaylistId?: number,- trendingDays?: number,- user?: MUserAccountId,- historyOfUser?: MUserId,+ videoPlaylistId?: number+ trendingDays?: number+ user?: MUserAccountId+ historyOfUser?: MUserIdcountVideos?: boolean}) {if (options.filter && options.filter === 'all-local' && !options.user.hasRight(UserRight.SEE_ALL_VIDEOS)) {@@ -1342,7 +1341,7 @@ export class VideoModel extends Model<VideoModel> {tagsAllOf?: string[]durationMin?: number // secondsdurationMax?: number // seconds- user?: MUserAccountId,+ user?: MUserAccountIdfilter?: VideoFilter}) {const whereAnd = []@@ -1350,8 +1349,8 @@ export class VideoModel extends Model<VideoModel> {if (options.startDate || options.endDate) {const publishedAtRange = {}- if (options.startDate) publishedAtRange[ Op.gte ] = options.startDate- if (options.endDate) publishedAtRange[ Op.lte ] = options.endDate+ if (options.startDate) publishedAtRange[Op.gte] = options.startDate+ if (options.endDate) publishedAtRange[Op.lte] = options.endDatewhereAnd.push({ publishedAt: publishedAtRange })}@@ -1359,8 +1358,8 @@ export class VideoModel extends Model<VideoModel> {if (options.originallyPublishedStartDate || options.originallyPublishedEndDate) {const originallyPublishedAtRange = {}- if (options.originallyPublishedStartDate) originallyPublishedAtRange[ Op.gte ] = options.originallyPublishedStartDate- if (options.originallyPublishedEndDate) originallyPublishedAtRange[ Op.lte ] = options.originallyPublishedEndDate+ if (options.originallyPublishedStartDate) originallyPublishedAtRange[Op.gte] = options.originallyPublishedStartDate+ if (options.originallyPublishedEndDate) originallyPublishedAtRange[Op.lte] = options.originallyPublishedEndDatewhereAnd.push({ originallyPublishedAt: originallyPublishedAtRange })}@@ -1368,8 +1367,8 @@ export class VideoModel extends Model<VideoModel> {if (options.durationMin || options.durationMax) {const durationRange = {}- if (options.durationMin) durationRange[ Op.gte ] = options.durationMin- if (options.durationMax) durationRange[ Op.lte ] = options.durationMax+ if (options.durationMin) durationRange[Op.gte] = options.durationMin+ if (options.durationMax) durationRange[Op.lte] = options.durationMaxwhereAnd.push({ duration: durationRange })}@@ -1380,7 +1379,7 @@ export class VideoModel extends Model<VideoModel> {if (options.search) {const trigramSearch = {id: {- [ Op.in ]: Sequelize.literal(+ [Op.in]: Sequelize.literal('(' +'SELECT "video"."id" FROM "video" ' +'WHERE ' +@@ -1578,8 +1577,8 @@ export class VideoModel extends Model<VideoModel> {}static loadForGetAPI (parameters: {- id: number | string,- t?: Transaction,+ id: number | string+ t?: TransactionuserId?: number}): Bluebird<MVideoDetails> {const { id, t, userId } = parameters@@ -1645,9 +1644,9 @@ export class VideoModel extends Model<VideoModel> {static checkVideoHasInstanceFollow (videoId: number, followerActorId: number) {// Instances only share videosconst query = 'SELECT 1 FROM "videoShare" ' +- 'INNER JOIN "actorFollow" ON "actorFollow"."targetActorId" = "videoShare"."actorId" ' +- 'WHERE "actorFollow"."actorId" = $followerActorId AND "videoShare"."videoId" = $videoId ' +- 'LIMIT 1'+ 'INNER JOIN "actorFollow" ON "actorFollow"."targetActorId" = "videoShare"."actorId" ' ++ 'WHERE "actorFollow"."actorId" = $followerActorId AND "videoShare"."videoId" = $videoId ' ++ 'LIMIT 1'const options = {type: QueryTypes.SELECT as QueryTypes.SELECT,@@ -1679,7 +1678,7 @@ export class VideoModel extends Model<VideoModel> {}return VideoModel.findAll(query)- .then(videos => videos.map(v => v.id))+ .then(videos => videos.map(v => v.id))}// threshold corresponds to how many video the field should have to be returned@@ -1699,14 +1698,14 @@ export class VideoModel extends Model<VideoModel> {limit: count,group: field,having: Sequelize.where(- Sequelize.fn('COUNT', Sequelize.col(field)), { [ Op.gte ]: threshold }+ Sequelize.fn('COUNT', Sequelize.col(field)), { [Op.gte]: threshold }),order: [ (this.sequelize as any).random() ]}return VideoModel.scope({ method: [ ScopeNames.AVAILABLE_FOR_LIST_IDS, scopeOptions ] }).findAll(query)- .then(rows => rows.map(r => r[ field ]))+ .then(rows => rows.map(r => r[field]))}static buildTrendingQuery (trendingDays: number) {@@ -1717,7 +1716,7 @@ export class VideoModel extends Model<VideoModel> {required: false,where: {startDate: {- [ Op.gte ]: new Date(new Date().getTime() - (24 * 3600 * 1000) * trendingDays)+ [Op.gte]: new Date(new Date().getTime() - (24 * 3600 * 1000) * trendingDays)}}}@@ -1800,23 +1799,23 @@ export class VideoModel extends Model<VideoModel> {}static getCategoryLabel (id: number) {- return VIDEO_CATEGORIES[ id ] || 'Misc'+ return VIDEO_CATEGORIES[id] || 'Misc'}static getLicenceLabel (id: number) {- return VIDEO_LICENCES[ id ] || 'Unknown'+ return VIDEO_LICENCES[id] || 'Unknown'}static getLanguageLabel (id: string) {- return VIDEO_LANGUAGES[ id ] || 'Unknown'+ return VIDEO_LANGUAGES[id] || 'Unknown'}static getPrivacyLabel (id: number) {- return VIDEO_PRIVACIES[ id ] || 'Unknown'+ return VIDEO_PRIVACIES[id] || 'Unknown'}static getStateLabel (id: number) {- return VIDEO_STATES[ id ] || 'Unknown'+ return VIDEO_STATES[id] || 'Unknown'}isBlacklisted () {@@ -1828,7 +1827,7 @@ export class VideoModel extends Model<VideoModel> {this.VideoChannel.Account.isBlocked()}- getQualityFileBy <T extends MVideoWithFile> (this: T, fun: (files: MVideoFile[], it: (file: MVideoFile) => number) => MVideoFile) {+ getQualityFileBy<T extends MVideoWithFile> (this: T, fun: (files: MVideoFile[], it: (file: MVideoFile) => number) => MVideoFile) {if (Array.isArray(this.VideoFiles) && this.VideoFiles.length !== 0) {const file = fun(this.VideoFiles, file => file.resolution)@@ -1846,15 +1845,15 @@ export class VideoModel extends Model<VideoModel> {return undefined}- getMaxQualityFile <T extends MVideoWithFile> (this: T): MVideoFileVideo | MVideoFileStreamingPlaylistVideo {+ getMaxQualityFile<T extends MVideoWithFile> (this: T): MVideoFileVideo | MVideoFileStreamingPlaylistVideo {return this.getQualityFileBy(maxBy)}- getMinQualityFile <T extends MVideoWithFile> (this: T): MVideoFileVideo | MVideoFileStreamingPlaylistVideo {+ getMinQualityFile<T extends MVideoWithFile> (this: T): MVideoFileVideo | MVideoFileStreamingPlaylistVideo {return this.getQualityFileBy(minBy)}- getWebTorrentFile <T extends MVideoWithFile> (this: T, resolution: number): MVideoFileVideo {+ getWebTorrentFile<T extends MVideoWithFile> (this: T, resolution: number): MVideoFileVideo {if (Array.isArray(this.VideoFiles) === false) return undefinedconst file = this.VideoFiles.find(f => f.resolution === resolution)@@ -1977,8 +1976,8 @@ export class VideoModel extends Model<VideoModel> {}this.VideoStreamingPlaylists = this.VideoStreamingPlaylists- .filter(s => s.type !== VideoStreamingPlaylistType.HLS)- .concat(toAdd)+ .filter(s => s.type !== VideoStreamingPlaylistType.HLS)+ .concat(toAdd)}removeFile (videoFile: MVideoFile, isRedundancy = false) {@@ -1999,7 +1998,7 @@ export class VideoModel extends Model<VideoModel> {await remove(directoryPath)if (isRedundancy !== true) {- let streamingPlaylistWithFiles = streamingPlaylist as MStreamingPlaylistFilesVideo+ const streamingPlaylistWithFiles = streamingPlaylist as MStreamingPlaylistFilesVideostreamingPlaylistWithFiles.Video = thisif (!Array.isArray(streamingPlaylistWithFiles.VideoFiles)) {diff --git a/server/tests/api/activitypub/client.ts b/server/tests/api/activitypub/client.tsindex 34c6be49be..d16f051080 100644--- a/server/tests/api/activitypub/client.ts+++ b/server/tests/api/activitypub/client.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'@@ -6,8 +6,6 @@ import {cleanupTests,doubleFollow,flushAndRunMultipleServers,- flushTests,- killallServers,makeActivityPubGetRequest,ServerInfo,setAccessTokensToServers,diff --git a/server/tests/api/activitypub/fetch.ts b/server/tests/api/activitypub/fetch.tsindex 3d54c20428..35fd94eed6 100644--- a/server/tests/api/activitypub/fetch.ts+++ b/server/tests/api/activitypub/fetch.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'@@ -8,9 +8,7 @@ import {createUser,doubleFollow,flushAndRunMultipleServers,- flushTests,getVideosListSort,- killallServers,ServerInfo,setAccessTokensToServers,setActorField,diff --git a/server/tests/api/activitypub/helpers.ts b/server/tests/api/activitypub/helpers.tsindex 8c00ba3d6f..60d95b823f 100644--- a/server/tests/api/activitypub/helpers.ts+++ b/server/tests/api/activitypub/helpers.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'import { expect } from 'chai'diff --git a/server/tests/api/activitypub/refresher.ts b/server/tests/api/activitypub/refresher.tsindex aa4bc6c0f3..232c5d8234 100644--- a/server/tests/api/activitypub/refresher.ts+++ b/server/tests/api/activitypub/refresher.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'import {@@ -43,32 +43,32 @@ describe('Test AP refresher', function () {await setDefaultVideoChannel(servers){- videoUUID1 = (await uploadVideoAndGetId({ server: servers[ 1 ], videoName: 'video1' })).uuid- videoUUID2 = (await uploadVideoAndGetId({ server: servers[ 1 ], videoName: 'video2' })).uuid- videoUUID3 = (await uploadVideoAndGetId({ server: servers[ 1 ], videoName: 'video3' })).uuid+ videoUUID1 = (await uploadVideoAndGetId({ server: servers[1], videoName: 'video1' })).uuid+ videoUUID2 = (await uploadVideoAndGetId({ server: servers[1], videoName: 'video2' })).uuid+ videoUUID3 = (await uploadVideoAndGetId({ server: servers[1], videoName: 'video3' })).uuid}{- const a1 = await generateUserAccessToken(servers[ 1 ], 'user1')- await uploadVideo(servers[ 1 ].url, a1, { name: 'video4' })+ const a1 = await generateUserAccessToken(servers[1], 'user1')+ await uploadVideo(servers[1].url, a1, { name: 'video4' })- const a2 = await generateUserAccessToken(servers[ 1 ], 'user2')- await uploadVideo(servers[ 1 ].url, a2, { name: 'video5' })+ const a2 = await generateUserAccessToken(servers[1], 'user2')+ await uploadVideo(servers[1].url, a2, { name: 'video5' })}{- const playlistAttrs = { displayName: 'playlist1', privacy: VideoPlaylistPrivacy.PUBLIC, videoChannelId: servers[ 1 ].videoChannel.id }- const res = await createVideoPlaylist({ url: servers[ 1 ].url, token: servers[ 1 ].accessToken, playlistAttrs })+ const playlistAttrs = { displayName: 'playlist1', privacy: VideoPlaylistPrivacy.PUBLIC, videoChannelId: servers[1].videoChannel.id }+ const res = await createVideoPlaylist({ url: servers[1].url, token: servers[1].accessToken, playlistAttrs })playlistUUID1 = res.body.videoPlaylist.uuid}{- const playlistAttrs = { displayName: 'playlist2', privacy: VideoPlaylistPrivacy.PUBLIC, videoChannelId: servers[ 1 ].videoChannel.id }- const res = await createVideoPlaylist({ url: servers[ 1 ].url, token: servers[ 1 ].accessToken, playlistAttrs })+ const playlistAttrs = { displayName: 'playlist2', privacy: VideoPlaylistPrivacy.PUBLIC, videoChannelId: servers[1].videoChannel.id }+ const res = await createVideoPlaylist({ url: servers[1].url, token: servers[1].accessToken, playlistAttrs })playlistUUID2 = res.body.videoPlaylist.uuid}- await doubleFollow(servers[ 0 ], servers[ 1 ])+ await doubleFollow(servers[0], servers[1])})describe('Videos refresher', function () {@@ -79,34 +79,34 @@ describe('Test AP refresher', function () {await wait(10000)// Change UUID so the remote server returns a 404- await setVideoField(servers[ 1 ].internalServerNumber, videoUUID1, 'uuid', '304afe4f-39f9-4d49-8ed7-ac57b86b174f')+ await setVideoField(servers[1].internalServerNumber, videoUUID1, 'uuid', '304afe4f-39f9-4d49-8ed7-ac57b86b174f')- await getVideo(servers[ 0 ].url, videoUUID1)- await getVideo(servers[ 0 ].url, videoUUID2)+ await getVideo(servers[0].url, videoUUID1)+ await getVideo(servers[0].url, videoUUID2)await waitJobs(servers)- await getVideo(servers[ 0 ].url, videoUUID1, 404)- await getVideo(servers[ 0 ].url, videoUUID2, 200)+ await getVideo(servers[0].url, videoUUID1, 404)+ await getVideo(servers[0].url, videoUUID2, 200)})it('Should not update a remote video if the remote instance is down', async function () {this.timeout(70000)- killallServers([ servers[ 1 ] ])+ killallServers([ servers[1] ])- await setVideoField(servers[ 1 ].internalServerNumber, videoUUID3, 'uuid', '304afe4f-39f9-4d49-8ed7-ac57b86b174e')+ await setVideoField(servers[1].internalServerNumber, videoUUID3, 'uuid', '304afe4f-39f9-4d49-8ed7-ac57b86b174e')// Video will need a refreshawait wait(10000)- await getVideo(servers[ 0 ].url, videoUUID3)+ await getVideo(servers[0].url, videoUUID3)// The refresh should fail- await waitJobs([ servers[ 0 ] ])+ await waitJobs([ servers[0] ])- await reRunServer(servers[ 1 ])+ await reRunServer(servers[1])- await getVideo(servers[ 0 ].url, videoUUID3, 200)+ await getVideo(servers[0].url, videoUUID3, 200)})})@@ -118,16 +118,16 @@ describe('Test AP refresher', function () {await wait(10000)// Change actor name so the remote server returns a 404- const to = 'http://localhost:' + servers[ 1 ].port + '/accounts/user2'- await setActorField(servers[ 1 ].internalServerNumber, to, 'preferredUsername', 'toto')+ const to = 'http://localhost:' + servers[1].port + '/accounts/user2'+ await setActorField(servers[1].internalServerNumber, to, 'preferredUsername', 'toto')- await getAccount(servers[ 0 ].url, 'user1@localhost:' + servers[ 1 ].port)- await getAccount(servers[ 0 ].url, 'user2@localhost:' + servers[ 1 ].port)+ await getAccount(servers[0].url, 'user1@localhost:' + servers[1].port)+ await getAccount(servers[0].url, 'user2@localhost:' + servers[1].port)await waitJobs(servers)- await getAccount(servers[ 0 ].url, 'user1@localhost:' + servers[ 1 ].port, 200)- await getAccount(servers[ 0 ].url, 'user2@localhost:' + servers[ 1 ].port, 404)+ await getAccount(servers[0].url, 'user1@localhost:' + servers[1].port, 200)+ await getAccount(servers[0].url, 'user2@localhost:' + servers[1].port, 404)})})@@ -139,15 +139,15 @@ describe('Test AP refresher', function () {await wait(10000)// Change UUID so the remote server returns a 404- await setPlaylistField(servers[ 1 ].internalServerNumber, playlistUUID2, 'uuid', '304afe4f-39f9-4d49-8ed7-ac57b86b178e')+ await setPlaylistField(servers[1].internalServerNumber, playlistUUID2, 'uuid', '304afe4f-39f9-4d49-8ed7-ac57b86b178e')- await getVideoPlaylist(servers[ 0 ].url, playlistUUID1)- await getVideoPlaylist(servers[ 0 ].url, playlistUUID2)+ await getVideoPlaylist(servers[0].url, playlistUUID1)+ await getVideoPlaylist(servers[0].url, playlistUUID2)await waitJobs(servers)- await getVideoPlaylist(servers[ 0 ].url, playlistUUID1, 200)- await getVideoPlaylist(servers[ 0 ].url, playlistUUID2, 404)+ await getVideoPlaylist(servers[0].url, playlistUUID1, 200)+ await getVideoPlaylist(servers[0].url, playlistUUID2, 404)})})diff --git a/server/tests/api/activitypub/security.ts b/server/tests/api/activitypub/security.tsindex dc960c5c34..7e58bf0652 100644--- a/server/tests/api/activitypub/security.ts+++ b/server/tests/api/activitypub/security.ts@@ -1,15 +1,8 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'-import {- cleanupTests,- closeAllSequelize,- flushAndRunMultipleServers,- killallServers,- ServerInfo,- setActorField-} from '../../../../shared/extra-utils'+import { cleanupTests, closeAllSequelize, flushAndRunMultipleServers, ServerInfo, setActorField } from '../../../../shared/extra-utils'import { HTTP_SIGNATURE } from '../../../initializers/constants'import { buildDigest, buildGlobalHeaders } from '../../../lib/job-queue/handlers/utils/activitypub-http-utils'import * as chai from 'chai'@@ -33,7 +26,7 @@ function getAnnounceWithoutContext (server2: ServerInfo) {if (Array.isArray(json[key])) {result[key] = json[key].map(v => v.replace(':9002', `:${server2.port}`))} else {- result[ key ] = json[ key ].replace(':9002', `:${server2.port}`)+ result[key] = json[key].replace(':9002', `:${server2.port}`)}}diff --git a/server/tests/api/check-params/accounts.ts b/server/tests/api/check-params/accounts.tsindex 4f79685bdf..c29af7cd70 100644--- a/server/tests/api/check-params/accounts.ts+++ b/server/tests/api/check-params/accounts.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'diff --git a/server/tests/api/check-params/blocklist.ts b/server/tests/api/check-params/blocklist.tsindex 0661676ce6..fb459f756f 100644--- a/server/tests/api/check-params/blocklist.ts+++ b/server/tests/api/check-params/blocklist.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'diff --git a/server/tests/api/check-params/config.ts b/server/tests/api/check-params/config.tsindex 443fbcb60b..f1a79806bb 100644--- a/server/tests/api/check-params/config.ts+++ b/server/tests/api/check-params/config.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { omit } from 'lodash'import 'mocha'diff --git a/server/tests/api/check-params/contact-form.ts b/server/tests/api/check-params/contact-form.tsindex b3051945ed..b2126b9b09 100644--- a/server/tests/api/check-params/contact-form.ts+++ b/server/tests/api/check-params/contact-form.ts@@ -1,22 +1,8 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'-import {- flushTests,- immutableAssign,- killallServers,- reRunServer,- flushAndRunServer,- ServerInfo,- setAccessTokensToServers, cleanupTests-} from '../../../../shared/extra-utils'-import {- checkBadCountPagination,- checkBadSortPagination,- checkBadStartPagination-} from '../../../../shared/extra-utils/requests/check-api-params'-import { getAccount } from '../../../../shared/extra-utils/users/accounts'+import { cleanupTests, flushAndRunServer, immutableAssign, killallServers, reRunServer, ServerInfo } from '../../../../shared/extra-utils'import { sendContactForm } from '../../../../shared/extra-utils/server/contact-form'import { MockSmtpServer } from '../../../../shared/extra-utils/miscs/email'diff --git a/server/tests/api/check-params/debug.ts b/server/tests/api/check-params/debug.tsindex 8dad267233..5fac734857 100644--- a/server/tests/api/check-params/debug.ts+++ b/server/tests/api/check-params/debug.ts@@ -1,15 +1,14 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'import {+ cleanupTests,createUser,- flushTests,- killallServers,flushAndRunServer,ServerInfo,setAccessTokensToServers,- userLogin, cleanupTests+ userLogin} from '../../../../shared/extra-utils'import { makeGetRequest } from '../../../../shared/extra-utils/requests/requests'diff --git a/server/tests/api/check-params/follows.ts b/server/tests/api/check-params/follows.tsindex be2a603a3a..2c2224a452 100644--- a/server/tests/api/check-params/follows.ts+++ b/server/tests/api/check-params/follows.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'diff --git a/server/tests/api/check-params/jobs.ts b/server/tests/api/check-params/jobs.tsindex 22e2379647..8f4af8d162 100644--- a/server/tests/api/check-params/jobs.ts+++ b/server/tests/api/check-params/jobs.ts@@ -1,16 +1,14 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'import {+ cleanupTests,createUser,- flushTests,- killallServers,flushAndRunServer,ServerInfo,setAccessTokensToServers,- userLogin,- cleanupTests+ userLogin} from '../../../../shared/extra-utils'import {checkBadCountPagination,diff --git a/server/tests/api/check-params/logs.ts b/server/tests/api/check-params/logs.tsindex f9d96bcc07..719da54e68 100644--- a/server/tests/api/check-params/logs.ts+++ b/server/tests/api/check-params/logs.ts@@ -1,16 +1,14 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'import {+ cleanupTests,createUser,- flushTests,- killallServers,flushAndRunServer,ServerInfo,setAccessTokensToServers,- userLogin,- cleanupTests+ userLogin} from '../../../../shared/extra-utils'import { makeGetRequest } from '../../../../shared/extra-utils/requests/requests'diff --git a/server/tests/api/check-params/plugins.ts b/server/tests/api/check-params/plugins.tsindex 9553bce17f..cf80b35c29 100644--- a/server/tests/api/check-params/plugins.ts+++ b/server/tests/api/check-params/plugins.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'diff --git a/server/tests/api/check-params/redundancy.ts b/server/tests/api/check-params/redundancy.tsindex 7012a39ee4..b2370a094f 100644--- a/server/tests/api/check-params/redundancy.ts+++ b/server/tests/api/check-params/redundancy.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'@@ -38,7 +38,7 @@ describe('Test server redundancy API validators', function () {password: 'password'}- await createUser({ url: servers[ 0 ].url, accessToken: servers[ 0 ].accessToken, username: user.username, password: user.password })+ await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: user.username, password: user.password })userAccessToken = await userLogin(servers[0], user)videoIdLocal = (await uploadVideoAndGetId({ server: servers[0], videoName: 'video' })).iddiff --git a/server/tests/api/check-params/search.ts b/server/tests/api/check-params/search.tsindex 8ad9d98bf6..f8d0cd4ece 100644--- a/server/tests/api/check-params/search.ts+++ b/server/tests/api/check-params/search.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'diff --git a/server/tests/api/check-params/services.ts b/server/tests/api/check-params/services.tsindex d15753aedd..457adfaabf 100644--- a/server/tests/api/check-params/services.ts+++ b/server/tests/api/check-params/services.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'diff --git a/server/tests/api/check-params/user-notifications.ts b/server/tests/api/check-params/user-notifications.tsindex 3b06be7ef4..2048fa6673 100644--- a/server/tests/api/check-params/user-notifications.ts+++ b/server/tests/api/check-params/user-notifications.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'import * as io from 'socket.io-client'diff --git a/server/tests/api/check-params/user-subscriptions.ts b/server/tests/api/check-params/user-subscriptions.tsindex fa36c40780..1edba4d64a 100644--- a/server/tests/api/check-params/user-subscriptions.ts+++ b/server/tests/api/check-params/user-subscriptions.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.tsindex 5d5af284c5..f448bb2a62 100644--- a/server/tests/api/check-params/users.ts+++ b/server/tests/api/check-params/users.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { omit } from 'lodash'import 'mocha'@@ -50,6 +50,7 @@ describe('Test users API validators', function () {let serverWithRegistrationDisabled: ServerInfolet userAccessToken = ''let moderatorAccessToken = ''+ // eslint-disable-next-line @typescript-eslint/no-unused-varslet channelId: number// ---------------------------------------------------------------@@ -120,7 +121,7 @@ describe('Test users API validators', function () {{const res = await getMyUserInformation(server.url, server.accessToken)- channelId = res.body.videoChannels[ 0 ].id+ channelId = res.body.videoChannels[0].id}{@@ -529,7 +530,7 @@ describe('Test users API validators', function () {it('Should fail without an incorrect input file', async function () {const fields = {}const attaches = {- 'avatarfile': join(__dirname, '..', '..', 'fixtures', 'video_short.mp4')+ avatarfile: join(__dirname, '..', '..', 'fixtures', 'video_short.mp4')}await makeUploadRequest({ url: server.url, path: path + '/me/avatar/pick', token: server.accessToken, fields, attaches })})@@ -537,7 +538,7 @@ describe('Test users API validators', function () {it('Should fail with a big file', async function () {const fields = {}const attaches = {- 'avatarfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png')+ avatarfile: join(__dirname, '..', '..', 'fixtures', 'avatar-big.png')}await makeUploadRequest({ url: server.url, path: path + '/me/avatar/pick', token: server.accessToken, fields, attaches })})@@ -545,7 +546,7 @@ describe('Test users API validators', function () {it('Should fail with an unauthenticated user', async function () {const fields = {}const attaches = {- 'avatarfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png')+ avatarfile: join(__dirname, '..', '..', 'fixtures', 'avatar.png')}await makeUploadRequest({url: server.url,@@ -559,7 +560,7 @@ describe('Test users API validators', function () {it('Should succeed with the correct params', async function () {const fields = {}const attaches = {- 'avatarfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png')+ avatarfile: join(__dirname, '..', '..', 'fixtures', 'avatar.png')}await makeUploadRequest({url: server.url,diff --git a/server/tests/api/check-params/video-abuses.ts b/server/tests/api/check-params/video-abuses.tsindex bf29f8d4d9..bea2177f35 100644--- a/server/tests/api/check-params/video-abuses.ts+++ b/server/tests/api/check-params/video-abuses.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'@@ -126,6 +126,7 @@ describe('Test video abuses API validators', function () {describe('When updating a video abuse', function () {const basePath = '/api/v1/videos/'+ // eslint-disable-next-line @typescript-eslint/no-unused-varslet path: stringbefore(() => {@@ -163,6 +164,7 @@ describe('Test video abuses API validators', function () {describe('When deleting a video abuse', function () {const basePath = '/api/v1/videos/'+ // eslint-disable-next-line @typescript-eslint/no-unused-varslet path: stringbefore(() => {diff --git a/server/tests/api/check-params/video-blacklist.ts b/server/tests/api/check-params/video-blacklist.tsindex 6466888fb5..145f439803 100644--- a/server/tests/api/check-params/video-blacklist.ts+++ b/server/tests/api/check-params/video-blacklist.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'@@ -7,25 +7,24 @@ import {createUser,doubleFollow,flushAndRunMultipleServers,- flushTests,getBlacklistedVideosList,getVideo,getVideoWithToken,- killallServers,makePostBodyRequest,makePutBodyRequest,removeVideoFromBlacklist,ServerInfo,setAccessTokensToServers,uploadVideo,- userLogin, waitJobs+ userLogin,+ waitJobs} from '../../../../shared/extra-utils'import {checkBadCountPagination,checkBadSortPagination,checkBadStartPagination} from '../../../../shared/extra-utils/requests/check-api-params'-import { VideoDetails, VideoBlacklistType } from '../../../../shared/models/videos'+import { VideoBlacklistType, VideoDetails } from '../../../../shared/models/videos'import { expect } from 'chai'describe('Test video blacklist API validators', function () {@@ -48,14 +47,14 @@ describe('Test video blacklist API validators', function () {{const username = 'user1'const password = 'my super password'- await createUser({ url: servers[ 0 ].url, accessToken: servers[ 0 ].accessToken, username: username, password: password })+ await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: username, password: password })userAccessToken1 = await userLogin(servers[0], { username, password })}{const username = 'user2'const password = 'my super password'- await createUser({ url: servers[ 0 ].url, accessToken: servers[ 0 ].accessToken, username: username, password: password })+ await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: username, password: password })userAccessToken2 = await userLogin(servers[0], { username, password })}@@ -120,7 +119,7 @@ describe('Test video blacklist API validators', function () {it('Should succeed with the correct params', async function () {const path = basePath + servers[0].video.uuid + '/blacklist'- const fields = { }+ const fields = {}await makePostBodyRequest({ url: servers[0].url, path, token: servers[0].accessToken, fields, statusCodeExpected: 204 })})diff --git a/server/tests/api/check-params/video-captions.ts b/server/tests/api/check-params/video-captions.tsindex 6ddc20d691..a5f5c33228 100644--- a/server/tests/api/check-params/video-captions.ts+++ b/server/tests/api/check-params/video-captions.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'import {@@ -50,7 +50,7 @@ describe('Test video captions API validator', function () {describe('When adding video caption', function () {const fields = { }const attaches = {- 'captionfile': join(__dirname, '..', '..', 'fixtures', 'subtitle-good1.vtt')+ captionfile: join(__dirname, '..', '..', 'fixtures', 'subtitle-good1.vtt')}it('Should fail without a valid uuid', async function () {diff --git a/server/tests/api/check-params/video-channels.ts b/server/tests/api/check-params/video-channels.tsindex de88298d16..2795ad7d51 100644--- a/server/tests/api/check-params/video-channels.ts+++ b/server/tests/api/check-params/video-channels.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import { omit } from 'lodash'@@ -243,7 +243,7 @@ describe('Test video channels API validator', function () {it('Should fail with an incorrect input file', async function () {const fields = {}const attaches = {- 'avatarfile': join(__dirname, '..', '..', 'fixtures', 'video_short.mp4')+ avatarfile: join(__dirname, '..', '..', 'fixtures', 'video_short.mp4')}await makeUploadRequest({ url: server.url, path: path + '/avatar/pick', token: server.accessToken, fields, attaches })})@@ -251,7 +251,7 @@ describe('Test video channels API validator', function () {it('Should fail with a big file', async function () {const fields = {}const attaches = {- 'avatarfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png')+ avatarfile: join(__dirname, '..', '..', 'fixtures', 'avatar-big.png')}await makeUploadRequest({ url: server.url, path: path + '/avatar/pick', token: server.accessToken, fields, attaches })})@@ -259,7 +259,7 @@ describe('Test video channels API validator', function () {it('Should fail with an unauthenticated user', async function () {const fields = {}const attaches = {- 'avatarfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png')+ avatarfile: join(__dirname, '..', '..', 'fixtures', 'avatar.png')}await makeUploadRequest({url: server.url,@@ -273,7 +273,7 @@ describe('Test video channels API validator', function () {it('Should succeed with the correct params', async function () {const fields = {}const attaches = {- 'avatarfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png')+ avatarfile: join(__dirname, '..', '..', 'fixtures', 'avatar.png')}await makeUploadRequest({url: server.url,@@ -324,7 +324,7 @@ describe('Test video channels API validator', function () {})it('Should fail with an unknown video channel id', async function () {- await deleteVideoChannel(server.url, server.accessToken,'super_channel2', 404)+ await deleteVideoChannel(server.url, server.accessToken, 'super_channel2', 404)})it('Should succeed with the correct parameters', async function () {diff --git a/server/tests/api/check-params/video-comments.ts b/server/tests/api/check-params/video-comments.tsindex 5cf90bacc2..e67cc01fa4 100644--- a/server/tests/api/check-params/video-comments.ts+++ b/server/tests/api/check-params/video-comments.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'diff --git a/server/tests/api/check-params/video-imports.ts b/server/tests/api/check-params/video-imports.tsindex 231d5cc856..dbea39c48c 100644--- a/server/tests/api/check-params/video-imports.ts+++ b/server/tests/api/check-params/video-imports.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { omit } from 'lodash'import 'mocha'@@ -29,6 +29,7 @@ describe('Test video imports API validator', function () {const path = '/api/v1/videos/imports'let server: ServerInfolet userAccessToken = ''+ // eslint-disable-next-line @typescript-eslint/no-unused-varslet accountName: stringlet channelId: number@@ -48,7 +49,7 @@ describe('Test video imports API validator', function () {{const res = await getMyUserInformation(server.url, server.accessToken)- channelId = res.body.videoChannels[ 0 ].id+ channelId = res.body.videoChannels[0].idaccountName = res.body.account.name + '@' + res.body.account.host}})@@ -196,7 +197,7 @@ describe('Test video imports API validator', function () {it('Should fail with an incorrect thumbnail file', async function () {const fields = baseCorrectParamsconst attaches = {- 'thumbnailfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png')+ thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'avatar.png')}await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches })@@ -205,7 +206,7 @@ describe('Test video imports API validator', function () {it('Should fail with a big thumbnail file', async function () {const fields = baseCorrectParamsconst attaches = {- 'thumbnailfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png')+ thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'avatar-big.png')}await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches })@@ -214,7 +215,7 @@ describe('Test video imports API validator', function () {it('Should fail with an incorrect preview file', async function () {const fields = baseCorrectParamsconst attaches = {- 'previewfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png')+ previewfile: join(__dirname, '..', '..', 'fixtures', 'avatar.png')}await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches })@@ -223,7 +224,7 @@ describe('Test video imports API validator', function () {it('Should fail with a big preview file', async function () {const fields = baseCorrectParamsconst attaches = {- 'previewfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png')+ previewfile: join(__dirname, '..', '..', 'fixtures', 'avatar-big.png')}await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches })@@ -232,7 +233,7 @@ describe('Test video imports API validator', function () {it('Should fail with an invalid torrent file', async function () {const fields = omit(baseCorrectParams, 'targetUrl')const attaches = {- 'torrentfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png')+ torrentfile: join(__dirname, '..', '..', 'fixtures', 'avatar-big.png')}await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches })@@ -303,7 +304,7 @@ describe('Test video imports API validator', function () {fields = omit(fields, 'magnetUri')const attaches = {- 'torrentfile': join(__dirname, '..', '..', 'fixtures', 'video-720p.torrent')+ torrentfile: join(__dirname, '..', '..', 'fixtures', 'video-720p.torrent')}await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches, statusCodeExpected: 409 })diff --git a/server/tests/api/check-params/video-playlists.ts b/server/tests/api/check-params/video-playlists.tsindex df158f3b1c..0410e737a1 100644--- a/server/tests/api/check-params/video-playlists.ts+++ b/server/tests/api/check-params/video-playlists.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'import {@@ -36,6 +36,7 @@ describe('Test video playlists API validator', function () {let privatePlaylistUUID: stringlet watchLaterPlaylistId: numberlet videoId: number+ // eslint-disable-next-line @typescript-eslint/no-unused-varslet videoId2: numberlet playlistElementId: number@@ -449,7 +450,7 @@ describe('Test video playlists API validator', function () {videoId3 = (await uploadVideoAndGetId({ server, videoName: 'video 3' })).idvideoId4 = (await uploadVideoAndGetId({ server, videoName: 'video 4' })).id- for (let id of [ videoId3, videoId4 ]) {+ for (const id of [ videoId3, videoId4 ]) {await addVideoInPlaylist({url: server.url,token: server.accessToken,@@ -476,7 +477,7 @@ describe('Test video playlists API validator', function () {}{- const params = getBase({}, { playlistId: 42, expectedStatus: 404 })+ const params = getBase({}, { playlistId: 42, expectedStatus: 404 })await reorderVideosPlaylist(params)}})diff --git a/server/tests/api/check-params/videos-filter.ts b/server/tests/api/check-params/videos-filter.tsindex 811756745c..ec8654db27 100644--- a/server/tests/api/check-params/videos-filter.ts+++ b/server/tests/api/check-params/videos-filter.ts@@ -1,10 +1,9 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'import {cleanupTests,createUser,- createVideoPlaylist,flushAndRunServer,makeGetRequest,ServerInfo,@@ -13,7 +12,6 @@ import {userLogin} from '../../../../shared/extra-utils'import { UserRole } from '../../../../shared/models/users'-import { VideoPlaylistPrivacy } from '../../../../shared/models/videos/playlist/video-playlist-privacy.model'async function testEndpoints (server: ServerInfo, token: string, filter: string, statusCodeExpected: number) {const paths = [@@ -77,7 +75,7 @@ describe('Test videos filters', function () {})it('Should succeed with a good filter', async function () {- await testEndpoints(server, server.accessToken,'local', 200)+ await testEndpoints(server, server.accessToken, 'local', 200)})it('Should fail to list all-local with a simple user', async function () {diff --git a/server/tests/api/check-params/videos-history.ts b/server/tests/api/check-params/videos-history.tsindex 3739e3fad8..941f626541 100644--- a/server/tests/api/check-params/videos-history.ts+++ b/server/tests/api/check-params/videos-history.ts@@ -1,6 +1,5 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import * as chai from 'chai'import 'mocha'import {checkBadCountPagination,@@ -15,12 +14,10 @@ import {uploadVideo} from '../../../../shared/extra-utils'-const expect = chai.expect-describe('Test videos history API validator', function () {+ const myHistoryPath = '/api/v1/users/me/history/videos'+ const myHistoryRemove = myHistoryPath + '/remove'let watchingPath: string- let myHistoryPath = '/api/v1/users/me/history/videos'- let myHistoryRemove = myHistoryPath + '/remove'let server: ServerInfo// ---------------------------------------------------------------diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.tsindex 16ef1c5052..0d4665954c 100644--- a/server/tests/api/check-params/videos.ts+++ b/server/tests/api/check-params/videos.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import { omit } from 'lodash'@@ -56,8 +56,8 @@ describe('Test videos API validator', function () {{const res = await getMyUserInformation(server.url, server.accessToken)- channelId = res.body.videoChannels[ 0 ].id- channelName = res.body.videoChannels[ 0 ].name+ channelId = res.body.videoChannels[0].id+ channelName = res.body.videoChannels[0].nameaccountName = res.body.account.name + '@' + res.body.account.host}})@@ -182,7 +182,7 @@ describe('Test videos API validator', function () {describe('When adding a video', function () {let baseCorrectParamsconst baseCorrectAttaches = {- 'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short.webm')+ videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.webm')}before(function () {@@ -330,7 +330,7 @@ describe('Test videos API validator', function () {})it('Should fail with a bad originally published at attribute', async function () {- const fields = immutableAssign(baseCorrectParams, { 'originallyPublishedAt': 'toto' })+ const fields = immutableAssign(baseCorrectParams, { originallyPublishedAt: 'toto' })const attaches = baseCorrectAttachesawait makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })@@ -345,12 +345,12 @@ describe('Test videos API validator', function () {it('Should fail with an incorrect input file', async function () {const fields = baseCorrectParamslet attaches = {- 'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short_fake.webm')+ videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short_fake.webm')}await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })attaches = {- 'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short.mkv')+ videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mkv')}await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })})@@ -358,8 +358,8 @@ describe('Test videos API validator', function () {it('Should fail with an incorrect thumbnail file', async function () {const fields = baseCorrectParamsconst attaches = {- 'thumbnailfile': join(root(), 'server', 'tests', 'fixtures', 'avatar.png'),- 'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')+ thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'avatar.png'),+ videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')}await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })@@ -368,8 +368,8 @@ describe('Test videos API validator', function () {it('Should fail with a big thumbnail file', async function () {const fields = baseCorrectParamsconst attaches = {- 'thumbnailfile': join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png'),- 'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')+ thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png'),+ videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')}await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })@@ -378,8 +378,8 @@ describe('Test videos API validator', function () {it('Should fail with an incorrect preview file', async function () {const fields = baseCorrectParamsconst attaches = {- 'previewfile': join(root(), 'server', 'tests', 'fixtures', 'avatar.png'),- 'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')+ previewfile: join(root(), 'server', 'tests', 'fixtures', 'avatar.png'),+ videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')}await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })@@ -388,8 +388,8 @@ describe('Test videos API validator', function () {it('Should fail with a big preview file', async function () {const fields = baseCorrectParamsconst attaches = {- 'previewfile': join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png'),- 'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')+ previewfile: join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png'),+ videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')}await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })@@ -566,7 +566,7 @@ describe('Test videos API validator', function () {it('Should fail with an incorrect thumbnail file', async function () {const fields = baseCorrectParamsconst attaches = {- 'thumbnailfile': join(root(), 'server', 'tests', 'fixtures', 'avatar.png')+ thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'avatar.png')}await makeUploadRequest({@@ -582,7 +582,7 @@ describe('Test videos API validator', function () {it('Should fail with a big thumbnail file', async function () {const fields = baseCorrectParamsconst attaches = {- 'thumbnailfile': join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png')+ thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png')}await makeUploadRequest({@@ -598,7 +598,7 @@ describe('Test videos API validator', function () {it('Should fail with an incorrect preview file', async function () {const fields = baseCorrectParamsconst attaches = {- 'previewfile': join(root(), 'server', 'tests', 'fixtures', 'avatar.png')+ previewfile: join(root(), 'server', 'tests', 'fixtures', 'avatar.png')}await makeUploadRequest({@@ -614,7 +614,7 @@ describe('Test videos API validator', function () {it('Should fail with a big preview file', async function () {const fields = baseCorrectParamsconst attaches = {- 'previewfile': join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png')+ previewfile: join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png')}await makeUploadRequest({diff --git a/server/tests/api/notifications/user-notifications.ts b/server/tests/api/notifications/user-notifications.tsindex 15a34f5aab..2a632e16ff 100644--- a/server/tests/api/notifications/user-notifications.ts+++ b/server/tests/api/notifications/user-notifications.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'@@ -74,7 +74,7 @@ async function uploadVideoByRemoteAccount (servers: ServerInfo[], additionalParaconst name = 'remote video ' + uuidv4()const data = Object.assign({ name }, additionalParams)- const res = await uploadVideo(servers[ 1 ].url, servers[ 1 ].accessToken, data)+ const res = await uploadVideo(servers[1].url, servers[1].accessToken, data)await waitJobs(servers)@@ -85,7 +85,7 @@ async function uploadVideoByLocalAccount (servers: ServerInfo[], additionalParamconst name = 'local video ' + uuidv4()const data = Object.assign({ name }, additionalParams)- const res = await uploadVideo(servers[ 0 ].url, servers[ 0 ].accessToken, data)+ const res = await uploadVideo(servers[0].url, servers[0].accessToken, data)await waitJobs(servers)@@ -95,9 +95,9 @@ async function uploadVideoByLocalAccount (servers: ServerInfo[], additionalParamdescribe('Test users notifications', function () {let servers: ServerInfo[] = []let userAccessToken: string- let userNotifications: UserNotification[] = []- let adminNotifications: UserNotification[] = []- let adminNotificationsServer2: UserNotification[] = []+ const userNotifications: UserNotification[] = []+ const adminNotifications: UserNotification[] = []+ const adminNotificationsServer2: UserNotification[] = []const emails: object[] = []let channelId: number@@ -142,8 +142,8 @@ describe('Test users notifications', function () {password: 'super password'}await createUser({- url: servers[ 0 ].url,- accessToken: servers[ 0 ].accessToken,+ url: servers[0].url,+ accessToken: servers[0].accessToken,username: user.username,password: user.password,videoQuota: 10 * 1000 * 1000@@ -155,15 +155,15 @@ describe('Test users notifications', function () {await updateMyNotificationSettings(servers[1].url, servers[1].accessToken, allNotificationSettings){- const socket = getUserNotificationSocket(servers[ 0 ].url, userAccessToken)+ const socket = getUserNotificationSocket(servers[0].url, userAccessToken)socket.on('new-notification', n => userNotifications.push(n))}{- const socket = getUserNotificationSocket(servers[ 0 ].url, servers[0].accessToken)+ const socket = getUserNotificationSocket(servers[0].url, servers[0].accessToken)socket.on('new-notification', n => adminNotifications.push(n))}{- const socket = getUserNotificationSocket(servers[ 1 ].url, servers[1].accessToken)+ const socket = getUserNotificationSocket(servers[1].url, servers[1].accessToken)socket.on('new-notification', n => adminNotificationsServer2.push(n))}@@ -190,7 +190,7 @@ describe('Test users notifications', function () {await uploadVideoByLocalAccount(servers)- const notification = await getLastNotification(servers[ 0 ].url, userAccessToken)+ const notification = await getLastNotification(servers[0].url, userAccessToken)expect(notification).to.be.undefinedexpect(emails).to.have.lengthOf(0)@@ -221,7 +221,7 @@ describe('Test users notifications', function () {this.timeout(20000)// In 2 seconds- let updateAt = new Date(new Date().getTime() + 2000)+ const updateAt = new Date(new Date().getTime() + 2000)const data = {privacy: VideoPrivacy.PRIVATE,@@ -240,7 +240,7 @@ describe('Test users notifications', function () {this.timeout(50000)// In 2 seconds- let updateAt = new Date(new Date().getTime() + 2000)+ const updateAt = new Date(new Date().getTime() + 2000)const data = {privacy: VideoPrivacy.PRIVATE,@@ -259,7 +259,7 @@ describe('Test users notifications', function () {it('Should not send a notification before the video is published', async function () {this.timeout(20000)- let updateAt = new Date(new Date().getTime() + 1000000)+ const updateAt = new Date(new Date().getTime() + 1000000)const data = {privacy: VideoPrivacy.PRIVATE,@@ -386,7 +386,7 @@ describe('Test users notifications', function () {it('Should not send a new comment notification if the account is muted', async function () {this.timeout(10000)- await addAccountToAccountBlocklist(servers[ 0 ].url, userAccessToken, 'root')+ await addAccountToAccountBlocklist(servers[0].url, userAccessToken, 'root')const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name: 'super video' })const uuid = resVideo.body.video.uuid@@ -397,7 +397,7 @@ describe('Test users notifications', function () {await wait(500)await checkNewCommentOnMyVideo(baseParams, uuid, commentId, commentId, 'absence')- await removeAccountFromAccountBlocklist(servers[ 0 ].url, userAccessToken, 'root')+ await removeAccountFromAccountBlocklist(servers[0].url, userAccessToken, 'root')})it('Should send a new comment notification after a local comment on my video', async function () {@@ -456,9 +456,9 @@ describe('Test users notifications', function () {await waitJobs(servers){- const resThread = await addVideoCommentThread(servers[ 1 ].url, servers[ 1 ].accessToken, uuid, 'comment')+ const resThread = await addVideoCommentThread(servers[1].url, servers[1].accessToken, uuid, 'comment')const threadId = resThread.body.comment.id- await addVideoCommentReply(servers[ 1 ].url, servers[ 1 ].accessToken, uuid, threadId, 'reply')+ await addVideoCommentReply(servers[1].url, servers[1].accessToken, uuid, threadId, 'reply')}await waitJobs(servers)@@ -530,7 +530,7 @@ describe('Test users notifications', function () {it('Should not send a new mention notification if the account is muted', async function () {this.timeout(10000)- await addAccountToAccountBlocklist(servers[ 0 ].url, userAccessToken, 'root')+ await addAccountToAccountBlocklist(servers[0].url, userAccessToken, 'root')const resVideo = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'super video' })const uuid = resVideo.body.video.uuid@@ -541,7 +541,7 @@ describe('Test users notifications', function () {await wait(500)await checkCommentMention(baseParams, uuid, commentId, commentId, 'super root name', 'absence')- await removeAccountFromAccountBlocklist(servers[ 0 ].url, userAccessToken, 'root')+ await removeAccountFromAccountBlocklist(servers[0].url, userAccessToken, 'root')})it('Should not send a new mention notification if the remote account mention a local account', async function () {@@ -585,7 +585,7 @@ describe('Test users notifications', function () {await waitJobs(servers)- const text1 = `hello @user_1@localhost:${servers[ 0 ].port} 1`+ const text1 = `hello @user_1@localhost:${servers[0].port} 1`const resThread = await addVideoCommentThread(servers[1].url, servers[1].accessToken, uuid, text1)const server2ThreadId = resThread.body.comment.id@@ -596,7 +596,7 @@ describe('Test users notifications', function () {const server1ThreadId = resThread2.body.data[0].idawait checkCommentMention(baseParams, uuid, server1ThreadId, server1ThreadId, 'super root 2 name', 'presence')- const text2 = `@user_1@localhost:${servers[ 0 ].port} hello 2 @root@localhost:${servers[ 0 ].port}`+ const text2 = `@user_1@localhost:${servers[0].port} hello 2 @root@localhost:${servers[0].port}`await addVideoCommentReply(servers[1].url, servers[1].accessToken, uuid, server2ThreadId, text2)await waitJobs(servers)@@ -611,7 +611,7 @@ describe('Test users notifications', function () {})})- describe('Video abuse for moderators notification' , function () {+ describe('Video abuse for moderators notification', function () {let baseParams: CheckerBaseParamsbefore(() => {@@ -722,7 +722,7 @@ describe('Test users notifications', function () {await uploadVideoByRemoteAccount(servers, { waitTranscoding: false })await waitJobs(servers)- const notification = await getLastNotification(servers[ 0 ].url, userAccessToken)+ const notification = await getLastNotification(servers[0].url, userAccessToken)if (notification) {expect(notification.type).to.not.equal(UserNotificationType.MY_VIDEO_PUBLISHED)}@@ -769,7 +769,7 @@ describe('Test users notifications', function () {this.timeout(70000)// In 2 seconds- let updateAt = new Date(new Date().getTime() + 2000)+ const updateAt = new Date(new Date().getTime() + 2000)const data = {privacy: VideoPrivacy.PRIVATE,@@ -787,7 +787,7 @@ describe('Test users notifications', function () {it('Should not send a notification before the video is published', async function () {this.timeout(20000)- let updateAt = new Date(new Date().getTime() + 1000000)+ const updateAt = new Date(new Date().getTime() + 1000000)const data = {privacy: VideoPrivacy.PRIVATE,@@ -970,8 +970,8 @@ describe('Test users notifications', function () {describe('New actor follow', function () {let baseParams: CheckerBaseParams- let myChannelName = 'super channel name'- let myUserName = 'super user name'+ const myChannelName = 'super channel name'+ const myUserName = 'super user name'before(async () => {baseParams = {@@ -1143,7 +1143,7 @@ describe('Test users notifications', function () {it('Should send unblacklist but not published/subscription notes after unblacklisted if scheduled update pending', async function () {this.timeout(20000)- let updateAt = new Date(new Date().getTime() + 1000000)+ const updateAt = new Date(new Date().getTime() + 1000000)const name = 'video with auto-blacklist and future schedule ' + uuidv4()@@ -1176,7 +1176,7 @@ describe('Test users notifications', function () {this.timeout(20000)// In 2 seconds- let updateAt = new Date(new Date().getTime() + 2000)+ const updateAt = new Date(new Date().getTime() + 2000)const name = 'video with schedule done and still auto-blacklisted ' + uuidv4()@@ -1221,26 +1221,26 @@ describe('Test users notifications', function () {describe('Mark as read', function () {it('Should mark as read some notifications', async function () {- const res = await getUserNotifications(servers[ 0 ].url, userAccessToken, 2, 3)+ const res = await getUserNotifications(servers[0].url, userAccessToken, 2, 3)const ids = res.body.data.map(n => n.id)- await markAsReadNotifications(servers[ 0 ].url, userAccessToken, ids)+ await markAsReadNotifications(servers[0].url, userAccessToken, ids)})it('Should have the notifications marked as read', async function () {- const res = await getUserNotifications(servers[ 0 ].url, userAccessToken, 0, 10)+ const res = await getUserNotifications(servers[0].url, userAccessToken, 0, 10)const notifications = res.body.data as UserNotification[]- expect(notifications[ 0 ].read).to.be.false- expect(notifications[ 1 ].read).to.be.false- expect(notifications[ 2 ].read).to.be.true- expect(notifications[ 3 ].read).to.be.true- expect(notifications[ 4 ].read).to.be.true- expect(notifications[ 5 ].read).to.be.false+ expect(notifications[0].read).to.be.false+ expect(notifications[1].read).to.be.false+ expect(notifications[2].read).to.be.true+ expect(notifications[3].read).to.be.true+ expect(notifications[4].read).to.be.true+ expect(notifications[5].read).to.be.false})it('Should only list read notifications', async function () {- const res = await getUserNotifications(servers[ 0 ].url, userAccessToken, 0, 10, false)+ const res = await getUserNotifications(servers[0].url, userAccessToken, 0, 10, false)const notifications = res.body.data as UserNotification[]for (const notification of notifications) {@@ -1249,7 +1249,7 @@ describe('Test users notifications', function () {})it('Should only list unread notifications', async function () {- const res = await getUserNotifications(servers[ 0 ].url, userAccessToken, 0, 10, true)+ const res = await getUserNotifications(servers[0].url, userAccessToken, 0, 10, true)const notifications = res.body.data as UserNotification[]for (const notification of notifications) {@@ -1258,9 +1258,9 @@ describe('Test users notifications', function () {})it('Should mark as read all notifications', async function () {- await markAsReadAllNotifications(servers[ 0 ].url, userAccessToken)+ await markAsReadAllNotifications(servers[0].url, userAccessToken)- const res = await getUserNotifications(servers[ 0 ].url, userAccessToken, 0, 10, true)+ const res = await getUserNotifications(servers[0].url, userAccessToken, 0, 10, true)expect(res.body.total).to.equal(0)expect(res.body.data).to.have.lengthOf(0)diff --git a/server/tests/api/redundancy/manage-redundancy.ts b/server/tests/api/redundancy/manage-redundancy.tsindex 6a8937f24d..4253124c8f 100644--- a/server/tests/api/redundancy/manage-redundancy.ts+++ b/server/tests/api/redundancy/manage-redundancy.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'@@ -56,20 +56,20 @@ describe('Test manage videos redundancy', function () {await setAccessTokensToServers(servers){- const res = await uploadVideo(servers[ 1 ].url, servers[ 1 ].accessToken, { name: 'video 1 server 2' })+ const res = await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'video 1 server 2' })video1Server2UUID = res.body.video.uuid}{- const res = await uploadVideo(servers[ 1 ].url, servers[ 1 ].accessToken, { name: 'video 2 server 2' })+ const res = await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'video 2 server 2' })video2Server2UUID = res.body.video.uuid}await waitJobs(servers)// Server 1 and server 2 follow each other- await doubleFollow(servers[ 0 ], servers[ 1 ])- await updateRedundancy(servers[ 0 ].url, servers[ 0 ].accessToken, servers[ 1 ].host, true)+ await doubleFollow(servers[0], servers[1])+ await updateRedundancy(servers[0].url, servers[0].accessToken, servers[1].host, true)await waitJobs(servers)})@@ -195,8 +195,8 @@ describe('Test manage videos redundancy', function () {})const videos = res.body.data- expect(videos[ 0 ].name).to.equal('video 1 server 2')- expect(videos[ 1 ].name).to.equal('video 2 server 2')+ expect(videos[0].name).to.equal('video 1 server 2')+ expect(videos[1].name).to.equal('video 2 server 2')}{@@ -210,8 +210,8 @@ describe('Test manage videos redundancy', function () {})const videos = res.body.data- expect(videos[ 0 ].name).to.equal('video 2 server 2')- expect(videos[ 1 ].name).to.equal('video 1 server 2')+ expect(videos[0].name).to.equal('video 2 server 2')+ expect(videos[1].name).to.equal('video 1 server 2')}{@@ -225,14 +225,14 @@ describe('Test manage videos redundancy', function () {})const videos = res.body.data- expect(videos[ 0 ].name).to.equal('video 1 server 2')+ expect(videos[0].name).to.equal('video 1 server 2')}})it('Should manually add a redundancy and list it', async function () {this.timeout(120000)- const uuid = (await uploadVideoAndGetId({ server: servers[ 1 ], videoName: 'video 3 server 2', privacy: VideoPrivacy.UNLISTED })).uuid+ const uuid = (await uploadVideoAndGetId({ server: servers[1], videoName: 'video 3 server 2', privacy: VideoPrivacy.UNLISTED })).uuidawait waitJobs(servers)const videoId = await getLocalIdByUUID(servers[0].url, uuid)@@ -257,9 +257,9 @@ describe('Test manage videos redundancy', function () {})const videos = res.body.data- expect(videos[ 0 ].name).to.equal('video 3 server 2')+ expect(videos[0].name).to.equal('video 3 server 2')- const video = videos[ 0 ]+ const video = videos[0]expect(video.redundancies.files).to.have.lengthOf(4)expect(video.redundancies.streamingPlaylists).to.have.lengthOf(1)@@ -286,9 +286,9 @@ describe('Test manage videos redundancy', function () {})const videos = res.body.data- expect(videos[ 0 ].name).to.equal('video 3 server 2')+ expect(videos[0].name).to.equal('video 3 server 2')- const video = videos[ 0 ]+ const video = videos[0]expect(video.redundancies.files).to.have.lengthOf(4)expect(video.redundancies.streamingPlaylists).to.have.lengthOf(1)@@ -308,8 +308,8 @@ describe('Test manage videos redundancy', function () {for (const redundancyId of redundanciesToRemove) {await removeVideoRedundancy({- url: servers[ 0 ].url,- accessToken: servers[ 0 ].accessToken,+ url: servers[0].url,+ accessToken: servers[0].accessToken,redundancyId})}@@ -327,10 +327,10 @@ describe('Test manage videos redundancy', function () {const videos = res.body.dataexpect(videos).to.have.lengthOf(2)- expect(videos[ 0 ].name).to.equal('video 2 server 2')+ expect(videos[0].name).to.equal('video 2 server 2')redundanciesToRemove = []- const video = videos[ 0 ]+ const video = videos[0]expect(video.redundancies.files).to.have.lengthOf(4)expect(video.redundancies.streamingPlaylists).to.have.lengthOf(1)@@ -346,8 +346,8 @@ describe('Test manage videos redundancy', function () {{for (const redundancyId of redundanciesToRemove) {await removeVideoRedundancy({- url: servers[ 0 ].url,- accessToken: servers[ 0 ].accessToken,+ url: servers[0].url,+ accessToken: servers[0].accessToken,redundancyId})}@@ -362,7 +362,7 @@ describe('Test manage videos redundancy', function () {})const videos = res.body.data- expect(videos[ 0 ].name).to.equal('video 1 server 2')+ expect(videos[0].name).to.equal('video 1 server 2')expect(videos).to.have.lengthOf(1)}})diff --git a/server/tests/api/redundancy/redundancy.ts b/server/tests/api/redundancy/redundancy.tsindex f5bf130d59..c5037a5417 100644--- a/server/tests/api/redundancy/redundancy.ts+++ b/server/tests/api/redundancy/redundancy.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'@@ -92,21 +92,21 @@ async function flushAndRunServers (strategy: VideoRedundancyStrategy | null, addawait setAccessTokensToServers(servers){- const res = await uploadVideo(servers[ 1 ].url, servers[ 1 ].accessToken, { name: 'video 1 server 2' })+ const res = await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'video 1 server 2' })video1Server2UUID = res.body.video.uuidvideo1Server2Id = res.body.video.id- await viewVideo(servers[ 1 ].url, video1Server2UUID)+ await viewVideo(servers[1].url, video1Server2UUID)}await waitJobs(servers)// Server 1 and server 2 follow each other- await doubleFollow(servers[ 0 ], servers[ 1 ])+ await doubleFollow(servers[0], servers[1])// Server 1 and server 3 follow each other- await doubleFollow(servers[ 0 ], servers[ 2 ])+ await doubleFollow(servers[0], servers[2])// Server 2 and server 3 follow each other- await doubleFollow(servers[ 1 ], servers[ 2 ])+ await doubleFollow(servers[1], servers[2])await waitJobs(servers)}@@ -115,7 +115,7 @@ async function check1WebSeed (videoUUID?: string) {if (!videoUUID) videoUUID = video1Server2UUIDconst webseeds = [- `http://localhost:${servers[ 1 ].port}/static/webseed/${videoUUID}`+ `http://localhost:${servers[1].port}/static/webseed/${videoUUID}`]for (const server of servers) {@@ -133,8 +133,8 @@ async function check2Webseeds (videoUUID?: string) {if (!videoUUID) videoUUID = video1Server2UUIDconst webseeds = [- `http://localhost:${servers[ 0 ].port}/static/redundancy/${videoUUID}`,- `http://localhost:${servers[ 1 ].port}/static/webseed/${videoUUID}`+ `http://localhost:${servers[0].port}/static/redundancy/${videoUUID}`,+ `http://localhost:${servers[1].port}/static/webseed/${videoUUID}`]for (const server of servers) {@@ -269,12 +269,12 @@ async function checkStatsWith1Webseed (strategy: VideoRedundancyStrategyWithManu}async function enableRedundancyOnServer1 () {- await updateRedundancy(servers[ 0 ].url, servers[ 0 ].accessToken, servers[ 1 ].host, true)+ await updateRedundancy(servers[0].url, servers[0].accessToken, servers[1].host, true)- const res = await getFollowingListPaginationAndSort({ url: servers[ 0 ].url, start: 0, count: 5, sort: '-createdAt' })+ const res = await getFollowingListPaginationAndSort({ url: servers[0].url, start: 0, count: 5, sort: '-createdAt' })const follows: ActorFollow[] = res.body.data- const server2 = follows.find(f => f.following.host === `localhost:${servers[ 1 ].port}`)- const server3 = follows.find(f => f.following.host === `localhost:${servers[ 2 ].port}`)+ const server2 = follows.find(f => f.following.host === `localhost:${servers[1].port}`)+ const server3 = follows.find(f => f.following.host === `localhost:${servers[2].port}`)expect(server3).to.not.be.undefinedexpect(server3.following.hostRedundancyAllowed).to.be.false@@ -284,12 +284,12 @@ async function enableRedundancyOnServer1 () {}async function disableRedundancyOnServer1 () {- await updateRedundancy(servers[ 0 ].url, servers[ 0 ].accessToken, servers[ 1 ].host, false)+ await updateRedundancy(servers[0].url, servers[0].accessToken, servers[1].host, false)- const res = await getFollowingListPaginationAndSort({ url: servers[ 0 ].url, start: 0, count: 5, sort: '-createdAt' })+ const res = await getFollowingListPaginationAndSort({ url: servers[0].url, start: 0, count: 5, sort: '-createdAt' })const follows: ActorFollow[] = res.body.data- const server2 = follows.find(f => f.following.host === `localhost:${servers[ 1 ].port}`)- const server3 = follows.find(f => f.following.host === `localhost:${servers[ 2 ].port}`)+ const server2 = follows.find(f => f.following.host === `localhost:${servers[1].port}`)+ const server3 = follows.find(f => f.following.host === `localhost:${servers[2].port}`)expect(server3).to.not.be.undefinedexpect(server3.following.hostRedundancyAllowed).to.be.false@@ -434,8 +434,8 @@ describe('Test videos redundancy', function () {it('Should view 2 times the first video to have > min_views config', async function () {this.timeout(80000)- await viewVideo(servers[ 0 ].url, video1Server2UUID)- await viewVideo(servers[ 2 ].url, video1Server2UUID)+ await viewVideo(servers[0].url, video1Server2UUID)+ await viewVideo(servers[2].url, video1Server2UUID)await wait(10000)await waitJobs(servers)@@ -620,7 +620,7 @@ describe('Test videos redundancy', function () {await check1PlaylistRedundancies()await checkStatsWith2Webseed(strategy)- const res = await uploadVideo(servers[ 1 ].url, servers[ 1 ].accessToken, { name: 'video 2 server 2' })+ const res = await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'video 2 server 2' })video2Server2UUID = res.body.video.uuid})@@ -652,8 +652,8 @@ describe('Test videos redundancy', function () {await waitJobs(servers)- killallServers([ servers[ 0 ] ])- await reRunServer(servers[ 0 ], {+ killallServers([ servers[0] ])+ await reRunServer(servers[0], {redundancy: {videos: {check_interval: '1 second',diff --git a/server/tests/api/search/search-activitypub-video-channels.ts b/server/tests/api/search/search-activitypub-video-channels.tsindex d5f0a54572..d7e3ed5be4 100644--- a/server/tests/api/search/search-activitypub-video-channels.ts+++ b/server/tests/api/search/search-activitypub-video-channels.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'@@ -39,7 +39,7 @@ describe('Test ActivityPub video channels search', function () {await setAccessTokensToServers(servers){- await createUser({ url: servers[ 0 ].url, accessToken: servers[ 0 ].accessToken, username: 'user1_server1', password: 'password' })+ await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: 'user1_server1', password: 'password' })const channel = {name: 'channel1_server1',displayName: 'Channel 1 server 1'@@ -49,7 +49,7 @@ describe('Test ActivityPub video channels search', function () {{const user = { username: 'user1_server2', password: 'password' }- await createUser({ url: servers[ 1 ].url, accessToken: servers[ 1 ].accessToken, username: user.username, password: user.password })+ await createUser({ url: servers[1].url, accessToken: servers[1].accessToken, username: user.username, password: user.password })userServer2Token = await userLogin(servers[1], user)const channel = {@@ -70,8 +70,8 @@ describe('Test ActivityPub video channels search', function () {this.timeout(15000){- const search = 'http://localhost:' + servers[ 1 ].port + '/video-channels/channel1_server3'- const res = await searchVideoChannel(servers[ 0 ].url, search, servers[ 0 ].accessToken)+ const search = 'http://localhost:' + servers[1].port + '/video-channels/channel1_server3'+ const res = await searchVideoChannel(servers[0].url, search, servers[0].accessToken)expect(res.body.total).to.equal(0)expect(res.body.data).to.be.an('array')@@ -80,7 +80,7 @@ describe('Test ActivityPub video channels search', function () {{// Without token- const search = 'http://localhost:' + servers[ 1 ].port + '/video-channels/channel1_server2'+ const search = 'http://localhost:' + servers[1].port + '/video-channels/channel1_server2'const res = await searchVideoChannel(servers[0].url, search)expect(res.body.total).to.equal(0)@@ -91,35 +91,35 @@ describe('Test ActivityPub video channels search', function () {it('Should search a local video channel', async function () {const searches = [- 'http://localhost:' + servers[ 0 ].port + '/video-channels/channel1_server1',- 'channel1_server1@localhost:' + servers[ 0 ].port+ 'http://localhost:' + servers[0].port + '/video-channels/channel1_server1',+ 'channel1_server1@localhost:' + servers[0].port]for (const search of searches) {- const res = await searchVideoChannel(servers[ 0 ].url, search)+ const res = await searchVideoChannel(servers[0].url, search)expect(res.body.total).to.equal(1)expect(res.body.data).to.be.an('array')expect(res.body.data).to.have.lengthOf(1)- expect(res.body.data[ 0 ].name).to.equal('channel1_server1')- expect(res.body.data[ 0 ].displayName).to.equal('Channel 1 server 1')+ expect(res.body.data[0].name).to.equal('channel1_server1')+ expect(res.body.data[0].displayName).to.equal('Channel 1 server 1')}})it('Should search a remote video channel with URL or handle', async function () {const searches = [- 'http://localhost:' + servers[ 1 ].port + '/video-channels/channel1_server2',- 'channel1_server2@localhost:' + servers[ 1 ].port+ 'http://localhost:' + servers[1].port + '/video-channels/channel1_server2',+ 'channel1_server2@localhost:' + servers[1].port]for (const search of searches) {- const res = await searchVideoChannel(servers[ 0 ].url, search, servers[ 0 ].accessToken)+ const res = await searchVideoChannel(servers[0].url, search, servers[0].accessToken)expect(res.body.total).to.equal(1)expect(res.body.data).to.be.an('array')expect(res.body.data).to.have.lengthOf(1)- expect(res.body.data[ 0 ].name).to.equal('channel1_server2')- expect(res.body.data[ 0 ].displayName).to.equal('Channel 1 server 2')+ expect(res.body.data[0].name).to.equal('channel1_server2')+ expect(res.body.data[0].displayName).to.equal('Channel 1 server 2')}})@@ -137,13 +137,13 @@ describe('Test ActivityPub video channels search', function () {await waitJobs(servers)- const res = await getVideoChannelVideos(servers[0].url, null, 'channel1_server2@localhost:' + servers[ 1 ].port, 0, 5)+ const res = await getVideoChannelVideos(servers[0].url, null, 'channel1_server2@localhost:' + servers[1].port, 0, 5)expect(res.body.total).to.equal(0)expect(res.body.data).to.have.lengthOf(0)})it('Should list video channel videos of server 2 with token', async function () {- const res = await getVideoChannelVideos(servers[0].url, servers[0].accessToken, 'channel1_server2@localhost:' + servers[ 1 ].port, 0, 5)+ const res = await getVideoChannelVideos(servers[0].url, servers[0].accessToken, 'channel1_server2@localhost:' + servers[1].port, 0, 5)expect(res.body.total).to.equal(1)expect(res.body.data[0].name).to.equal('video 1 server 2')@@ -159,7 +159,7 @@ describe('Test ActivityPub video channels search', function () {// Expire video channelawait wait(10000)- const search = 'http://localhost:' + servers[ 1 ].port + '/video-channels/channel1_server2'+ const search = 'http://localhost:' + servers[1].port + '/video-channels/channel1_server2'const res = await searchVideoChannel(servers[0].url, search, servers[0].accessToken)expect(res.body.total).to.equal(1)expect(res.body.data).to.have.lengthOf(1)@@ -182,12 +182,12 @@ describe('Test ActivityPub video channels search', function () {// Expire video channelawait wait(10000)- const search = 'http://localhost:' + servers[ 1 ].port + '/video-channels/channel1_server2'+ const search = 'http://localhost:' + servers[1].port + '/video-channels/channel1_server2'await searchVideoChannel(servers[0].url, search, servers[0].accessToken)await waitJobs(servers)- const videoChannelName = 'channel1_server2@localhost:' + servers[ 1 ].port+ const videoChannelName = 'channel1_server2@localhost:' + servers[1].portconst res = await getVideoChannelVideos(servers[0].url, servers[0].accessToken, videoChannelName, 0, 5, '-createdAt')expect(res.body.total).to.equal(2)@@ -204,7 +204,7 @@ describe('Test ActivityPub video channels search', function () {// Expire videoawait wait(10000)- const search = 'http://localhost:' + servers[ 1 ].port + '/video-channels/channel1_server2'+ const search = 'http://localhost:' + servers[1].port + '/video-channels/channel1_server2'const res = await searchVideoChannel(servers[0].url, search, servers[0].accessToken)expect(res.body.total).to.equal(0)expect(res.body.data).to.have.lengthOf(0)diff --git a/server/tests/api/search/search-activitypub-videos.ts b/server/tests/api/search/search-activitypub-videos.tsindex dbfefadda6..c62dfca0d7 100644--- a/server/tests/api/search/search-activitypub-videos.ts+++ b/server/tests/api/search/search-activitypub-videos.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'@@ -34,12 +34,12 @@ describe('Test ActivityPub videos search', function () {await setAccessTokensToServers(servers){- const res = await uploadVideo(servers[ 0 ].url, servers[ 0 ].accessToken, { name: 'video 1 on server 1' })+ const res = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video 1 on server 1' })videoServer1UUID = res.body.video.uuid}{- const res = await uploadVideo(servers[ 1 ].url, servers[ 1 ].accessToken, { name: 'video 1 on server 2' })+ const res = await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'video 1 on server 2' })videoServer2UUID = res.body.video.uuid}@@ -49,7 +49,7 @@ describe('Test ActivityPub videos search', function () {it('Should not find a remote video', async function () {{const search = 'http://localhost:' + servers[1].port + '/videos/watch/43'- const res = await searchVideoWithToken(servers[ 0 ].url, search, servers[ 0 ].accessToken)+ const res = await searchVideoWithToken(servers[0].url, search, servers[0].accessToken)expect(res.body.total).to.equal(0)expect(res.body.data).to.be.an('array')diff --git a/server/tests/api/search/search-videos.ts b/server/tests/api/search/search-videos.tsindex 7882d93733..4801fe04a5 100644--- a/server/tests/api/search/search-videos.ts+++ b/server/tests/api/search/search-videos.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'@@ -78,7 +78,7 @@ describe('Test videos search', function () {const attributes5 = immutableAssign(attributes1, { name: attributes1.name + ' - 5', licence: 2, language: undefined })await uploadVideo(server.url, server.accessToken, attributes5)- const attributes6 = immutableAssign(attributes1, { name: attributes1.name + ' - 6', tags: [ 't1', 't2 '] })+ const attributes6 = immutableAssign(attributes1, { name: attributes1.name + ' - 6', tags: [ 't1', 't2' ] })await uploadVideo(server.url, server.accessToken, attributes6)const attributes7 = immutableAssign(attributes1, {@@ -269,16 +269,16 @@ describe('Test videos search', function () {{const res = await advancedVideosSearch(server.url, query)expect(res.body.total).to.equal(2)- expect(res.body.data[ 0 ].name).to.equal('1111 2222 3333 - 3')- expect(res.body.data[ 1 ].name).to.equal('1111 2222 3333 - 4')+ expect(res.body.data[0].name).to.equal('1111 2222 3333 - 3')+ expect(res.body.data[1].name).to.equal('1111 2222 3333 - 4')}{const res = await advancedVideosSearch(server.url, immutableAssign(query, { languageOneOf: [ 'pl', 'en', '_unknown' ] }))expect(res.body.total).to.equal(3)- expect(res.body.data[ 0 ].name).to.equal('1111 2222 3333 - 3')- expect(res.body.data[ 1 ].name).to.equal('1111 2222 3333 - 4')- expect(res.body.data[ 2 ].name).to.equal('1111 2222 3333 - 5')+ expect(res.body.data[0].name).to.equal('1111 2222 3333 - 3')+ expect(res.body.data[1].name).to.equal('1111 2222 3333 - 4')+ expect(res.body.data[2].name).to.equal('1111 2222 3333 - 5')}{diff --git a/server/tests/api/server/auto-follows.ts b/server/tests/api/server/auto-follows.tsindex a06f578fc4..5f48dc0ebf 100644--- a/server/tests/api/server/auto-follows.ts+++ b/server/tests/api/server/auto-follows.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'@@ -59,9 +59,10 @@ async function server1Follows2 (servers: ServerInfo[]) {async function resetFollows (servers: ServerInfo[]) {try {- await unfollow(servers[ 0 ].url, servers[ 0 ].accessToken, servers[ 1 ])- await unfollow(servers[ 1 ].url, servers[ 1 ].accessToken, servers[ 0 ])- } catch { /* empty */ }+ await unfollow(servers[0].url, servers[0].accessToken, servers[1])+ await unfollow(servers[1].url, servers[1].accessToken, servers[0])+ } catch { /* empty */+ }await waitJobs(servers)@@ -163,8 +164,8 @@ describe('Test auto follows', function () {await wait(5000)await waitJobs(servers)- await checkFollow(servers[ 0 ], servers[ 1 ], false)- await checkFollow(servers[ 1 ], servers[ 0 ], false)+ await checkFollow(servers[0], servers[1], false)+ await checkFollow(servers[1], servers[0], false)})it('Should auto follow the index', async function () {@@ -187,7 +188,7 @@ describe('Test auto follows', function () {await wait(5000)await waitJobs(servers)- await checkFollow(servers[ 0 ], servers[ 1 ], true)+ await checkFollow(servers[0], servers[1], true)await resetFollows(servers)})@@ -200,8 +201,8 @@ describe('Test auto follows', function () {await wait(5000)await waitJobs(servers)- await checkFollow(servers[ 0 ], servers[ 1 ], false)- await checkFollow(servers[ 0 ], servers[ 2 ], true)+ await checkFollow(servers[0], servers[1], false)+ await checkFollow(servers[0], servers[2], true)})})diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.tsindex cf99e5c0a6..6425254554 100644--- a/server/tests/api/server/config.ts+++ b/server/tests/api/server/config.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'import * as chai from 'chai'@@ -11,11 +11,14 @@ import {getAbout,getConfig,getCustomConfig,- killallServers, parallelTests,+ killallServers,+ parallelTests,registerUser,- reRunServer, ServerInfo,+ reRunServer,+ ServerInfo,setAccessTokensToServers,- updateCustomConfig, uploadVideo+ updateCustomConfig,+ uploadVideo} from '../../../../shared/extra-utils'import { ServerConfig } from '../../../../shared/models'diff --git a/server/tests/api/server/contact-form.ts b/server/tests/api/server/contact-form.tsindex e4e895acb3..bd1b0e38aa 100644--- a/server/tests/api/server/contact-form.ts+++ b/server/tests/api/server/contact-form.ts@@ -1,16 +1,8 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'-import {- flushTests,- killallServers,- flushAndRunServer,- ServerInfo,- setAccessTokensToServers,- wait,- cleanupTests-} from '../../../../shared/extra-utils'+import { cleanupTests, flushAndRunServer, ServerInfo, setAccessTokensToServers, wait } from '../../../../shared/extra-utils'import { MockSmtpServer } from '../../../../shared/extra-utils/miscs/email'import { waitJobs } from '../../../../shared/extra-utils/server/jobs'import { sendContactForm } from '../../../../shared/extra-utils/server/contact-form'diff --git a/server/tests/api/server/email.ts b/server/tests/api/server/email.tsindex c55a221f25..f18859e5d1 100644--- a/server/tests/api/server/email.ts+++ b/server/tests/api/server/email.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'diff --git a/server/tests/api/server/follow-constraints.ts b/server/tests/api/server/follow-constraints.tsindex 46663bf7cb..a734402865 100644--- a/server/tests/api/server/follow-constraints.ts+++ b/server/tests/api/server/follow-constraints.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'@@ -35,11 +35,11 @@ describe('Test follow constraints', function () {await setAccessTokensToServers(servers){- const res = await uploadVideo(servers[ 0 ].url, servers[ 0 ].accessToken, { name: 'video server 1' })+ const res = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video server 1' })video1UUID = res.body.video.uuid}{- const res = await uploadVideo(servers[ 1 ].url, servers[ 1 ].accessToken, { name: 'video server 2' })+ const res = await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'video server 2' })video2UUID = res.body.video.uuid}@@ -47,7 +47,7 @@ describe('Test follow constraints', function () {username: 'user1',password: 'super_password'}- await createUser({ url: servers[ 0 ].url, accessToken: servers[ 0 ].accessToken, username: user.username, password: user.password })+ await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: user.username, password: user.password })userAccessToken = await userLogin(servers[0], user)await doubleFollow(servers[0], servers[1])diff --git a/server/tests/api/server/follows-moderation.ts b/server/tests/api/server/follows-moderation.tsindex 1984c9eb14..cee85cc4b2 100644--- a/server/tests/api/server/follows-moderation.ts+++ b/server/tests/api/server/follows-moderation.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'@@ -24,7 +24,7 @@ const expect = chai.expectasync function checkServer1And2HasFollowers (servers: ServerInfo[], state = 'accepted') {{- const res = await getFollowingListPaginationAndSort({ url: servers[ 0 ].url, start: 0, count: 5, sort: 'createdAt' })+ const res = await getFollowingListPaginationAndSort({ url: servers[0].url, start: 0, count: 5, sort: 'createdAt' })expect(res.body.total).to.equal(1)const follow = res.body.data[0] as ActorFollow@@ -34,7 +34,7 @@ async function checkServer1And2HasFollowers (servers: ServerInfo[], state = 'acc}{- const res = await getFollowersListPaginationAndSort({ url: servers[ 1 ].url, start: 0, count: 5, sort: 'createdAt' })+ const res = await getFollowersListPaginationAndSort({ url: servers[1].url, start: 0, count: 5, sort: 'createdAt' })expect(res.body.total).to.equal(1)const follow = res.body.data[0] as ActorFollow@@ -46,12 +46,12 @@ async function checkServer1And2HasFollowers (servers: ServerInfo[], state = 'accasync function checkNoFollowers (servers: ServerInfo[]) {{- const res = await getFollowingListPaginationAndSort({ url: servers[ 0 ].url, start: 0, count: 5, sort: 'createdAt' })+ const res = await getFollowingListPaginationAndSort({ url: servers[0].url, start: 0, count: 5, sort: 'createdAt' })expect(res.body.total).to.equal(0)}{- const res = await getFollowersListPaginationAndSort({ url: servers[ 1 ].url, start: 0, count: 5, sort: 'createdAt' })+ const res = await getFollowersListPaginationAndSort({ url: servers[1].url, start: 0, count: 5, sort: 'createdAt' })expect(res.body.total).to.equal(0)}}@@ -164,17 +164,17 @@ describe('Test follows moderation', function () {await waitJobs(servers){- const res = await getFollowingListPaginationAndSort({ url: servers[ 0 ].url, start: 0, count: 5, sort: 'createdAt' })+ const res = await getFollowingListPaginationAndSort({ url: servers[0].url, start: 0, count: 5, sort: 'createdAt' })expect(res.body.total).to.equal(2)}{- const res = await getFollowersListPaginationAndSort({ url: servers[ 1 ].url, start: 0, count: 5, sort: 'createdAt' })+ const res = await getFollowersListPaginationAndSort({ url: servers[1].url, start: 0, count: 5, sort: 'createdAt' })expect(res.body.total).to.equal(1)}{- const res = await getFollowersListPaginationAndSort({ url: servers[ 2 ].url, start: 0, count: 5, sort: 'createdAt' })+ const res = await getFollowersListPaginationAndSort({ url: servers[2].url, start: 0, count: 5, sort: 'createdAt' })expect(res.body.total).to.equal(1)}@@ -184,7 +184,7 @@ describe('Test follows moderation', function () {await checkServer1And2HasFollowers(servers){- const res = await getFollowersListPaginationAndSort({ url: servers[ 2 ].url, start: 0, count: 5, sort: 'createdAt' })+ const res = await getFollowersListPaginationAndSort({ url: servers[2].url, start: 0, count: 5, sort: 'createdAt' })expect(res.body.total).to.equal(0)}})diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.tsindex 4ffa9e7910..b686af4e4e 100644--- a/server/tests/api/server/follows.ts+++ b/server/tests/api/server/follows.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'@@ -78,14 +78,14 @@ describe('Test follows', function () {})it('Should have 2 followings on server 1', async function () {- let res = await getFollowingListPaginationAndSort({ url: servers[ 0 ].url, start: 0, count: 1, sort: 'createdAt' })+ let res = await getFollowingListPaginationAndSort({ url: servers[0].url, start: 0, count: 1, sort: 'createdAt' })let follows = res.body.dataexpect(res.body.total).to.equal(2)expect(follows).to.be.an('array')expect(follows.length).to.equal(1)- res = await getFollowingListPaginationAndSort({ url: servers[ 0 ].url, start: 1, count: 1, sort: 'createdAt' })+ res = await getFollowingListPaginationAndSort({ url: servers[0].url, start: 1, count: 1, sort: 'createdAt' })follows = follows.concat(res.body.data)const server2Follow = follows.find(f => f.following.host === 'localhost:' + servers[1].port)@@ -101,7 +101,7 @@ describe('Test follows', function () {const sort = 'createdAt'const start = 0const count = 1- const url = servers[ 0 ].url+ const url = servers[0].url{const search = ':' + servers[1].port@@ -112,7 +112,7 @@ describe('Test follows', function () {expect(res.body.total).to.equal(1)expect(follows.length).to.equal(1)- expect(follows[ 0 ].following.host).to.equal('localhost:' + servers[ 1 ].port)+ expect(follows[0].following.host).to.equal('localhost:' + servers[1].port)}{@@ -170,9 +170,9 @@ describe('Test follows', function () {it('Should have 1 followers on server 2 and 3', async function () {for (const server of [ servers[1], servers[2] ]) {- let res = await getFollowersListPaginationAndSort({ url: server.url, start: 0, count: 1, sort: 'createdAt' })+ const res = await getFollowersListPaginationAndSort({ url: server.url, start: 0, count: 1, sort: 'createdAt' })- let follows = res.body.data+ const follows = res.body.dataexpect(res.body.total).to.equal(1)expect(follows).to.be.an('array')expect(follows.length).to.equal(1)@@ -181,7 +181,7 @@ describe('Test follows', function () {})it('Should search/filter followers on server 2', async function () {- const url = servers[ 2 ].url+ const url = servers[2].urlconst start = 0const count = 5const sort = 'createdAt'@@ -195,7 +195,7 @@ describe('Test follows', function () {expect(res.body.total).to.equal(1)expect(follows.length).to.equal(1)- expect(follows[ 0 ].following.host).to.equal('localhost:' + servers[ 2 ].port)+ expect(follows[0].following.host).to.equal('localhost:' + servers[2].port)}{@@ -241,7 +241,7 @@ describe('Test follows', function () {})it('Should have 0 followers on server 1', async function () {- const res = await getFollowersListPaginationAndSort({ url: servers[ 0 ].url, start: 0, count: 5, sort: 'createdAt' })+ const res = await getFollowersListPaginationAndSort({ url: servers[0].url, start: 0, count: 5, sort: 'createdAt' })const follows = res.body.dataexpect(res.body.total).to.equal(0)@@ -271,8 +271,8 @@ describe('Test follows', function () {})it('Should not follow server 3 on server 1 anymore', async function () {- const res = await getFollowingListPaginationAndSort({ url: servers[ 0 ].url, start: 0, count: 2, sort: 'createdAt' })- let follows = res.body.data+ const res = await getFollowingListPaginationAndSort({ url: servers[0].url, start: 0, count: 2, sort: 'createdAt' })+ const follows = res.body.dataexpect(res.body.total).to.equal(1)expect(follows).to.be.an('array')@@ -282,9 +282,9 @@ describe('Test follows', function () {})it('Should not have server 1 as follower on server 3 anymore', async function () {- const res = await getFollowersListPaginationAndSort({ url: servers[ 2 ].url, start: 0, count: 1, sort: 'createdAt' })+ const res = await getFollowersListPaginationAndSort({ url: servers[2].url, start: 0, count: 1, sort: 'createdAt' })- let follows = res.body.data+ const follows = res.body.dataexpect(res.body.total).to.equal(0)expect(follows).to.be.an('array')expect(follows.length).to.equal(0)@@ -336,59 +336,59 @@ describe('Test follows', function () {tags: [ 'tag1', 'tag2', 'tag3' ]}- await uploadVideo(servers[ 2 ].url, servers[ 2 ].accessToken, { name: 'server3-2' })- await uploadVideo(servers[ 2 ].url, servers[ 2 ].accessToken, { name: 'server3-3' })- await uploadVideo(servers[ 2 ].url, servers[ 2 ].accessToken, video4Attributes)- await uploadVideo(servers[ 2 ].url, servers[ 2 ].accessToken, { name: 'server3-5' })- await uploadVideo(servers[ 2 ].url, servers[ 2 ].accessToken, { name: 'server3-6' })+ await uploadVideo(servers[2].url, servers[2].accessToken, { name: 'server3-2' })+ await uploadVideo(servers[2].url, servers[2].accessToken, { name: 'server3-3' })+ await uploadVideo(servers[2].url, servers[2].accessToken, video4Attributes)+ await uploadVideo(servers[2].url, servers[2].accessToken, { name: 'server3-5' })+ await uploadVideo(servers[2].url, servers[2].accessToken, { name: 'server3-6' }){const user = { username: 'captain', password: 'password' }- await createUser({ url: servers[ 2 ].url, accessToken: servers[ 2 ].accessToken, username: user.username, password: user.password })- const userAccessToken = await userLogin(servers[ 2 ], user)+ await createUser({ url: servers[2].url, accessToken: servers[2].accessToken, username: user.username, password: user.password })+ const userAccessToken = await userLogin(servers[2], user)- const resVideos = await getVideosList(servers[ 2 ].url)+ const resVideos = await getVideosList(servers[2].url)video4 = resVideos.body.data.find(v => v.name === 'server3-4'){- await rateVideo(servers[ 2 ].url, servers[ 2 ].accessToken, video4.id, 'like')- await rateVideo(servers[ 2 ].url, userAccessToken, video4.id, 'dislike')+ await rateVideo(servers[2].url, servers[2].accessToken, video4.id, 'like')+ await rateVideo(servers[2].url, userAccessToken, video4.id, 'dislike')}{{const text = 'my super first comment'- const res = await addVideoCommentThread(servers[ 2 ].url, servers[ 2 ].accessToken, video4.id, text)+ const res = await addVideoCommentThread(servers[2].url, servers[2].accessToken, video4.id, text)const threadId = res.body.comment.idconst text1 = 'my super answer to thread 1'- const childCommentRes = await addVideoCommentReply(servers[ 2 ].url, servers[ 2 ].accessToken, video4.id, threadId, text1)+ const childCommentRes = await addVideoCommentReply(servers[2].url, servers[2].accessToken, video4.id, threadId, text1)const childCommentId = childCommentRes.body.comment.idconst text2 = 'my super answer to answer of thread 1'- await addVideoCommentReply(servers[ 2 ].url, servers[ 2 ].accessToken, video4.id, childCommentId, text2)+ await addVideoCommentReply(servers[2].url, servers[2].accessToken, video4.id, childCommentId, text2)const text3 = 'my second answer to thread 1'- await addVideoCommentReply(servers[ 2 ].url, servers[ 2 ].accessToken, video4.id, threadId, text3)+ await addVideoCommentReply(servers[2].url, servers[2].accessToken, video4.id, threadId, text3)}{const text = 'will be deleted'- const res = await addVideoCommentThread(servers[ 2 ].url, servers[ 2 ].accessToken, video4.id, text)+ const res = await addVideoCommentThread(servers[2].url, servers[2].accessToken, video4.id, text)const threadId = res.body.comment.idconst text1 = 'answer to deleted'- await addVideoCommentReply(servers[ 2 ].url, servers[ 2 ].accessToken, video4.id, threadId, text1)+ await addVideoCommentReply(servers[2].url, servers[2].accessToken, video4.id, threadId, text1)const text2 = 'will also be deleted'- const childCommentRes = await addVideoCommentReply(servers[ 2 ].url, servers[ 2 ].accessToken, video4.id, threadId, text2)+ const childCommentRes = await addVideoCommentReply(servers[2].url, servers[2].accessToken, video4.id, threadId, text2)const childCommentId = childCommentRes.body.comment.idconst text3 = 'my second answer to deleted'- await addVideoCommentReply(servers[ 2 ].url, servers[ 2 ].accessToken, video4.id, childCommentId, text3)+ await addVideoCommentReply(servers[2].url, servers[2].accessToken, video4.id, childCommentId, text3)- await deleteVideoComment(servers[ 2 ].url, servers[ 2 ].accessToken, video4.id, threadId)- await deleteVideoComment(servers[ 2 ].url, servers[ 2 ].accessToken, video4.id, childCommentId)+ await deleteVideoComment(servers[2].url, servers[2].accessToken, video4.id, threadId)+ await deleteVideoComment(servers[2].url, servers[2].accessToken, video4.id, childCommentId)}}@@ -406,7 +406,7 @@ describe('Test follows', function () {await waitJobs(servers)// Server 1 follows server 3- await follow(servers[ 0 ].url, [ servers[ 2 ].url ], servers[ 0 ].accessToken)+ await follow(servers[0].url, [ servers[2].url ], servers[0].accessToken)await waitJobs(servers)})@@ -424,7 +424,7 @@ describe('Test follows', function () {})it('Should have propagated videos', async function () {- const res = await getVideosList(servers[ 0 ].url)+ const res = await getVideosList(servers[0].url)expect(res.body.total).to.equal(7)const video2 = res.body.data.find(v => v.name === 'server3-2')@@ -470,7 +470,7 @@ describe('Test follows', function () {}]}- await completeVideoCheck(servers[ 0 ].url, video4, checkAttributes)+ await completeVideoCheck(servers[0].url, video4, checkAttributes)})it('Should have propagated comments', async function () {@@ -481,34 +481,34 @@ describe('Test follows', function () {expect(res1.body.data).to.have.lengthOf(2){- const comment: VideoComment = res1.body.data[ 0 ]+ const comment: VideoComment = res1.body.data[0]expect(comment.inReplyToCommentId).to.be.nullexpect(comment.text).equal('my super first comment')expect(comment.videoId).to.equal(video4.id)expect(comment.id).to.equal(comment.threadId)expect(comment.account.name).to.equal('root')- expect(comment.account.host).to.equal('localhost:' + servers[ 2 ].port)+ expect(comment.account.host).to.equal('localhost:' + servers[2].port)expect(comment.totalReplies).to.equal(3)expect(dateIsValid(comment.createdAt as string)).to.be.trueexpect(dateIsValid(comment.updatedAt as string)).to.be.trueconst threadId = comment.threadId- const res2 = await getVideoThreadComments(servers[ 0 ].url, video4.id, threadId)+ const res2 = await getVideoThreadComments(servers[0].url, video4.id, threadId)const tree: VideoCommentThreadTree = res2.bodyexpect(tree.comment.text).equal('my super first comment')expect(tree.children).to.have.lengthOf(2)- const firstChild = tree.children[ 0 ]+ const firstChild = tree.children[0]expect(firstChild.comment.text).to.equal('my super answer to thread 1')expect(firstChild.children).to.have.lengthOf(1)- const childOfFirstChild = firstChild.children[ 0 ]+ const childOfFirstChild = firstChild.children[0]expect(childOfFirstChild.comment.text).to.equal('my super answer to answer of thread 1')expect(childOfFirstChild.children).to.have.lengthOf(0)- const secondChild = tree.children[ 1 ]+ const secondChild = tree.children[1]expect(secondChild.comment.text).to.equal('my second answer to thread 1')expect(secondChild.children).to.have.lengthOf(0)}@@ -569,7 +569,7 @@ describe('Test follows', function () {await waitJobs(servers)- let res = await getVideosList(servers[ 0 ].url)+ const res = await getVideosList(servers[0].url)expect(res.body.total).to.equal(1)})diff --git a/server/tests/api/server/handle-down.ts b/server/tests/api/server/handle-down.tsindex 7e36067f15..2cf6e15adc 100644--- a/server/tests/api/server/handle-down.ts+++ b/server/tests/api/server/handle-down.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'@@ -8,6 +8,7 @@ import { VideoCommentThreadTree } from '../../../../shared/models/videos/video-cimport {cleanupTests,+ closeAllSequelize,completeVideoCheck,flushAndRunMultipleServers,getVideo,@@ -17,11 +18,12 @@ import {reRunServer,ServerInfo,setAccessTokensToServers,+ setActorFollowScores,unfollow,updateVideo,- uploadVideo, uploadVideoAndGetId,- wait,- setActorFollowScores, closeAllSequelize+ uploadVideo,+ uploadVideoAndGetId,+ wait} from '../../../../shared/extra-utils'import { follow, getFollowersListPaginationAndSort } from '../../../../shared/extra-utils/server/follows'import { getJobsListPaginationAndSort, waitJobs } from '../../../../shared/extra-utils/server/jobs'@@ -44,7 +46,7 @@ describe('Test handle downs', function () {let missedVideo2: Videolet unlistedVideo: Video- let videoIdsServer1: number[] = []+ const videoIdsServer1: number[] = []const videoAttributes = {name: 'my super name for server 1',@@ -137,7 +139,7 @@ describe('Test handle downs', function () {// Remove server 2 followerfor (let i = 0; i < 10; i++) {- await uploadVideo(servers[ 0 ].url, servers[ 0 ].accessToken, videoAttributes)+ await uploadVideo(servers[0].url, servers[0].accessToken, videoAttributes)}await waitJobs(servers[0])@@ -145,14 +147,14 @@ describe('Test handle downs', function () {// Kill server 3killallServers([ servers[2] ])- const resLastVideo1 = await uploadVideo(servers[ 0 ].url, servers[ 0 ].accessToken, videoAttributes)+ const resLastVideo1 = await uploadVideo(servers[0].url, servers[0].accessToken, videoAttributes)missedVideo1 = resLastVideo1.body.video- const resLastVideo2 = await uploadVideo(servers[ 0 ].url, servers[ 0 ].accessToken, videoAttributes)+ const resLastVideo2 = await uploadVideo(servers[0].url, servers[0].accessToken, videoAttributes)missedVideo2 = resLastVideo2.body.video// Unlisted video- let resVideo = await uploadVideo(servers[ 0 ].url, servers[ 0 ].accessToken, unlistedVideoAttributes)+ const resVideo = await uploadVideo(servers[0].url, servers[0].accessToken, unlistedVideoAttributes)unlistedVideo = resVideo.body.video// Add comments to video 2@@ -174,7 +176,7 @@ describe('Test handle downs', function () {await wait(11000)// Only server 3 is still a follower of server 1- const res = await getFollowersListPaginationAndSort({ url: servers[ 0 ].url, start: 0, count: 2, sort: 'createdAt' })+ const res = await getFollowersListPaginationAndSort({ url: servers[0].url, start: 0, count: 2, sort: 'createdAt' })expect(res.body.data).to.be.an('array')expect(res.body.data).to.have.lengthOf(1)expect(res.body.data[0].follower.host).to.equal('localhost:' + servers[2].port)@@ -185,8 +187,8 @@ describe('Test handle downs', function () {for (const state of states) {const res = await getJobsListPaginationAndSort({- url: servers[ 0 ].url,- accessToken: servers[ 0 ].accessToken,+ url: servers[0].url,+ accessToken: servers[0].accessToken,state: state,start: 0,count: 50,@@ -209,7 +211,7 @@ describe('Test handle downs', function () {await waitJobs(servers)- const res = await getFollowersListPaginationAndSort({ url: servers[ 0 ].url, start: 0, count: 2, sort: 'createdAt' })+ const res = await getFollowersListPaginationAndSort({ url: servers[0].url, start: 0, count: 2, sort: 'createdAt' })expect(res.body.data).to.be.an('array')expect(res.body.data).to.have.lengthOf(2)})@@ -221,8 +223,8 @@ describe('Test handle downs', function () {expect(res1.body.data).to.be.an('array')expect(res1.body.data).to.have.lengthOf(11)- await updateVideo(servers[0].url, servers[0].accessToken, missedVideo1.uuid, { })- await updateVideo(servers[0].url, servers[0].accessToken, unlistedVideo.uuid, { })+ await updateVideo(servers[0].url, servers[0].accessToken, missedVideo1.uuid, {})+ await updateVideo(servers[0].url, servers[0].accessToken, unlistedVideo.uuid, {})await waitJobs(servers)@@ -313,14 +315,14 @@ describe('Test handle downs', function () {this.timeout(120000)for (let i = 0; i < 10; i++) {- const uuid = (await uploadVideoAndGetId({ server: servers[ 0 ], videoName: 'video ' + i })).uuid+ const uuid = (await uploadVideoAndGetId({ server: servers[0], videoName: 'video ' + i })).uuidvideoIdsServer1.push(uuid)}await waitJobs(servers)for (const id of videoIdsServer1) {- await getVideo(servers[ 1 ].url, id)+ await getVideo(servers[1].url, id)}await waitJobs(servers)diff --git a/server/tests/api/server/jobs.ts b/server/tests/api/server/jobs.tsindex 58d8c8c105..19c8836b59 100644--- a/server/tests/api/server/jobs.ts+++ b/server/tests/api/server/jobs.ts@@ -1,8 +1,8 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'-import { cleanupTests, killallServers, ServerInfo, setAccessTokensToServers } from '../../../../shared/extra-utils/index'+import { cleanupTests, ServerInfo, setAccessTokensToServers } from '../../../../shared/extra-utils/index'import { doubleFollow } from '../../../../shared/extra-utils/server/follows'import { getJobsList, getJobsListPaginationAndSort, waitJobs } from '../../../../shared/extra-utils/server/jobs'import { flushAndRunMultipleServers } from '../../../../shared/extra-utils/server/servers'@@ -44,8 +44,8 @@ describe('Test jobs', function () {it('Should list jobs with sort, pagination and job type', async function () {{const res = await getJobsListPaginationAndSort({- url: servers[ 1 ].url,- accessToken: servers[ 1 ].accessToken,+ url: servers[1].url,+ accessToken: servers[1].accessToken,state: 'completed',start: 1,count: 2,@@ -54,9 +54,9 @@ describe('Test jobs', function () {expect(res.body.total).to.be.above(2)expect(res.body.data).to.have.lengthOf(2)- let job: Job = res.body.data[ 0 ]+ let job: Job = res.body.data[0]// Skip repeat jobs- if (job.type === 'videos-views') job = res.body.data[ 1 ]+ if (job.type === 'videos-views') job = res.body.data[1]expect(job.state).to.equal('completed')expect(job.type.startsWith('activitypub-')).to.be.true@@ -67,8 +67,8 @@ describe('Test jobs', function () {{const res = await getJobsListPaginationAndSort({- url: servers[ 1 ].url,- accessToken: servers[ 1 ].accessToken,+ url: servers[1].url,+ accessToken: servers[1].accessToken,state: 'completed',start: 0,count: 100,diff --git a/server/tests/api/server/logs.ts b/server/tests/api/server/logs.tsindex d3c8774084..b8714c7a10 100644--- a/server/tests/api/server/logs.ts+++ b/server/tests/api/server/logs.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'diff --git a/server/tests/api/server/no-client.ts b/server/tests/api/server/no-client.tsindex 86edeb2891..d0450aba0b 100644--- a/server/tests/api/server/no-client.ts+++ b/server/tests/api/server/no-client.ts@@ -9,7 +9,7 @@ describe('Start and stop server without web client routes', function () {before(async function () {this.timeout(30000)- server = await flushAndRunServer(1, {}, ['--no-client'])+ server = await flushAndRunServer(1, {}, [ '--no-client' ])})it('Should fail getting the client', function () {diff --git a/server/tests/api/server/plugins.ts b/server/tests/api/server/plugins.tsindex b8a8a2fee0..452d050125 100644--- a/server/tests/api/server/plugins.ts+++ b/server/tests/api/server/plugins.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'import * as chai from 'chai'@@ -6,19 +6,28 @@ import {cleanupTests,closeAllSequelize,flushAndRunServer,- getConfig, getMyUserInformation, getPluginPackageJSON,+ getConfig,+ getMyUserInformation,getPlugin,+ getPluginPackageJSON,getPluginRegisteredSettings,getPluginsCSS,- installPlugin, killallServers,+ getPublicSettings,+ installPlugin,+ killallServers,listAvailablePlugins,- listPlugins, reRunServer,+ listPlugins,+ reRunServer,ServerInfo,setAccessTokensToServers,- setPluginVersion, uninstallPlugin,- updateCustomSubConfig, updateMyUser, updatePluginPackageJSON, updatePlugin,+ setPluginVersion,+ uninstallPlugin,+ updateCustomSubConfig,+ updateMyUser,+ updatePlugin,+ updatePluginPackageJSON,updatePluginSettings,- wait, getPublicSettings+ wait} from '../../../../shared/extra-utils'import { PluginType } from '../../../../shared/models/plugins/plugin.type'import { PeerTubePluginIndex } from '../../../../shared/models/plugins/peertube-plugin-index.model'@@ -88,7 +97,7 @@ describe('Test plugins', function () {expect(res2.body.total).to.be.at.least(2)expect(data2).to.have.lengthOf(2)- expect(data1[0].npmName).to.not.equal(data2[ 0 ].npmName)+ expect(data1[0].npmName).to.not.equal(data2[0].npmName)}{diff --git a/server/tests/api/server/reverse-proxy.ts b/server/tests/api/server/reverse-proxy.tsindex b6b33a884f..d0d79c4f61 100644--- a/server/tests/api/server/reverse-proxy.ts+++ b/server/tests/api/server/reverse-proxy.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'import * as chai from 'chai'diff --git a/server/tests/api/server/stats.ts b/server/tests/api/server/stats.tsindex a01cd4b389..c207bb5f00 100644--- a/server/tests/api/server/stats.ts+++ b/server/tests/api/server/stats.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'@@ -9,13 +9,12 @@ import {doubleFollow,flushAndRunMultipleServers,follow,- killallServers,ServerInfo,uploadVideo,viewVideo,wait} from '../../../../shared/extra-utils'-import { flushTests, setAccessTokensToServers } from '../../../../shared/extra-utils/index'+import { setAccessTokensToServers } from '../../../../shared/extra-utils/index'import { getStats } from '../../../../shared/extra-utils/server/stats'import { addVideoCommentThread } from '../../../../shared/extra-utils/videos/video-comments'import { waitJobs } from '../../../../shared/extra-utils/server/jobs'@@ -36,7 +35,7 @@ describe('Test stats (excluding redundancy)', function () {username: 'user1',password: 'super_password'}- await createUser({ url: servers[ 0 ].url, accessToken: servers[ 0 ].accessToken, username: user.username, password: user.password })+ await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: user.username, password: user.password })const resVideo = await uploadVideo(servers[0].url, servers[0].accessToken, { fixture: 'video_short.webm' })const videoUUID = resVideo.body.video.uuiddiff --git a/server/tests/api/server/tracker.ts b/server/tests/api/server/tracker.tsindex 9d7eec8ca5..9d3a274d44 100644--- a/server/tests/api/server/tracker.ts+++ b/server/tests/api/server/tracker.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await,@typescript-eslint/no-floating-promises */import * as magnetUtil from 'magnet-uri'import 'mocha'diff --git a/server/tests/api/users/blocklist.ts b/server/tests/api/users/blocklist.tsindex 05e58017a7..21b9ae4f80 100644--- a/server/tests/api/users/blocklist.ts+++ b/server/tests/api/users/blocklist.ts@@ -1,21 +1,20 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'-import { AccountBlock, ServerBlock, UserNotificationType, Video } from '../../../../shared/index'+import { AccountBlock, ServerBlock, Video } from '../../../../shared/index'import {cleanupTests,- createUser, deleteVideoComment,+ createUser,+ deleteVideoComment,doubleFollow,flushAndRunMultipleServers,- flushTests,- killallServers,ServerInfo,uploadVideo,userLogin} from '../../../../shared/extra-utils/index'import { setAccessTokensToServers } from '../../../../shared/extra-utils/users/login'-import { getVideosListWithToken, getVideosList } from '../../../../shared/extra-utils/videos/videos'+import { getVideosList, getVideosListWithToken } from '../../../../shared/extra-utils/videos/videos'import {addVideoCommentReply,addVideoCommentThread,@@ -79,7 +78,7 @@ async function checkCommentNotification (const resComment = await addVideoCommentThread(comment.server.url, comment.token, comment.videoUUID, comment.text)const threadId = resComment.body.comment.id- await waitJobs([ mainServer, comment.server])+ await waitJobs([ mainServer, comment.server ])const res = await getUserNotifications(mainServer.url, mainServer.accessToken, 0, 30)const commentNotifications = res.body.data@@ -90,7 +89,7 @@ async function checkCommentNotification (await deleteVideoComment(comment.server.url, comment.token, comment.videoUUID, threadId)- await waitJobs([ mainServer, comment.server])+ await waitJobs([ mainServer, comment.server ])}describe('Test blocklist', function () {@@ -109,7 +108,7 @@ describe('Test blocklist', function () {{const user = { username: 'user1', password: 'password' }- await createUser({ url: servers[ 0 ].url, accessToken: servers[ 0 ].accessToken, username: user.username, password: user.password })+ await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: user.username, password: user.password })userToken1 = await userLogin(servers[0], user)await uploadVideo(servers[0].url, userToken1, { name: 'video user 1' })@@ -117,14 +116,14 @@ describe('Test blocklist', function () {{const user = { username: 'moderator', password: 'password' }- await createUser({ url: servers[ 0 ].url, accessToken: servers[ 0 ].accessToken, username: user.username, password: user.password })+ await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: user.username, password: user.password })userModeratorToken = await userLogin(servers[0], user)}{const user = { username: 'user2', password: 'password' }- await createUser({ url: servers[ 1 ].url, accessToken: servers[ 1 ].accessToken, username: user.username, password: user.password })+ await createUser({ url: servers[1].url, accessToken: servers[1].accessToken, username: user.username, password: user.password })userToken2 = await userLogin(servers[1], user)await uploadVideo(servers[1].url, userToken2, { name: 'video user 2' })@@ -143,14 +142,14 @@ describe('Test blocklist', function () {await doubleFollow(servers[0], servers[1]){- const resComment = await addVideoCommentThread(servers[ 0 ].url, servers[ 0 ].accessToken, videoUUID1, 'comment root 1')- const resReply = await addVideoCommentReply(servers[ 0 ].url, userToken1, videoUUID1, resComment.body.comment.id, 'comment user 1')- await addVideoCommentReply(servers[ 0 ].url, servers[ 0 ].accessToken, videoUUID1, resReply.body.comment.id, 'comment root 1')+ const resComment = await addVideoCommentThread(servers[0].url, servers[0].accessToken, videoUUID1, 'comment root 1')+ const resReply = await addVideoCommentReply(servers[0].url, userToken1, videoUUID1, resComment.body.comment.id, 'comment user 1')+ await addVideoCommentReply(servers[0].url, servers[0].accessToken, videoUUID1, resReply.body.comment.id, 'comment root 1')}{- const resComment = await addVideoCommentThread(servers[ 0 ].url, userToken1, videoUUID1, 'comment user 1')- await addVideoCommentReply(servers[ 0 ].url, servers[ 0 ].accessToken, videoUUID1, resComment.body.comment.id, 'comment root 1')+ const resComment = await addVideoCommentThread(servers[0].url, userToken1, videoUUID1, 'comment user 1')+ await addVideoCommentReply(servers[0].url, servers[0].accessToken, videoUUID1, resComment.body.comment.id, 'comment root 1')}await waitJobs(servers)@@ -160,19 +159,19 @@ describe('Test blocklist', function () {describe('When managing account blocklist', function () {it('Should list all videos', function () {- return checkAllVideos(servers[ 0 ].url, servers[ 0 ].accessToken)+ return checkAllVideos(servers[0].url, servers[0].accessToken)})it('Should list the comments', function () {- return checkAllComments(servers[ 0 ].url, servers[ 0 ].accessToken, videoUUID1)+ return checkAllComments(servers[0].url, servers[0].accessToken, videoUUID1)})it('Should block a remote account', async function () {- await addAccountToAccountBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, 'user2@localhost:' + servers[1].port)+ await addAccountToAccountBlocklist(servers[0].url, servers[0].accessToken, 'user2@localhost:' + servers[1].port)})it('Should hide its videos', async function () {- const res = await getVideosListWithToken(servers[ 0 ].url, servers[ 0 ].accessToken)+ const res = await getVideosListWithToken(servers[0].url, servers[0].accessToken)const videos: Video[] = res.body.dataexpect(videos).to.have.lengthOf(3)@@ -182,11 +181,11 @@ describe('Test blocklist', function () {})it('Should block a local account', async function () {- await addAccountToAccountBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, 'user1')+ await addAccountToAccountBlocklist(servers[0].url, servers[0].accessToken, 'user1')})it('Should hide its videos', async function () {- const res = await getVideosListWithToken(servers[ 0 ].url, servers[ 0 ].accessToken)+ const res = await getVideosListWithToken(servers[0].url, servers[0].accessToken)const videos: Video[] = res.body.dataexpect(videos).to.have.lengthOf(2)@@ -196,17 +195,17 @@ describe('Test blocklist', function () {})it('Should hide its comments', async function () {- const resThreads = await getVideoCommentThreads(servers[ 0 ].url, videoUUID1, 0, 5, '-createdAt', servers[ 0 ].accessToken)+ const resThreads = await getVideoCommentThreads(servers[0].url, videoUUID1, 0, 5, '-createdAt', servers[0].accessToken)const threads: VideoComment[] = resThreads.body.dataexpect(threads).to.have.lengthOf(1)- expect(threads[ 0 ].totalReplies).to.equal(0)+ expect(threads[0].totalReplies).to.equal(0)const t = threads.find(t => t.text === 'comment user 1')expect(t).to.be.undefinedfor (const thread of threads) {- const res = await getVideoThreadComments(servers[ 0 ].url, videoUUID1, thread.id, servers[ 0 ].accessToken)+ const res = await getVideoThreadComments(servers[0].url, videoUUID1, thread.id, servers[0].accessToken)const tree: VideoCommentThreadTree = res.bodyexpect(tree.children).to.have.lengthOf(0)@@ -217,37 +216,37 @@ describe('Test blocklist', function () {this.timeout(20000){- const comment = { server: servers[ 0 ], token: userToken1, videoUUID: videoUUID1, text: 'hidden comment' }- await checkCommentNotification(servers[ 0 ], comment, 'absence')+ const comment = { server: servers[0], token: userToken1, videoUUID: videoUUID1, text: 'hidden comment' }+ await checkCommentNotification(servers[0], comment, 'absence')}{const comment = {- server: servers[ 0 ],+ server: servers[0],token: userToken1,videoUUID: videoUUID2,- text: 'hello @root@localhost:' + servers[ 0 ].port+ text: 'hello @root@localhost:' + servers[0].port}- await checkCommentNotification(servers[ 0 ], comment, 'absence')+ await checkCommentNotification(servers[0], comment, 'absence')}})it('Should list all the videos with another user', async function () {- return checkAllVideos(servers[ 0 ].url, userToken1)+ return checkAllVideos(servers[0].url, userToken1)})it('Should list all the comments with another user', async function () {- return checkAllComments(servers[ 0 ].url, userToken1, videoUUID1)+ return checkAllComments(servers[0].url, userToken1, videoUUID1)})it('Should list blocked accounts', async function () {{- const res = await getAccountBlocklistByAccount(servers[ 0 ].url, servers[ 0 ].accessToken, 0, 1, 'createdAt')+ const res = await getAccountBlocklistByAccount(servers[0].url, servers[0].accessToken, 0, 1, 'createdAt')const blocks: AccountBlock[] = res.body.dataexpect(res.body.total).to.equal(2)- const block = blocks[ 0 ]+ const block = blocks[0]expect(block.byAccount.displayName).to.equal('root')expect(block.byAccount.name).to.equal('root')expect(block.blockedAccount.displayName).to.equal('user2')@@ -256,12 +255,12 @@ describe('Test blocklist', function () {}{- const res = await getAccountBlocklistByAccount(servers[ 0 ].url, servers[ 0 ].accessToken, 1, 2, 'createdAt')+ const res = await getAccountBlocklistByAccount(servers[0].url, servers[0].accessToken, 1, 2, 'createdAt')const blocks: AccountBlock[] = res.body.dataexpect(res.body.total).to.equal(2)- const block = blocks[ 0 ]+ const block = blocks[0]expect(block.byAccount.displayName).to.equal('root')expect(block.byAccount.name).to.equal('root')expect(block.blockedAccount.displayName).to.equal('user1')@@ -271,11 +270,11 @@ describe('Test blocklist', function () {})it('Should unblock the remote account', async function () {- await removeAccountFromAccountBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, 'user2@localhost:' + servers[1].port)+ await removeAccountFromAccountBlocklist(servers[0].url, servers[0].accessToken, 'user2@localhost:' + servers[1].port)})it('Should display its videos', async function () {- const res = await getVideosListWithToken(servers[ 0 ].url, servers[ 0 ].accessToken)+ const res = await getVideosListWithToken(servers[0].url, servers[0].accessToken)const videos: Video[] = res.body.dataexpect(videos).to.have.lengthOf(3)@@ -285,48 +284,48 @@ describe('Test blocklist', function () {})it('Should unblock the local account', async function () {- await removeAccountFromAccountBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, 'user1')+ await removeAccountFromAccountBlocklist(servers[0].url, servers[0].accessToken, 'user1')})it('Should display its comments', function () {- return checkAllComments(servers[ 0 ].url, servers[ 0 ].accessToken, videoUUID1)+ return checkAllComments(servers[0].url, servers[0].accessToken, videoUUID1)})it('Should have a notification from a non blocked account', async function () {this.timeout(20000){- const comment = { server: servers[ 1 ], token: userToken2, videoUUID: videoUUID1, text: 'displayed comment' }- await checkCommentNotification(servers[ 0 ], comment, 'presence')+ const comment = { server: servers[1], token: userToken2, videoUUID: videoUUID1, text: 'displayed comment' }+ await checkCommentNotification(servers[0], comment, 'presence')}{const comment = {- server: servers[ 0 ],+ server: servers[0],token: userToken1,videoUUID: videoUUID2,- text: 'hello @root@localhost:' + servers[ 0 ].port+ text: 'hello @root@localhost:' + servers[0].port}- await checkCommentNotification(servers[ 0 ], comment, 'presence')+ await checkCommentNotification(servers[0], comment, 'presence')}})})describe('When managing server blocklist', function () {it('Should list all videos', function () {- return checkAllVideos(servers[ 0 ].url, servers[ 0 ].accessToken)+ return checkAllVideos(servers[0].url, servers[0].accessToken)})it('Should list the comments', function () {- return checkAllComments(servers[ 0 ].url, servers[ 0 ].accessToken, videoUUID1)+ return checkAllComments(servers[0].url, servers[0].accessToken, videoUUID1)})it('Should block a remote server', async function () {- await addServerToAccountBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, 'localhost:' + servers[1].port)+ await addServerToAccountBlocklist(servers[0].url, servers[0].accessToken, 'localhost:' + servers[1].port)})it('Should hide its videos', async function () {- const res = await getVideosListWithToken(servers[ 0 ].url, servers[ 0 ].accessToken)+ const res = await getVideosListWithToken(servers[0].url, servers[0].accessToken)const videos: Video[] = res.body.dataexpect(videos).to.have.lengthOf(2)@@ -339,81 +338,81 @@ describe('Test blocklist', function () {})it('Should list all the videos with another user', async function () {- return checkAllVideos(servers[ 0 ].url, userToken1)+ return checkAllVideos(servers[0].url, userToken1)})it('Should hide its comments', async function () {this.timeout(10000)- const resThreads = await addVideoCommentThread(servers[ 1 ].url, userToken2, videoUUID1, 'hidden comment 2')+ const resThreads = await addVideoCommentThread(servers[1].url, userToken2, videoUUID1, 'hidden comment 2')const threadId = resThreads.body.comment.idawait waitJobs(servers)- await checkAllComments(servers[ 0 ].url, servers[ 0 ].accessToken, videoUUID1)+ await checkAllComments(servers[0].url, servers[0].accessToken, videoUUID1)- await deleteVideoComment(servers[ 1 ].url, userToken2, videoUUID1, threadId)+ await deleteVideoComment(servers[1].url, userToken2, videoUUID1, threadId)})it('Should not have notifications from blocked server', async function () {this.timeout(20000){- const comment = { server: servers[ 1 ], token: userToken2, videoUUID: videoUUID1, text: 'hidden comment' }- await checkCommentNotification(servers[ 0 ], comment, 'absence')+ const comment = { server: servers[1], token: userToken2, videoUUID: videoUUID1, text: 'hidden comment' }+ await checkCommentNotification(servers[0], comment, 'absence')}{const comment = {- server: servers[ 1 ],+ server: servers[1],token: userToken2,videoUUID: videoUUID1,- text: 'hello @root@localhost:' + servers[ 0 ].port+ text: 'hello @root@localhost:' + servers[0].port}- await checkCommentNotification(servers[ 0 ], comment, 'absence')+ await checkCommentNotification(servers[0], comment, 'absence')}})it('Should list blocked servers', async function () {- const res = await getServerBlocklistByAccount(servers[ 0 ].url, servers[ 0 ].accessToken, 0, 1, 'createdAt')+ const res = await getServerBlocklistByAccount(servers[0].url, servers[0].accessToken, 0, 1, 'createdAt')const blocks: ServerBlock[] = res.body.dataexpect(res.body.total).to.equal(1)- const block = blocks[ 0 ]+ const block = blocks[0]expect(block.byAccount.displayName).to.equal('root')expect(block.byAccount.name).to.equal('root')expect(block.blockedServer.host).to.equal('localhost:' + servers[1].port)})it('Should unblock the remote server', async function () {- await removeServerFromAccountBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, 'localhost:' + servers[1].port)+ await removeServerFromAccountBlocklist(servers[0].url, servers[0].accessToken, 'localhost:' + servers[1].port)})it('Should display its videos', function () {- return checkAllVideos(servers[ 0 ].url, servers[ 0 ].accessToken)+ return checkAllVideos(servers[0].url, servers[0].accessToken)})it('Should display its comments', function () {- return checkAllComments(servers[ 0 ].url, servers[ 0 ].accessToken, videoUUID1)+ return checkAllComments(servers[0].url, servers[0].accessToken, videoUUID1)})it('Should have notification from unblocked server', async function () {this.timeout(20000){- const comment = { server: servers[ 1 ], token: userToken2, videoUUID: videoUUID1, text: 'displayed comment' }- await checkCommentNotification(servers[ 0 ], comment, 'presence')+ const comment = { server: servers[1], token: userToken2, videoUUID: videoUUID1, text: 'displayed comment' }+ await checkCommentNotification(servers[0], comment, 'presence')}{const comment = {- server: servers[ 1 ],+ server: servers[1],token: userToken2,videoUUID: videoUUID1,- text: 'hello @root@localhost:' + servers[ 0 ].port+ text: 'hello @root@localhost:' + servers[0].port}- await checkCommentNotification(servers[ 0 ], comment, 'presence')+ await checkCommentNotification(servers[0], comment, 'presence')}})})@@ -423,24 +422,24 @@ describe('Test blocklist', function () {describe('When managing account blocklist', function () {it('Should list all videos', async function () {- for (const token of [ userModeratorToken, servers[ 0 ].accessToken ]) {- await checkAllVideos(servers[ 0 ].url, token)+ for (const token of [ userModeratorToken, servers[0].accessToken ]) {+ await checkAllVideos(servers[0].url, token)}})it('Should list the comments', async function () {- for (const token of [ userModeratorToken, servers[ 0 ].accessToken ]) {- await checkAllComments(servers[ 0 ].url, token, videoUUID1)+ for (const token of [ userModeratorToken, servers[0].accessToken ]) {+ await checkAllComments(servers[0].url, token, videoUUID1)}})it('Should block a remote account', async function () {- await addAccountToServerBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, 'user2@localhost:' + servers[1].port)+ await addAccountToServerBlocklist(servers[0].url, servers[0].accessToken, 'user2@localhost:' + servers[1].port)})it('Should hide its videos', async function () {- for (const token of [ userModeratorToken, servers[ 0 ].accessToken ]) {- const res = await getVideosListWithToken(servers[ 0 ].url, token)+ for (const token of [ userModeratorToken, servers[0].accessToken ]) {+ const res = await getVideosListWithToken(servers[0].url, token)const videos: Video[] = res.body.dataexpect(videos).to.have.lengthOf(3)@@ -451,12 +450,12 @@ describe('Test blocklist', function () {})it('Should block a local account', async function () {- await addAccountToServerBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, 'user1')+ await addAccountToServerBlocklist(servers[0].url, servers[0].accessToken, 'user1')})it('Should hide its videos', async function () {- for (const token of [ userModeratorToken, servers[ 0 ].accessToken ]) {- const res = await getVideosListWithToken(servers[ 0 ].url, token)+ for (const token of [ userModeratorToken, servers[0].accessToken ]) {+ const res = await getVideosListWithToken(servers[0].url, token)const videos: Video[] = res.body.dataexpect(videos).to.have.lengthOf(2)@@ -467,18 +466,18 @@ describe('Test blocklist', function () {})it('Should hide its comments', async function () {- for (const token of [ userModeratorToken, servers[ 0 ].accessToken ]) {- const resThreads = await getVideoCommentThreads(servers[ 0 ].url, videoUUID1, 0, 5, '-createdAt', token)+ for (const token of [ userModeratorToken, servers[0].accessToken ]) {+ const resThreads = await getVideoCommentThreads(servers[0].url, videoUUID1, 0, 5, '-createdAt', token)const threads: VideoComment[] = resThreads.body.dataexpect(threads).to.have.lengthOf(1)- expect(threads[ 0 ].totalReplies).to.equal(0)+ expect(threads[0].totalReplies).to.equal(0)const t = threads.find(t => t.text === 'comment user 1')expect(t).to.be.undefinedfor (const thread of threads) {- const res = await getVideoThreadComments(servers[ 0 ].url, videoUUID1, thread.id, token)+ const res = await getVideoThreadComments(servers[0].url, videoUUID1, thread.id, token)const tree: VideoCommentThreadTree = res.bodyexpect(tree.children).to.have.lengthOf(0)@@ -490,29 +489,29 @@ describe('Test blocklist', function () {this.timeout(20000){- const comment = { server: servers[ 0 ], token: userToken1, videoUUID: videoUUID1, text: 'hidden comment' }- await checkCommentNotification(servers[ 0 ], comment, 'absence')+ const comment = { server: servers[0], token: userToken1, videoUUID: videoUUID1, text: 'hidden comment' }+ await checkCommentNotification(servers[0], comment, 'absence')}{const comment = {- server: servers[ 1 ],+ server: servers[1],token: userToken2,videoUUID: videoUUID1,- text: 'hello @root@localhost:' + servers[ 0 ].port+ text: 'hello @root@localhost:' + servers[0].port}- await checkCommentNotification(servers[ 0 ], comment, 'absence')+ await checkCommentNotification(servers[0], comment, 'absence')}})it('Should list blocked accounts', async function () {{- const res = await getAccountBlocklistByServer(servers[ 0 ].url, servers[ 0 ].accessToken, 0, 1, 'createdAt')+ const res = await getAccountBlocklistByServer(servers[0].url, servers[0].accessToken, 0, 1, 'createdAt')const blocks: AccountBlock[] = res.body.dataexpect(res.body.total).to.equal(2)- const block = blocks[ 0 ]+ const block = blocks[0]expect(block.byAccount.displayName).to.equal('peertube')expect(block.byAccount.name).to.equal('peertube')expect(block.blockedAccount.displayName).to.equal('user2')@@ -521,12 +520,12 @@ describe('Test blocklist', function () {}{- const res = await getAccountBlocklistByServer(servers[ 0 ].url, servers[ 0 ].accessToken, 1, 2, 'createdAt')+ const res = await getAccountBlocklistByServer(servers[0].url, servers[0].accessToken, 1, 2, 'createdAt')const blocks: AccountBlock[] = res.body.dataexpect(res.body.total).to.equal(2)- const block = blocks[ 0 ]+ const block = blocks[0]expect(block.byAccount.displayName).to.equal('peertube')expect(block.byAccount.name).to.equal('peertube')expect(block.blockedAccount.displayName).to.equal('user1')@@ -536,12 +535,12 @@ describe('Test blocklist', function () {})it('Should unblock the remote account', async function () {- await removeAccountFromServerBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, 'user2@localhost:' + servers[1].port)+ await removeAccountFromServerBlocklist(servers[0].url, servers[0].accessToken, 'user2@localhost:' + servers[1].port)})it('Should display its videos', async function () {- for (const token of [ userModeratorToken, servers[ 0 ].accessToken ]) {- const res = await getVideosListWithToken(servers[ 0 ].url, token)+ for (const token of [ userModeratorToken, servers[0].accessToken ]) {+ const res = await getVideosListWithToken(servers[0].url, token)const videos: Video[] = res.body.dataexpect(videos).to.have.lengthOf(3)@@ -552,12 +551,12 @@ describe('Test blocklist', function () {})it('Should unblock the local account', async function () {- await removeAccountFromServerBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, 'user1')+ await removeAccountFromServerBlocklist(servers[0].url, servers[0].accessToken, 'user1')})it('Should display its comments', async function () {- for (const token of [ userModeratorToken, servers[ 0 ].accessToken ]) {- await checkAllComments(servers[ 0 ].url, token, videoUUID1)+ for (const token of [ userModeratorToken, servers[0].accessToken ]) {+ await checkAllComments(servers[0].url, token, videoUUID1)}})@@ -565,43 +564,43 @@ describe('Test blocklist', function () {this.timeout(20000){- const comment = { server: servers[ 0 ], token: userToken1, videoUUID: videoUUID1, text: 'displayed comment' }- await checkCommentNotification(servers[ 0 ], comment, 'presence')+ const comment = { server: servers[0], token: userToken1, videoUUID: videoUUID1, text: 'displayed comment' }+ await checkCommentNotification(servers[0], comment, 'presence')}{const comment = {- server: servers[ 1 ],+ server: servers[1],token: userToken2,videoUUID: videoUUID1,- text: 'hello @root@localhost:' + servers[ 0 ].port+ text: 'hello @root@localhost:' + servers[0].port}- await checkCommentNotification(servers[ 0 ], comment, 'presence')+ await checkCommentNotification(servers[0], comment, 'presence')}})})describe('When managing server blocklist', function () {it('Should list all videos', async function () {- for (const token of [ userModeratorToken, servers[ 0 ].accessToken ]) {- await checkAllVideos(servers[ 0 ].url, token)+ for (const token of [ userModeratorToken, servers[0].accessToken ]) {+ await checkAllVideos(servers[0].url, token)}})it('Should list the comments', async function () {- for (const token of [ userModeratorToken, servers[ 0 ].accessToken ]) {- await checkAllComments(servers[ 0 ].url, token, videoUUID1)+ for (const token of [ userModeratorToken, servers[0].accessToken ]) {+ await checkAllComments(servers[0].url, token, videoUUID1)}})it('Should block a remote server', async function () {- await addServerToServerBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, 'localhost:' + servers[1].port)+ await addServerToServerBlocklist(servers[0].url, servers[0].accessToken, 'localhost:' + servers[1].port)})it('Should hide its videos', async function () {- for (const token of [ userModeratorToken, servers[ 0 ].accessToken ]) {- const res1 = await getVideosList(servers[ 0 ].url)- const res2 = await getVideosListWithToken(servers[ 0 ].url, token)+ for (const token of [ userModeratorToken, servers[0].accessToken ]) {+ const res1 = await getVideosList(servers[0].url)+ const res2 = await getVideosListWithToken(servers[0].url, token)for (const res of [ res1, res2 ]) {const videos: Video[] = res.body.data@@ -619,60 +618,60 @@ describe('Test blocklist', function () {it('Should hide its comments', async function () {this.timeout(10000)- const resThreads = await addVideoCommentThread(servers[ 1 ].url, userToken2, videoUUID1, 'hidden comment 2')+ const resThreads = await addVideoCommentThread(servers[1].url, userToken2, videoUUID1, 'hidden comment 2')const threadId = resThreads.body.comment.idawait waitJobs(servers)- await checkAllComments(servers[ 0 ].url, servers[ 0 ].accessToken, videoUUID1)+ await checkAllComments(servers[0].url, servers[0].accessToken, videoUUID1)- await deleteVideoComment(servers[ 1 ].url, userToken2, videoUUID1, threadId)+ await deleteVideoComment(servers[1].url, userToken2, videoUUID1, threadId)})it('Should not have notification from blocked instances by instance', async function () {this.timeout(20000){- const comment = { server: servers[ 1 ], token: userToken2, videoUUID: videoUUID1, text: 'hidden comment' }- await checkCommentNotification(servers[ 0 ], comment, 'absence')+ const comment = { server: servers[1], token: userToken2, videoUUID: videoUUID1, text: 'hidden comment' }+ await checkCommentNotification(servers[0], comment, 'absence')}{const comment = {- server: servers[ 1 ],+ server: servers[1],token: userToken2,videoUUID: videoUUID1,- text: 'hello @root@localhost:' + servers[ 0 ].port+ text: 'hello @root@localhost:' + servers[0].port}- await checkCommentNotification(servers[ 0 ], comment, 'absence')+ await checkCommentNotification(servers[0], comment, 'absence')}})it('Should list blocked servers', async function () {- const res = await getServerBlocklistByServer(servers[ 0 ].url, servers[ 0 ].accessToken, 0, 1, 'createdAt')+ const res = await getServerBlocklistByServer(servers[0].url, servers[0].accessToken, 0, 1, 'createdAt')const blocks: ServerBlock[] = res.body.dataexpect(res.body.total).to.equal(1)- const block = blocks[ 0 ]+ const block = blocks[0]expect(block.byAccount.displayName).to.equal('peertube')expect(block.byAccount.name).to.equal('peertube')expect(block.blockedServer.host).to.equal('localhost:' + servers[1].port)})it('Should unblock the remote server', async function () {- await removeServerFromServerBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, 'localhost:' + servers[1].port)+ await removeServerFromServerBlocklist(servers[0].url, servers[0].accessToken, 'localhost:' + servers[1].port)})it('Should list all videos', async function () {- for (const token of [ userModeratorToken, servers[ 0 ].accessToken ]) {- await checkAllVideos(servers[ 0 ].url, token)+ for (const token of [ userModeratorToken, servers[0].accessToken ]) {+ await checkAllVideos(servers[0].url, token)}})it('Should list the comments', async function () {- for (const token of [ userModeratorToken, servers[ 0 ].accessToken ]) {- await checkAllComments(servers[ 0 ].url, token, videoUUID1)+ for (const token of [ userModeratorToken, servers[0].accessToken ]) {+ await checkAllComments(servers[0].url, token, videoUUID1)}})@@ -680,18 +679,18 @@ describe('Test blocklist', function () {this.timeout(20000){- const comment = { server: servers[ 1 ], token: userToken2, videoUUID: videoUUID1, text: 'displayed comment' }- await checkCommentNotification(servers[ 0 ], comment, 'presence')+ const comment = { server: servers[1], token: userToken2, videoUUID: videoUUID1, text: 'displayed comment' }+ await checkCommentNotification(servers[0], comment, 'presence')}{const comment = {- server: servers[ 1 ],+ server: servers[1],token: userToken2,videoUUID: videoUUID1,- text: 'hello @root@localhost:' + servers[ 0 ].port+ text: 'hello @root@localhost:' + servers[0].port}- await checkCommentNotification(servers[ 0 ], comment, 'presence')+ await checkCommentNotification(servers[0], comment, 'presence')}})})diff --git a/server/tests/api/users/user-subscriptions.ts b/server/tests/api/users/user-subscriptions.tsindex 08017f89c2..7d6b0c6a99 100644--- a/server/tests/api/users/user-subscriptions.ts+++ b/server/tests/api/users/user-subscriptions.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'@@ -13,16 +13,17 @@ import {updateVideo,userLogin} from '../../../../shared/extra-utils'-import { killallServers, ServerInfo, uploadVideo } from '../../../../shared/extra-utils/index'+import { ServerInfo, uploadVideo } from '../../../../shared/extra-utils/index'import { setAccessTokensToServers } from '../../../../shared/extra-utils/users/login'import { Video, VideoChannel } from '../../../../shared/models/videos'import { waitJobs } from '../../../../shared/extra-utils/server/jobs'import {addUserSubscription,+ areSubscriptionsExist,+ getUserSubscription,listUserSubscriptions,listUserSubscriptionVideos,- removeUserSubscription,- getUserSubscription, areSubscriptionsExist+ removeUserSubscription} from '../../../../shared/extra-utils/users/user-subscriptions'const expect = chai.expect@@ -116,7 +117,7 @@ describe('Test users subscriptions', function () {it('Should get subscription', async function () {{- const res = await getUserSubscription(servers[ 0 ].url, users[ 0 ].accessToken, 'user3_channel@localhost:' + servers[2].port)+ const res = await getUserSubscription(servers[0].url, users[0].accessToken, 'user3_channel@localhost:' + servers[2].port)const videoChannel: VideoChannel = res.bodyexpect(videoChannel.name).to.equal('user3_channel')@@ -127,7 +128,7 @@ describe('Test users subscriptions', function () {}{- const res = await getUserSubscription(servers[ 0 ].url, users[ 0 ].accessToken, 'root_channel@localhost:' + servers[0].port)+ const res = await getUserSubscription(servers[0].url, users[0].accessToken, 'root_channel@localhost:' + servers[0].port)const videoChannel: VideoChannel = res.bodyexpect(videoChannel.name).to.equal('root_channel')@@ -146,7 +147,7 @@ describe('Test users subscriptions', function () {'user3_channel@localhost:' + servers[0].port]- const res = await areSubscriptionsExist(servers[ 0 ].url, users[ 0 ].accessToken, uris)+ const res = await areSubscriptionsExist(servers[0].url, users[0].accessToken, uris)const body = res.bodyexpect(body['user3_channel@localhost:' + servers[2].port]).to.be.truediff --git a/server/tests/api/users/users-multiple-servers.ts b/server/tests/api/users/users-multiple-servers.tsindex 7914183188..591ce4959b 100644--- a/server/tests/api/users/users-multiple-servers.ts+++ b/server/tests/api/users/users-multiple-servers.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'@@ -57,17 +57,17 @@ describe('Test users with multiple servers', function () {password: 'password'}const res = await createUser({- url: servers[ 0 ].url,- accessToken: servers[ 0 ].accessToken,+ url: servers[0].url,+ accessToken: servers[0].accessToken,username: user.username,password: user.password})userId = res.body.user.id- userAccessToken = await userLogin(servers[ 0 ], user)+ userAccessToken = await userLogin(servers[0], user)}{- const resVideo = await uploadVideo(servers[ 0 ].url, userAccessToken, {})+ const resVideo = await uploadVideo(servers[0].url, userAccessToken, {})videoUUID = resVideo.body.video.uuid}@@ -86,7 +86,6 @@ describe('Test users with multiple servers', function () {const res = await getMyUserInformation(servers[0].url, servers[0].accessToken)user = res.body- const account: Account = user.accountexpect(user.account.displayName).to.equal('my super display name')await waitJobs(servers)diff --git a/server/tests/api/users/users-verification.ts b/server/tests/api/users/users-verification.tsindex 7cd61f5395..675ebf690e 100644--- a/server/tests/api/users/users-verification.ts+++ b/server/tests/api/users/users-verification.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.tsindex 24203a7317..502eac0bb4 100644--- a/server/tests/api/users/users.ts+++ b/server/tests/api/users/users.ts@@ -1,8 +1,8 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'-import { User, UserRole, Video, MyUser, VideoPlaylistType } from '../../../../shared/index'+import { MyUser, User, UserRole, Video, VideoPlaylistType } from '../../../../shared/index'import {blockUser,cleanupTests,@@ -18,7 +18,8 @@ import {getUsersList,getUsersListPaginationAndSort,getVideoChannel,- getVideosList, installPlugin,+ getVideosList,+ installPlugin,login,makePutBodyRequest,rateVideo,@@ -121,13 +122,13 @@ describe('Test users', function () {it('Should be able to login with an insensitive username', async function () {const user = { username: 'RoOt', password: server.user.password }- const res = await login(server.url, server.client, user, 200)+ await login(server.url, server.client, user, 200)const user2 = { username: 'rOoT', password: server.user.password }- const res2 = await login(server.url, server.client, user2, 200)+ await login(server.url, server.client, user2, 200)const user3 = { username: 'ROOt', password: server.user.password }- const res3 = await login(server.url, server.client, user3, 200)+ await login(server.url, server.client, user3, 200)})})@@ -137,7 +138,7 @@ describe('Test users', function () {const videoAttributes = {}await uploadVideo(server.url, accessToken, videoAttributes)const res = await getVideosList(server.url)- const video = res.body.data[ 0 ]+ const video = res.body.data[0]expect(video.account.name).to.equal('root')videoId = video.id@@ -167,8 +168,8 @@ describe('Test users', function () {const ratings = res.bodyexpect(ratings.total).to.equal(1)- expect(ratings.data[ 0 ].video.id).to.equal(videoId)- expect(ratings.data[ 0 ].rating).to.equal('like')+ expect(ratings.data[0].video.id).to.equal(videoId)+ expect(ratings.data[0].rating).to.equal('like')})it('Should retrieve ratings list by rating type', async function () {@@ -307,7 +308,7 @@ describe('Test users', function () {const videos = res.body.dataexpect(videos).to.have.lengthOf(1)- const video: Video = videos[ 0 ]+ const video: Video = videos[0]expect(video.name).to.equal('super user video')expect(video.thumbnailPath).to.not.be.nullexpect(video.previewPath).to.not.be.null@@ -344,12 +345,12 @@ describe('Test users', function () {expect(users).to.be.an('array')expect(users.length).to.equal(2)- const user = users[ 0 ]+ const user = users[0]expect(user.username).to.equal('user_1')expect(user.email).to.equal('[email protected]')expect(user.nsfwPolicy).to.equal('display')- const rootUser = users[ 1 ]+ const rootUser = users[1]expect(rootUser.username).to.equal('root')expect(rootUser.email).to.equal('admin' + server.internalServerNumber + '@example.com')expect(user.nsfwPolicy).to.equal('display')@@ -367,7 +368,7 @@ describe('Test users', function () {expect(total).to.equal(2)expect(users.length).to.equal(1)- const user = users[ 0 ]+ const user = users[0]expect(user.username).to.equal('root')expect(user.email).to.equal('admin' + server.internalServerNumber + '@example.com')expect(user.roleLabel).to.equal('Administrator')@@ -383,7 +384,7 @@ describe('Test users', function () {expect(total).to.equal(2)expect(users.length).to.equal(1)- const user = users[ 0 ]+ const user = users[0]expect(user.username).to.equal('user_1')expect(user.email).to.equal('[email protected]')expect(user.nsfwPolicy).to.equal('display')@@ -398,7 +399,7 @@ describe('Test users', function () {expect(total).to.equal(2)expect(users.length).to.equal(1)- const user = users[ 0 ]+ const user = users[0]expect(user.username).to.equal('user_1')expect(user.email).to.equal('[email protected]')expect(user.nsfwPolicy).to.equal('display')@@ -413,13 +414,13 @@ describe('Test users', function () {expect(total).to.equal(2)expect(users.length).to.equal(2)- expect(users[ 0 ].username).to.equal('root')- expect(users[ 0 ].email).to.equal('admin' + server.internalServerNumber + '@example.com')- expect(users[ 0 ].nsfwPolicy).to.equal('display')+ expect(users[0].username).to.equal('root')+ expect(users[0].email).to.equal('admin' + server.internalServerNumber + '@example.com')+ expect(users[0].nsfwPolicy).to.equal('display')- expect(users[ 1 ].username).to.equal('user_1')- expect(users[ 1 ].email).to.equal('[email protected]')- expect(users[ 1 ].nsfwPolicy).to.equal('display')+ expect(users[1].username).to.equal('user_1')+ expect(users[1].email).to.equal('[email protected]')+ expect(users[1].nsfwPolicy).to.equal('display')})it('Should search user by username', async function () {@@ -429,7 +430,7 @@ describe('Test users', function () {expect(res.body.total).to.equal(1)expect(users.length).to.equal(1)- expect(users[ 0 ].username).to.equal('root')+ expect(users[0].username).to.equal('root')})it('Should search user by email', async function () {@@ -440,8 +441,8 @@ describe('Test users', function () {expect(res.body.total).to.equal(1)expect(users.length).to.equal(1)- expect(users[ 0 ].username).to.equal('user_1')- expect(users[ 0 ].email).to.equal('[email protected]')+ expect(users[0].username).to.equal('user_1')+ expect(users[0].email).to.equal('[email protected]')}{@@ -451,8 +452,8 @@ describe('Test users', function () {expect(res.body.total).to.equal(2)expect(users.length).to.equal(2)- expect(users[ 0 ].username).to.equal('root')- expect(users[ 1 ].username).to.equal('user_1')+ expect(users[0].username).to.equal('root')+ expect(users[1].username).to.equal('user_1')}})})@@ -691,7 +692,7 @@ describe('Test users', function () {expect(res.body.total).to.equal(1)- const video = res.body.data[ 0 ]+ const video = res.body.data[0]expect(video.account.name).to.equal('root')})})diff --git a/server/tests/api/videos/audio-only.ts b/server/tests/api/videos/audio-only.tsindex f12d730ccf..ac7a0b89cb 100644--- a/server/tests/api/videos/audio-only.ts+++ b/server/tests/api/videos/audio-only.ts@@ -1,28 +1,21 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'import {- checkDirectoryIsEmpty,- checkSegmentHash,- checkTmpIsEmpty,cleanupTests,doubleFollow,flushAndRunMultipleServers,- getPlaylist,- getVideo, makeGetRequest, makeRawRequest,- removeVideo, root,+ getVideo,+ root,ServerInfo,- setAccessTokensToServers, updateCustomSubConfig,- updateVideo,+ setAccessTokensToServers,uploadVideo,- waitJobs, webtorrentAdd+ waitJobs} from '../../../../shared/extra-utils'import { VideoDetails } from '../../../../shared/models/videos'-import { VideoStreamingPlaylistType } from '../../../../shared/models/videos/video-streaming-playlist.type'import { join } from 'path'-import { DEFAULT_AUDIO_RESOLUTION } from '../../../initializers/constants'-import { getVideoFileBitrate, getVideoFileFPS, getVideoFileResolution, audio, getVideoStreamSize } from '@server/helpers/ffmpeg-utils'+import { audio, getVideoStreamSize } from '@server/helpers/ffmpeg-utils'const expect = chai.expect@@ -87,14 +80,14 @@ describe('Test audio only video transcoding', function () {it('0p transcoded video should not have video', async function () {const paths = [- join(root(), 'test' + servers[ 0 ].internalServerNumber, 'videos', videoUUID + '-0.mp4'),- join(root(), 'test' + servers[ 0 ].internalServerNumber, 'streaming-playlists', 'hls', videoUUID, videoUUID + '-0-fragmented.mp4')+ join(root(), 'test' + servers[0].internalServerNumber, 'videos', videoUUID + '-0.mp4'),+ join(root(), 'test' + servers[0].internalServerNumber, 'streaming-playlists', 'hls', videoUUID, videoUUID + '-0-fragmented.mp4')]for (const path of paths) {const { audioStream } = await audio.get(path)- expect(audioStream[ 'codec_name' ]).to.be.equal('aac')- expect(audioStream[ 'bit_rate' ]).to.be.at.most(384 * 8000)+ expect(audioStream['codec_name']).to.be.equal('aac')+ expect(audioStream['bit_rate']).to.be.at.most(384 * 8000)const size = await getVideoStreamSize(path)expect(size.height).to.equal(0)diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.tsindex fa3e250ecb..e3029f1aeb 100644--- a/server/tests/api/videos/multiple-servers.ts+++ b/server/tests/api/videos/multiple-servers.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'@@ -63,9 +63,9 @@ describe('Test multiple servers', function () {displayName: 'my channel',description: 'super channel'}- await addVideoChannel(servers[ 0 ].url, servers[ 0 ].accessToken, videoChannel)- const channelRes = await getVideoChannelsList(servers[ 0 ].url, 0, 1)- videoChannelId = channelRes.body.data[ 0 ].id+ await addVideoChannel(servers[0].url, servers[0].accessToken, videoChannel)+ const channelRes = await getVideoChannelsList(servers[0].url, 0, 1)+ videoChannelId = channelRes.body.data[0].id}// Server 1 and server 2 follow each other@@ -163,7 +163,7 @@ describe('Test multiple servers', function () {username: 'user1',password: 'super_password'}- await createUser({ url: servers[ 1 ].url, accessToken: servers[ 1 ].accessToken, username: user.username, password: user.password })+ await createUser({ url: servers[1].url, accessToken: servers[1].accessToken, username: user.username, password: user.password })const userAccessToken = await userLogin(servers[1], user)const videoAttributes = {@@ -762,12 +762,12 @@ describe('Test multiple servers', function () {{const text = 'my super first comment'- await addVideoCommentThread(servers[ 0 ].url, servers[ 0 ].accessToken, videoUUID, text)+ await addVideoCommentThread(servers[0].url, servers[0].accessToken, videoUUID, text)}{const text = 'my super second comment'- await addVideoCommentThread(servers[ 2 ].url, servers[ 2 ].accessToken, videoUUID, text)+ await addVideoCommentThread(servers[2].url, servers[2].accessToken, videoUUID, text)}await waitJobs(servers)@@ -777,7 +777,7 @@ describe('Test multiple servers', function () {const threadId = res.body.data.find(c => c.text === 'my super first comment').idconst text = 'my super answer to thread 1'- await addVideoCommentReply(servers[ 1 ].url, servers[ 1 ].accessToken, videoUUID, threadId, text)+ await addVideoCommentReply(servers[1].url, servers[1].accessToken, videoUUID, threadId, text)}await waitJobs(servers)@@ -790,10 +790,10 @@ describe('Test multiple servers', function () {const childCommentId = res2.body.children[0].comment.idconst text3 = 'my second answer to thread 1'- await addVideoCommentReply(servers[ 2 ].url, servers[ 2 ].accessToken, videoUUID, threadId, text3)+ await addVideoCommentReply(servers[2].url, servers[2].accessToken, videoUUID, threadId, text3)const text2 = 'my super answer to answer of thread 1'- await addVideoCommentReply(servers[ 2 ].url, servers[ 2 ].accessToken, videoUUID, childCommentId, text2)+ await addVideoCommentReply(servers[2].url, servers[2].accessToken, videoUUID, childCommentId, text2)}await waitJobs(servers)@@ -900,9 +900,9 @@ describe('Test multiple servers', function () {it('Should delete the thread comments', async function () {this.timeout(10000)- const res = await getVideoCommentThreads(servers[ 0 ].url, videoUUID, 0, 5)+ const res = await getVideoCommentThreads(servers[0].url, videoUUID, 0, 5)const threadId = res.body.data.find(c => c.text === 'my super first comment').id- await deleteVideoComment(servers[ 0 ].url, servers[ 0 ].accessToken, videoUUID, threadId)+ await deleteVideoComment(servers[0].url, servers[0].accessToken, videoUUID, threadId)await waitJobs(servers)})@@ -945,9 +945,9 @@ describe('Test multiple servers', function () {it('Should delete a remote thread by the origin server', async function () {this.timeout(5000)- const res = await getVideoCommentThreads(servers[ 0 ].url, videoUUID, 0, 5)+ const res = await getVideoCommentThreads(servers[0].url, videoUUID, 0, 5)const threadId = res.body.data.find(c => c.text === 'my super second comment').id- await deleteVideoComment(servers[ 0 ].url, servers[ 0 ].accessToken, videoUUID, threadId)+ await deleteVideoComment(servers[0].url, servers[0].accessToken, videoUUID, threadId)await waitJobs(servers)})@@ -1021,7 +1021,7 @@ describe('Test multiple servers', function () {const filePath = join(__dirname, '..', '..', 'fixtures', 'video_short.webm')await req.attach('videofile', filePath)- .expect(200)+ .expect(200)await waitJobs(servers)@@ -1046,7 +1046,7 @@ describe('Test multiple servers', function () {duration: 5,commentsEnabled: true,downloadEnabled: true,- tags: [ ],+ tags: [],privacy: VideoPrivacy.PUBLIC,channel: {displayName: 'Main root channel',diff --git a/server/tests/api/videos/services.ts b/server/tests/api/videos/services.tsindex 17172331f9..5505a845a6 100644--- a/server/tests/api/videos/services.ts+++ b/server/tests/api/videos/services.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'@@ -31,8 +31,8 @@ describe('Test services', function () {const res = await getOEmbed(server.url, oembedUrl)const expectedHtml = '<iframe width="560" height="315" sandbox="allow-same-origin allow-scripts" ' +- `src="http://localhost:${server.port}/videos/embed/${server.video.uuid}" ` +- 'frameborder="0" allowfullscreen></iframe>'+ `src="http://localhost:${server.port}/videos/embed/${server.video.uuid}" ` ++ 'frameborder="0" allowfullscreen></iframe>'const expectedThumbnailUrl = 'http://localhost:' + server.port + '/static/previews/' + server.video.uuid + '.jpg'expect(res.body.html).to.equal(expectedHtml)@@ -53,8 +53,8 @@ describe('Test services', function () {const res = await getOEmbed(server.url, oembedUrl, format, maxHeight, maxWidth)const expectedHtml = '<iframe width="50" height="50" sandbox="allow-same-origin allow-scripts" ' +- `src="http://localhost:${server.port}/videos/embed/${server.video.uuid}" ` +- 'frameborder="0" allowfullscreen></iframe>'+ `src="http://localhost:${server.port}/videos/embed/${server.video.uuid}" ` ++ 'frameborder="0" allowfullscreen></iframe>'expect(res.body.html).to.equal(expectedHtml)expect(res.body.title).to.equal(server.video.name)diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.tsindex 362d6b78fb..596fff9965 100644--- a/server/tests/api/videos/single-server.ts+++ b/server/tests/api/videos/single-server.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import { keyBy } from 'lodash'diff --git a/server/tests/api/videos/video-abuse.ts b/server/tests/api/videos/video-abuse.tsindex 0cd6f22c76..cd6df72672 100644--- a/server/tests/api/videos/video-abuse.ts+++ b/server/tests/api/videos/video-abuse.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'@@ -183,9 +183,9 @@ describe('Test video abuses', function () {const accountToBlock = 'root@localhost:' + servers[1].port{- await addAccountToServerBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, accountToBlock)+ await addAccountToServerBlocklist(servers[0].url, servers[0].accessToken, accountToBlock)- const res = await getVideoAbusesList(servers[ 0 ].url, servers[ 0 ].accessToken)+ const res = await getVideoAbusesList(servers[0].url, servers[0].accessToken)expect(res.body.total).to.equal(2)const abuse = res.body.data.find(a => a.reason === 'will mute this')@@ -193,9 +193,9 @@ describe('Test video abuses', function () {}{- await removeAccountFromServerBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, accountToBlock)+ await removeAccountFromServerBlocklist(servers[0].url, servers[0].accessToken, accountToBlock)- const res = await getVideoAbusesList(servers[ 0 ].url, servers[ 0 ].accessToken)+ const res = await getVideoAbusesList(servers[0].url, servers[0].accessToken)expect(res.body.total).to.equal(3)}})@@ -204,9 +204,9 @@ describe('Test video abuses', function () {const serverToBlock = servers[1].host{- await addServerToServerBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, servers[1].host)+ await addServerToServerBlocklist(servers[0].url, servers[0].accessToken, servers[1].host)- const res = await getVideoAbusesList(servers[ 0 ].url, servers[ 0 ].accessToken)+ const res = await getVideoAbusesList(servers[0].url, servers[0].accessToken)expect(res.body.total).to.equal(2)const abuse = res.body.data.find(a => a.reason === 'will mute this')@@ -214,9 +214,9 @@ describe('Test video abuses', function () {}{- await removeServerFromServerBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, serverToBlock)+ await removeServerFromServerBlocklist(servers[0].url, servers[0].accessToken, serverToBlock)- const res = await getVideoAbusesList(servers[ 0 ].url, servers[ 0 ].accessToken)+ const res = await getVideoAbusesList(servers[0].url, servers[0].accessToken)expect(res.body.total).to.equal(3)}})diff --git a/server/tests/api/videos/video-blacklist.ts b/server/tests/api/videos/video-blacklist.tsindex 854b2f0cb5..67bc0114c9 100644--- a/server/tests/api/videos/video-blacklist.ts+++ b/server/tests/api/videos/video-blacklist.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import { orderBy } from 'lodash'@@ -8,7 +8,8 @@ import {cleanupTests,createUser,flushAndRunMultipleServers,- getBlacklistedVideosList, getMyUserInformation,+ getBlacklistedVideosList,+ getMyUserInformation,getMyVideos,getVideosList,killallServers,@@ -17,7 +18,6 @@ import {searchVideo,ServerInfo,setAccessTokensToServers,- setDefaultVideoChannel,updateVideo,updateVideoBlacklist,uploadVideo,@@ -27,7 +27,7 @@ import { doubleFollow } from '../../../../shared/extra-utils/server/follows'import { waitJobs } from '../../../../shared/extra-utils/server/jobs'import { VideoBlacklist, VideoBlacklistType } from '../../../../shared/models/videos'import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model'-import { User, UserRole, UserUpdateMe } from '../../../../shared/models/users'+import { User, UserRole } from '../../../../shared/models/users'import { getMagnetURI, getYoutubeVideoUrl, importVideo } from '../../../../shared/extra-utils/videos/video-imports'const expect = chai.expect@@ -40,7 +40,7 @@ describe('Test video blacklist', function () {const res = await getVideosList(server.url)const videos = res.body.data- for (let video of videos) {+ for (const video of videos) {await addVideoToBlacklist(server.url, server.accessToken, video.id, 'super reason')}}@@ -72,7 +72,7 @@ describe('Test video blacklist', function () {it('Should not have the video blacklisted in videos list/search on server 1', async function () {{- const res = await getVideosList(servers[ 0 ].url)+ const res = await getVideosList(servers[0].url)expect(res.body.total).to.equal(0)expect(res.body.data).to.be.an('array')@@ -80,7 +80,7 @@ describe('Test video blacklist', function () {}{- const res = await searchVideo(servers[ 0 ].url, 'name')+ const res = await searchVideo(servers[0].url, 'name')expect(res.body.total).to.equal(0)expect(res.body.data).to.be.an('array')@@ -90,7 +90,7 @@ describe('Test video blacklist', function () {it('Should have the blacklisted video in videos list/search on server 2', async function () {{- const res = await getVideosList(servers[ 1 ].url)+ const res = await getVideosList(servers[1].url)expect(res.body.total).to.equal(2)expect(res.body.data).to.be.an('array')@@ -98,7 +98,7 @@ describe('Test video blacklist', function () {}{- const res = await searchVideo(servers[ 1 ].url, 'video')+ const res = await searchVideo(servers[1].url, 'video')expect(res.body.total).to.equal(2)expect(res.body.data).to.be.an('array')@@ -125,8 +125,8 @@ describe('Test video blacklist', function () {it('Should display all the blacklisted videos when applying manual type filter', async function () {const res = await getBlacklistedVideosList({- url: servers[ 0 ].url,- token: servers[ 0 ].accessToken,+ url: servers[0].url,+ token: servers[0].accessToken,type: VideoBlacklistType.MANUAL})@@ -139,8 +139,8 @@ describe('Test video blacklist', function () {it('Should display nothing when applying automatic type filter', async function () {const res = await getBlacklistedVideosList({- url: servers[ 0 ].url,- token: servers[ 0 ].accessToken,+ url: servers[0].url,+ token: servers[0].accessToken,type: VideoBlacklistType.AUTO_BEFORE_PUBLISHED})@@ -152,7 +152,7 @@ describe('Test video blacklist', function () {})it('Should get the correct sort when sorting by descending id', async function () {- const res = await getBlacklistedVideosList({ url: servers[ 0 ].url, token: servers[ 0 ].accessToken, sort: '-id' })+ const res = await getBlacklistedVideosList({ url: servers[0].url, token: servers[0].accessToken, sort: '-id' })expect(res.body.total).to.equal(2)const blacklistedVideos = res.body.data@@ -165,7 +165,7 @@ describe('Test video blacklist', function () {})it('Should get the correct sort when sorting by descending video name', async function () {- const res = await getBlacklistedVideosList({ url: servers[ 0 ].url, token: servers[ 0 ].accessToken, sort: '-name' })+ const res = await getBlacklistedVideosList({ url: servers[0].url, token: servers[0].accessToken, sort: '-name' })expect(res.body.total).to.equal(2)const blacklistedVideos = res.body.data@@ -178,7 +178,7 @@ describe('Test video blacklist', function () {})it('Should get the correct sort when sorting by ascending creation date', async function () {- const res = await getBlacklistedVideosList({ url: servers[ 0 ].url, token: servers[ 0 ].accessToken, sort: 'createdAt' })+ const res = await getBlacklistedVideosList({ url: servers[0].url, token: servers[0].accessToken, sort: 'createdAt' })expect(res.body.total).to.equal(2)const blacklistedVideos = res.body.data@@ -195,7 +195,7 @@ describe('Test video blacklist', function () {it('Should change the reason', async function () {await updateVideoBlacklist(servers[0].url, servers[0].accessToken, videoId, 'my super reason updated')- const res = await getBlacklistedVideosList({ url: servers[ 0 ].url, token: servers[ 0 ].accessToken, sort: '-name' })+ const res = await getBlacklistedVideosList({ url: servers[0].url, token: servers[0].accessToken, sort: '-name' })const video = res.body.data.find(b => b.video.id === videoId)expect(video.reason).to.equal('my super reason updated')@@ -231,7 +231,7 @@ describe('Test video blacklist', function () {it('Should remove a video from the blacklist on server 1', async function () {// Get one video in the blacklist- const res = await getBlacklistedVideosList({ url: servers[ 0 ].url, token: servers[ 0 ].accessToken, sort: '-name' })+ const res = await getBlacklistedVideosList({ url: servers[0].url, token: servers[0].accessToken, sort: '-name' })videoToRemove = res.body.data[0]blacklist = res.body.data.slice(1)@@ -252,7 +252,7 @@ describe('Test video blacklist', function () {})it('Should not have the ex-blacklisted video in videos blacklist list on server 1', async function () {- const res = await getBlacklistedVideosList({ url: servers[ 0 ].url, token: servers[ 0 ].accessToken, sort: '-name' })+ const res = await getBlacklistedVideosList({ url: servers[0].url, token: servers[0].accessToken, sort: '-name' })expect(res.body.total).to.equal(1)const videos = res.body.data@@ -274,7 +274,7 @@ describe('Test video blacklist', function () {video3UUID = res.body.video.uuid}{- const res = await uploadVideo(servers[ 0 ].url, servers[ 0 ].accessToken, { name: 'Video 4' })+ const res = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'Video 4' })video4UUID = res.body.video.uuid}@@ -284,17 +284,17 @@ describe('Test video blacklist', function () {it('Should blacklist video 3 and keep it federated', async function () {this.timeout(10000)- await addVideoToBlacklist(servers[ 0 ].url, servers[ 0 ].accessToken, video3UUID, 'super reason', false)+ await addVideoToBlacklist(servers[0].url, servers[0].accessToken, video3UUID, 'super reason', false)await waitJobs(servers){- const res = await getVideosList(servers[ 0 ].url)+ const res = await getVideosList(servers[0].url)expect(res.body.data.find(v => v.uuid === video3UUID)).to.be.undefined}{- const res = await getVideosList(servers[ 1 ].url)+ const res = await getVideosList(servers[1].url)expect(res.body.data.find(v => v.uuid === video3UUID)).to.not.be.undefined}})@@ -302,7 +302,7 @@ describe('Test video blacklist', function () {it('Should unfederate the video', async function () {this.timeout(10000)- await addVideoToBlacklist(servers[ 0 ].url, servers[ 0 ].accessToken, video4UUID, 'super reason', true)+ await addVideoToBlacklist(servers[0].url, servers[0].accessToken, video4UUID, 'super reason', true)await waitJobs(servers)@@ -315,7 +315,7 @@ describe('Test video blacklist', function () {it('Should have the video unfederated even after an Update AP message', async function () {this.timeout(10000)- await updateVideo(servers[ 0 ].url, servers[ 0 ].accessToken, video4UUID, { description: 'super description' })+ await updateVideo(servers[0].url, servers[0].accessToken, video4UUID, { description: 'super description' })await waitJobs(servers)@@ -326,7 +326,7 @@ describe('Test video blacklist', function () {})it('Should have the correct video blacklist unfederate attribute', async function () {- const res = await getBlacklistedVideosList({ url: servers[ 0 ].url, token: servers[ 0 ].accessToken, sort: 'createdAt' })+ const res = await getBlacklistedVideosList({ url: servers[0].url, token: servers[0].accessToken, sort: 'createdAt' })const blacklistedVideos: VideoBlacklist[] = res.body.dataconst video3Blacklisted = blacklistedVideos.find(b => b.video.uuid === video3UUID)@@ -339,7 +339,7 @@ describe('Test video blacklist', function () {it('Should remove the video from blacklist and refederate the video', async function () {this.timeout(10000)- await removeVideoFromBlacklist(servers[ 0 ].url, servers[ 0 ].accessToken, video4UUID)+ await removeVideoFromBlacklist(servers[0].url, servers[0].accessToken, video4UUID)await waitJobs(servers)@@ -362,9 +362,9 @@ describe('Test video blacklist', function () {killallServers([ servers[0] ])const config = {- 'auto_blacklist': {+ auto_blacklist: {videos: {- 'of_users': {+ of_users: {enabled: true}}@@ -375,8 +375,8 @@ describe('Test video blacklist', function () {{const user = { username: 'user_without_flag', password: 'password' }await createUser({- url: servers[ 0 ].url,- accessToken: servers[ 0 ].accessToken,+ url: servers[0].url,+ accessToken: servers[0].accessToken,username: user.username,adminFlags: UserAdminFlag.NONE,password: user.password,@@ -393,8 +393,8 @@ describe('Test video blacklist', function () {{const user = { username: 'user_with_flag', password: 'password' }await createUser({- url: servers[ 0 ].url,- accessToken: servers[ 0 ].accessToken,+ url: servers[0].url,+ accessToken: servers[0].accessToken,username: user.username,adminFlags: UserAdminFlag.BY_PASS_VIDEO_AUTO_BLACKLIST,password: user.password,@@ -411,8 +411,8 @@ describe('Test video blacklist', function () {await uploadVideo(servers[0].url, userWithoutFlag, { name: 'blacklisted' })const res = await getBlacklistedVideosList({- url: servers[ 0 ].url,- token: servers[ 0 ].accessToken,+ url: servers[0].url,+ token: servers[0].accessToken,type: VideoBlacklistType.AUTO_BEFORE_PUBLISHED})@@ -428,11 +428,11 @@ describe('Test video blacklist', function () {name: 'URL import',channelId: channelOfUserWithoutFlag}- await importVideo(servers[ 0 ].url, userWithoutFlag, attributes)+ await importVideo(servers[0].url, userWithoutFlag, attributes)const res = await getBlacklistedVideosList({- url: servers[ 0 ].url,- token: servers[ 0 ].accessToken,+ url: servers[0].url,+ token: servers[0].accessToken,sort: 'createdAt',type: VideoBlacklistType.AUTO_BEFORE_PUBLISHED})@@ -447,11 +447,11 @@ describe('Test video blacklist', function () {name: 'Torrent import',channelId: channelOfUserWithoutFlag}- await importVideo(servers[ 0 ].url, userWithoutFlag, attributes)+ await importVideo(servers[0].url, userWithoutFlag, attributes)const res = await getBlacklistedVideosList({- url: servers[ 0 ].url,- token: servers[ 0 ].accessToken,+ url: servers[0].url,+ token: servers[0].accessToken,sort: 'createdAt',type: VideoBlacklistType.AUTO_BEFORE_PUBLISHED})@@ -464,8 +464,8 @@ describe('Test video blacklist', function () {await uploadVideo(servers[0].url, userWithFlag, { name: 'not blacklisted' })const res = await getBlacklistedVideosList({- url: servers[ 0 ].url,- token: servers[ 0 ].accessToken,+ url: servers[0].url,+ token: servers[0].accessToken,type: VideoBlacklistType.AUTO_BEFORE_PUBLISHED})diff --git a/server/tests/api/videos/video-captions.ts b/server/tests/api/videos/video-captions.tsindex 5e13f59490..b4ecb39f49 100644--- a/server/tests/api/videos/video-captions.ts+++ b/server/tests/api/videos/video-captions.ts@@ -1,16 +1,17 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'import {- checkVideoFilesWereRemoved, cleanupTests,+ checkVideoFilesWereRemoved,+ cleanupTests,doubleFollow,flushAndRunMultipleServers,removeVideo,uploadVideo,wait} from '../../../../shared/extra-utils'-import { flushTests, killallServers, ServerInfo, setAccessTokensToServers } from '../../../../shared/extra-utils/index'+import { ServerInfo, setAccessTokensToServers } from '../../../../shared/extra-utils/index'import { waitJobs } from '../../../../shared/extra-utils/server/jobs'import {createVideoCaption,@@ -36,7 +37,7 @@ describe('Test video captions', function () {await waitJobs(servers)- const res = await uploadVideo(servers[ 0 ].url, servers[ 0 ].accessToken, { name: 'my video name' })+ const res = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'my video name' })videoUUID = res.body.video.uuidawait waitJobs(servers)diff --git a/server/tests/api/videos/video-change-ownership.ts b/server/tests/api/videos/video-change-ownership.tsindex 64ee2355af..dee6575b92 100644--- a/server/tests/api/videos/video-change-ownership.ts+++ b/server/tests/api/videos/video-change-ownership.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'@@ -38,7 +38,7 @@ describe('Test video change ownership - nominal', function () {}let firstUserAccessToken = ''let secondUserAccessToken = ''- let lastRequestChangeOwnershipId = undefined+ let lastRequestChangeOwnershipId = ''before(async function () {this.timeout(50000)@@ -48,15 +48,15 @@ describe('Test video change ownership - nominal', function () {const videoQuota = 42000000await createUser({- url: servers[ 0 ].url,- accessToken: servers[ 0 ].accessToken,+ url: servers[0].url,+ accessToken: servers[0].accessToken,username: firstUser.username,password: firstUser.password,videoQuota: videoQuota})await createUser({- url: servers[ 0 ].url,- accessToken: servers[ 0 ].accessToken,+ url: servers[0].url,+ accessToken: servers[0].accessToken,username: secondUser.username,password: secondUser.password,videoQuota: videoQuota@@ -209,7 +209,7 @@ describe('Test video change ownership - nominal', function () {})describe('Test video change ownership - quota too small', function () {- let server: ServerInfo = undefined+ let server: ServerInfoconst firstUser = {username: 'first',password: 'My great password'@@ -220,14 +220,14 @@ describe('Test video change ownership - quota too small', function () {}let firstUserAccessToken = ''let secondUserAccessToken = ''- let lastRequestChangeOwnershipId = undefined+ let lastRequestChangeOwnershipId = ''before(async function () {this.timeout(50000)// Run one serverserver = await flushAndRunServer(1)- await setAccessTokensToServers([server])+ await setAccessTokensToServers([ server ])const videoQuota = 42000000const limitedVideoQuota = 10diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.tsindex 4f600cae8e..f3a23bf171 100644--- a/server/tests/api/videos/video-channels.ts+++ b/server/tests/api/videos/video-channels.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'@@ -7,7 +7,8 @@ import {cleanupTests,createUser,doubleFollow,- flushAndRunMultipleServers, getVideo,+ flushAndRunMultipleServers,+ getVideo,getVideoChannelVideos,testImage,updateVideo,@@ -73,14 +74,14 @@ describe('Test video channels', function () {description: 'super video channel description',support: 'super video channel support text'}- const res = await addVideoChannel(servers[ 0 ].url, servers[ 0 ].accessToken, videoChannel)+ const res = await addVideoChannel(servers[0].url, servers[0].accessToken, videoChannel)secondVideoChannelId = res.body.videoChannel.id}// The channel is 1 is propagated to servers 2{const videoAttributesArg = { name: 'my video name', channelId: secondVideoChannelId, support: 'video support field' }- const res = await uploadVideo(servers[ 0 ].url, servers[ 0 ].accessToken, videoAttributesArg)+ const res = await uploadVideo(servers[0].url, servers[0].accessToken, videoAttributesArg)videoUUID = res.body.video.uuid}@@ -106,7 +107,7 @@ describe('Test video channels', function () {it('Should have two video channels when getting account channels on server 1', async function () {const res = await getAccountVideoChannelsList({- url: servers[ 0 ].url,+ url: servers[0].url,accountName: userInfo.account.name + '@' + userInfo.account.host})@@ -127,7 +128,7 @@ describe('Test video channels', function () {it('Should paginate and sort account channels', async function () {{const res = await getAccountVideoChannelsList({- url: servers[ 0 ].url,+ url: servers[0].url,accountName: userInfo.account.name + '@' + userInfo.account.host,start: 0,count: 1,@@ -137,13 +138,13 @@ describe('Test video channels', function () {expect(res.body.total).to.equal(2)expect(res.body.data).to.have.lengthOf(1)- const videoChannel: VideoChannel = res.body.data[ 0 ]+ const videoChannel: VideoChannel = res.body.data[0]expect(videoChannel.name).to.equal('root_channel')}{const res = await getAccountVideoChannelsList({- url: servers[ 0 ].url,+ url: servers[0].url,accountName: userInfo.account.name + '@' + userInfo.account.host,start: 0,count: 1,@@ -153,13 +154,13 @@ describe('Test video channels', function () {expect(res.body.total).to.equal(2)expect(res.body.data).to.have.lengthOf(1)- const videoChannel: VideoChannel = res.body.data[ 0 ]+ const videoChannel: VideoChannel = res.body.data[0]expect(videoChannel.name).to.equal('second_video_channel')}{const res = await getAccountVideoChannelsList({- url: servers[ 0 ].url,+ url: servers[0].url,accountName: userInfo.account.name + '@' + userInfo.account.host,start: 1,count: 1,@@ -169,14 +170,14 @@ describe('Test video channels', function () {expect(res.body.total).to.equal(2)expect(res.body.data).to.have.lengthOf(1)- const videoChannel: VideoChannel = res.body.data[ 0 ]+ const videoChannel: VideoChannel = res.body.data[0]expect(videoChannel.name).to.equal('root_channel')}})it('Should have one video channel when getting account channels on server 2', async function () {const res = await getAccountVideoChannelsList({- url: servers[ 1 ].url,+ url: servers[1].url,accountName: userInfo.account.name + '@' + userInfo.account.host})@@ -349,15 +350,15 @@ describe('Test video channels', function () {it('Should create the main channel with an uuid if there is a conflict', async function () {{const videoChannel = { name: 'toto_channel', displayName: 'My toto channel' }- await addVideoChannel(servers[ 0 ].url, servers[ 0 ].accessToken, videoChannel)+ await addVideoChannel(servers[0].url, servers[0].accessToken, videoChannel)}{- await createUser({ url: servers[ 0 ].url, accessToken: servers[ 0 ].accessToken, username: 'toto', password: 'password' })- const accessToken = await userLogin(servers[ 0 ], { username: 'toto', password: 'password' })+ await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: 'toto', password: 'password' })+ const accessToken = await userLogin(servers[0], { username: 'toto', password: 'password' })- const res = await getMyUserInformation(servers[ 0 ].url, accessToken)- const videoChannel = res.body.videoChannels[ 0 ]+ const res = await getMyUserInformation(servers[0].url, accessToken)+ const videoChannel = res.body.videoChannels[0]expect(videoChannel.name).to.match(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/)}})diff --git a/server/tests/api/videos/video-comments.ts b/server/tests/api/videos/video-comments.tsindex 06e4ff9c82..afb58e95a3 100644--- a/server/tests/api/videos/video-comments.ts+++ b/server/tests/api/videos/video-comments.ts@@ -1,17 +1,17 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'import { cleanupTests, testImage } from '../../../../shared/extra-utils'import {+ createUser,dateIsValid,flushAndRunServer,+ getAccessToken,ServerInfo,setAccessTokensToServers,updateMyAvatar,- getAccessToken,- createUser,uploadVideo} from '../../../../shared/extra-utils/index'import {diff --git a/server/tests/api/videos/video-description.ts b/server/tests/api/videos/video-description.tsindex db4d278bf1..b8e98e45f1 100644--- a/server/tests/api/videos/video-description.ts+++ b/server/tests/api/videos/video-description.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'@@ -8,7 +8,6 @@ import {getVideo,getVideoDescription,getVideosList,- killallServers,ServerInfo,setAccessTokensToServers,updateVideo,@@ -23,7 +22,7 @@ describe('Test video description', function () {let servers: ServerInfo[] = []let videoUUID = ''let videoId: number- let longDescription = 'my super description for server 1'.repeat(50)+ const longDescription = 'my super description for server 1'.repeat(50)before(async function () {this.timeout(40000)@@ -61,7 +60,7 @@ describe('Test video description', function () {// 30 characters * 6 -> 240 charactersconst truncatedDescription = 'my super description for server 1'.repeat(7) +- 'my super descrip...'+ 'my super descrip...'expect(video.description).to.equal(truncatedDescription)}diff --git a/server/tests/api/videos/video-hls.ts b/server/tests/api/videos/video-hls.tsindex bde3b56569..6555bc8b67 100644--- a/server/tests/api/videos/video-hls.ts+++ b/server/tests/api/videos/video-hls.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'@@ -10,13 +10,16 @@ import {doubleFollow,flushAndRunMultipleServers,getPlaylist,- getVideo, makeGetRequest, makeRawRequest,+ getVideo,+ makeRawRequest,removeVideo,ServerInfo,- setAccessTokensToServers, updateCustomSubConfig,+ setAccessTokensToServers,+ updateCustomSubConfig,updateVideo,uploadVideo,- waitJobs, webtorrentAdd+ waitJobs,+ webtorrentAdd} from '../../../../shared/extra-utils'import { VideoDetails } from '../../../../shared/models/videos'import { VideoStreamingPlaylistType } from '../../../../shared/models/videos/video-streaming-playlist.type'@@ -48,7 +51,9 @@ async function checkHlsPlaylist (servers: ServerInfo[], videoUUID: string, hlsOnexpect(file.magnetUri).to.have.lengthOf.above(2)expect(file.torrentUrl).to.equal(`${baseUrl}/static/torrents/${videoDetails.uuid}-${file.resolution.id}-hls.torrent`)- expect(file.fileUrl).to.equal(`${baseUrl}/static/streaming-playlists/hls/${videoDetails.uuid}/${videoDetails.uuid}-${file.resolution.id}-fragmented.mp4`)+ expect(file.fileUrl).to.equal(+ `${baseUrl}/static/streaming-playlists/hls/${videoDetails.uuid}/${videoDetails.uuid}-${file.resolution.id}-fragmented.mp4`+ )expect(file.resolution.label).to.equal(resolution + 'p')await makeRawRequest(file.torrentUrl, 200)@@ -66,7 +71,9 @@ async function checkHlsPlaylist (servers: ServerInfo[], videoUUID: string, hlsOnconst masterPlaylist = res.textfor (const resolution of resolutions) {- const reg = new RegExp('#EXT-X-STREAM-INF:BANDWIDTH=\\d+,RESOLUTION=\\d+x' + resolution + ',FRAME-RATE=\\d+,CODECS="avc1.64001f,mp4a.40.2"')+ const reg = new RegExp(+ '#EXT-X-STREAM-INF:BANDWIDTH=\\d+,RESOLUTION=\\d+x' + resolution + ',FRAME-RATE=\\d+,CODECS="avc1.64001f,mp4a.40.2"'+ )expect(masterPlaylist).to.match(reg)expect(masterPlaylist).to.contain(`${resolution}.m3u8`)@@ -102,7 +109,7 @@ describe('Test HLS videos', function () {it('Should upload a video and transcode it to HLS', async function () {this.timeout(120000)- const res = await uploadVideo(servers[ 0 ].url, servers[ 0 ].accessToken, { name: 'video 1', fixture: 'video_short.webm' })+ const res = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video 1', fixture: 'video_short.webm' })videoUUID = res.body.video.uuidawait waitJobs(servers)@@ -113,7 +120,7 @@ describe('Test HLS videos', function () {it('Should upload an audio file and transcode it to HLS', async function () {this.timeout(120000)- const res = await uploadVideo(servers[ 0 ].url, servers[ 0 ].accessToken, { name: 'video audio', fixture: 'sample.ogg' })+ const res = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video audio', fixture: 'sample.ogg' })videoAudioUUID = res.body.video.uuidawait waitJobs(servers)@@ -124,7 +131,7 @@ describe('Test HLS videos', function () {it('Should update the video', async function () {this.timeout(10000)- await updateVideo(servers[ 0 ].url, servers[ 0 ].accessToken, videoUUID, { name: 'video 1 updated' })+ await updateVideo(servers[0].url, servers[0].accessToken, videoUUID, { name: 'video 1 updated' })await waitJobs(servers)@@ -134,8 +141,8 @@ describe('Test HLS videos', function () {it('Should delete videos', async function () {this.timeout(10000)- await removeVideo(servers[ 0 ].url, servers[ 0 ].accessToken, videoUUID)- await removeVideo(servers[ 0 ].url, servers[ 0 ].accessToken, videoAudioUUID)+ await removeVideo(servers[0].url, servers[0].accessToken, videoUUID)+ await removeVideo(servers[0].url, servers[0].accessToken, videoAudioUUID)await waitJobs(servers)diff --git a/server/tests/api/videos/video-imports.ts b/server/tests/api/videos/video-imports.tsindex 1233ed6eb9..a67e528c6c 100644--- a/server/tests/api/videos/video-imports.ts+++ b/server/tests/api/videos/video-imports.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'@@ -12,12 +12,11 @@ import {getVideo,getVideosList,immutableAssign,- killallServers,ServerInfo,setAccessTokensToServers} from '../../../../shared/extra-utils'import { waitJobs } from '../../../../shared/extra-utils/server/jobs'-import { getMagnetURI, getYoutubeVideoUrl, importVideo, getMyVideoImports } from '../../../../shared/extra-utils/videos/video-imports'+import { getMagnetURI, getMyVideoImports, getYoutubeVideoUrl, importVideo } from '../../../../shared/extra-utils/videos/video-imports'const expect = chai.expect@@ -88,12 +87,12 @@ describe('Test video imports', function () {{const res = await getMyUserInformation(servers[0].url, servers[0].accessToken)- channelIdServer1 = res.body.videoChannels[ 0 ].id+ channelIdServer1 = res.body.videoChannels[0].id}{const res = await getMyUserInformation(servers[1].url, servers[1].accessToken)- channelIdServer2 = res.body.videoChannels[ 0 ].id+ channelIdServer2 = res.body.videoChannels[0].id}await doubleFollow(servers[0], servers[1])@@ -214,7 +213,7 @@ describe('Test video imports', function () {await checkVideoServer2(server.url, res.body.data[0].uuid)- const [ ,videoHttp, videoMagnet, videoTorrent ] = res.body.data+ const [ , videoHttp, videoMagnet, videoTorrent ] = res.body.dataawait checkVideosServer1(server.url, videoHttp.uuid, videoMagnet.uuid, videoTorrent.uuid)}})diff --git a/server/tests/api/videos/video-nsfw.ts b/server/tests/api/videos/video-nsfw.tsindex ad6a4b43f3..7eba8d7d9e 100644--- a/server/tests/api/videos/video-nsfw.ts+++ b/server/tests/api/videos/video-nsfw.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'@@ -89,8 +89,8 @@ describe('Test video NSFW policy', function () {const videos = res.body.dataexpect(videos).to.have.lengthOf(2)- expect(videos[ 0 ].name).to.equal('normal')- expect(videos[ 1 ].name).to.equal('nsfw')+ expect(videos[0].name).to.equal('normal')+ expect(videos[1].name).to.equal('nsfw')}})@@ -107,7 +107,7 @@ describe('Test video NSFW policy', function () {const videos = res.body.dataexpect(videos).to.have.lengthOf(1)- expect(videos[ 0 ].name).to.equal('normal')+ expect(videos[0].name).to.equal('normal')}})@@ -124,8 +124,8 @@ describe('Test video NSFW policy', function () {const videos = res.body.dataexpect(videos).to.have.lengthOf(2)- expect(videos[ 0 ].name).to.equal('normal')- expect(videos[ 1 ].name).to.equal('nsfw')+ expect(videos[0].name).to.equal('normal')+ expect(videos[1].name).to.equal('nsfw')}})})@@ -154,8 +154,8 @@ describe('Test video NSFW policy', function () {const videos = res.body.dataexpect(videos).to.have.lengthOf(2)- expect(videos[ 0 ].name).to.equal('normal')- expect(videos[ 1 ].name).to.equal('nsfw')+ expect(videos[0].name).to.equal('normal')+ expect(videos[1].name).to.equal('nsfw')}})@@ -171,8 +171,8 @@ describe('Test video NSFW policy', function () {const videos = res.body.dataexpect(videos).to.have.lengthOf(2)- expect(videos[ 0 ].name).to.equal('normal')- expect(videos[ 1 ].name).to.equal('nsfw')+ expect(videos[0].name).to.equal('normal')+ expect(videos[1].name).to.equal('nsfw')}})@@ -188,7 +188,7 @@ describe('Test video NSFW policy', function () {const videos = res.body.dataexpect(videos).to.have.lengthOf(1)- expect(videos[ 0 ].name).to.equal('normal')+ expect(videos[0].name).to.equal('normal')}})@@ -198,8 +198,8 @@ describe('Test video NSFW policy', function () {const videos = res.body.dataexpect(videos).to.have.lengthOf(2)- expect(videos[ 0 ].name).to.equal('normal')- expect(videos[ 1 ].name).to.equal('nsfw')+ expect(videos[0].name).to.equal('normal')+ expect(videos[1].name).to.equal('nsfw')})it('Should display NSFW videos when the nsfw param === true', async function () {@@ -208,7 +208,7 @@ describe('Test video NSFW policy', function () {const videos = res.body.dataexpect(videos).to.have.lengthOf(1)- expect(videos[ 0 ].name).to.equal('nsfw')+ expect(videos[0].name).to.equal('nsfw')}})@@ -218,7 +218,7 @@ describe('Test video NSFW policy', function () {const videos = res.body.dataexpect(videos).to.have.lengthOf(1)- expect(videos[ 0 ].name).to.equal('normal')+ expect(videos[0].name).to.equal('normal')}})@@ -228,8 +228,8 @@ describe('Test video NSFW policy', function () {const videos = res.body.dataexpect(videos).to.have.lengthOf(2)- expect(videos[ 0 ].name).to.equal('normal')- expect(videos[ 1 ].name).to.equal('nsfw')+ expect(videos[0].name).to.equal('normal')+ expect(videos[1].name).to.equal('nsfw')}})})diff --git a/server/tests/api/videos/video-playlist-thumbnails.ts b/server/tests/api/videos/video-playlist-thumbnails.tsindex 73ab02c17b..a93a0b7de8 100644--- a/server/tests/api/videos/video-playlist-thumbnails.ts+++ b/server/tests/api/videos/video-playlist-thumbnails.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'@@ -8,14 +8,15 @@ import {createVideoPlaylist,doubleFollow,flushAndRunMultipleServers,- getVideoPlaylistsList, removeVideoFromPlaylist,+ getVideoPlaylistsList,+ removeVideoFromPlaylist,+ reorderVideosPlaylist,ServerInfo,setAccessTokensToServers,setDefaultVideoChannel,testImage,uploadVideoAndGetId,- waitJobs,- reorderVideosPlaylist+ waitJobs} from '../../../../shared/extra-utils'import { VideoPlaylistPrivacy } from '../../../../shared/models/videos/playlist/video-playlist-privacy.model'@@ -69,19 +70,19 @@ describe('Playlist thumbnail', function () {this.timeout(30000)const res = await createVideoPlaylist({- url: servers[ 1 ].url,- token: servers[ 1 ].accessToken,+ url: servers[1].url,+ token: servers[1].accessToken,playlistAttrs: {displayName: 'playlist without thumbnail',privacy: VideoPlaylistPrivacy.PUBLIC,- videoChannelId: servers[ 1 ].videoChannel.id+ videoChannelId: servers[1].videoChannel.id}})playlistWithoutThumbnail = res.body.videoPlaylist.idconst res2 = await addVideoInPlaylist({- url: servers[ 1 ].url,- token: servers[ 1 ].accessToken,+ url: servers[1].url,+ token: servers[1].accessToken,playlistId: playlistWithoutThumbnail,elementAttrs: { videoId: video1 }})@@ -99,20 +100,20 @@ describe('Playlist thumbnail', function () {this.timeout(30000)const res = await createVideoPlaylist({- url: servers[ 1 ].url,- token: servers[ 1 ].accessToken,+ url: servers[1].url,+ token: servers[1].accessToken,playlistAttrs: {displayName: 'playlist with thumbnail',privacy: VideoPlaylistPrivacy.PUBLIC,- videoChannelId: servers[ 1 ].videoChannel.id,+ videoChannelId: servers[1].videoChannel.id,thumbnailfile: 'thumbnail.jpg'}})playlistWithThumbnail = res.body.videoPlaylist.idconst res2 = await addVideoInPlaylist({- url: servers[ 1 ].url,- token: servers[ 1 ].accessToken,+ url: servers[1].url,+ token: servers[1].accessToken,playlistId: playlistWithThumbnail,elementAttrs: { videoId: video1 }})@@ -130,8 +131,8 @@ describe('Playlist thumbnail', function () {this.timeout(30000)const res = await addVideoInPlaylist({- url: servers[ 1 ].url,- token: servers[ 1 ].accessToken,+ url: servers[1].url,+ token: servers[1].accessToken,playlistId: playlistWithoutThumbnail,elementAttrs: { videoId: video2 }})@@ -159,8 +160,8 @@ describe('Playlist thumbnail', function () {this.timeout(30000)const res = await addVideoInPlaylist({- url: servers[ 1 ].url,- token: servers[ 1 ].accessToken,+ url: servers[1].url,+ token: servers[1].accessToken,playlistId: playlistWithThumbnail,elementAttrs: { videoId: video2 }})@@ -188,8 +189,8 @@ describe('Playlist thumbnail', function () {this.timeout(30000)await removeVideoFromPlaylist({- url: servers[ 1 ].url,- token: servers[ 1 ].accessToken,+ url: servers[1].url,+ token: servers[1].accessToken,playlistId: playlistWithoutThumbnail,playlistElementId: withoutThumbnailE1})@@ -206,8 +207,8 @@ describe('Playlist thumbnail', function () {this.timeout(30000)await removeVideoFromPlaylist({- url: servers[ 1 ].url,- token: servers[ 1 ].accessToken,+ url: servers[1].url,+ token: servers[1].accessToken,playlistId: playlistWithThumbnail,playlistElementId: withThumbnailE1})@@ -224,8 +225,8 @@ describe('Playlist thumbnail', function () {this.timeout(30000)await removeVideoFromPlaylist({- url: servers[ 1 ].url,- token: servers[ 1 ].accessToken,+ url: servers[1].url,+ token: servers[1].accessToken,playlistId: playlistWithoutThumbnail,playlistElementId: withoutThumbnailE2})@@ -242,8 +243,8 @@ describe('Playlist thumbnail', function () {this.timeout(30000)await removeVideoFromPlaylist({- url: servers[ 1 ].url,- token: servers[ 1 ].accessToken,+ url: servers[1].url,+ token: servers[1].accessToken,playlistId: playlistWithThumbnail,playlistElementId: withThumbnailE2})diff --git a/server/tests/api/videos/video-playlists.ts b/server/tests/api/videos/video-playlists.tsindex 9fd48ac7c0..2bb97d7a8b 100644--- a/server/tests/api/videos/video-playlists.ts+++ b/server/tests/api/videos/video-playlists.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'@@ -141,12 +141,12 @@ describe('Test video playlists', function () {servers[2].videos = await Promise.all(serverPromises[2])}- nsfwVideoServer1 = (await uploadVideoAndGetId({ server: servers[ 0 ], videoName: 'NSFW video', nsfw: true })).id+ nsfwVideoServer1 = (await uploadVideoAndGetId({ server: servers[0], videoName: 'NSFW video', nsfw: true })).id{await createUser({- url: servers[ 0 ].url,- accessToken: servers[ 0 ].accessToken,+ url: servers[0].url,+ accessToken: servers[0].accessToken,username: 'user1',password: 'password'})@@ -158,17 +158,17 @@ describe('Test video playlists', function () {describe('Get default playlists', function () {it('Should list video playlist privacies', async function () {- const res = await getVideoPlaylistPrivacies(servers[ 0 ].url)+ const res = await getVideoPlaylistPrivacies(servers[0].url)const privacies = res.bodyexpect(Object.keys(privacies)).to.have.length.at.least(3)- expect(privacies[ 3 ]).to.equal('Private')+ expect(privacies[3]).to.equal('Private')})it('Should list watch later playlist', async function () {- const url = servers[ 0 ].url- const accessToken = servers[ 0 ].accessToken+ const url = servers[0].url+ const accessToken = servers[0].accessToken{const res = await getAccountPlaylistsListWithToken(url, accessToken, 'root', 0, 5, VideoPlaylistType.WATCH_LATER)@@ -176,7 +176,7 @@ describe('Test video playlists', function () {expect(res.body.total).to.equal(1)expect(res.body.data).to.have.lengthOf(1)- const playlist: VideoPlaylist = res.body.data[ 0 ]+ const playlist: VideoPlaylist = res.body.data[0]expect(playlist.displayName).to.equal('Watch later')expect(playlist.type.id).to.equal(VideoPlaylistType.WATCH_LATER)expect(playlist.type.label).to.equal('Watch later')@@ -197,15 +197,15 @@ describe('Test video playlists', function () {})it('Should get private playlist for a classic user', async function () {- const token = await generateUserAccessToken(servers[ 0 ], 'toto')+ const token = await generateUserAccessToken(servers[0], 'toto')- const res = await getAccountPlaylistsListWithToken(servers[ 0 ].url, token, 'toto', 0, 5)+ const res = await getAccountPlaylistsListWithToken(servers[0].url, token, 'toto', 0, 5)expect(res.body.total).to.equal(1)expect(res.body.data).to.have.lengthOf(1)- const playlistId = res.body.data[ 0 ].id- await getPlaylistVideos(servers[ 0 ].url, token, playlistId, 0, 5)+ const playlistId = res.body.data[0].id+ await getPlaylistVideos(servers[0].url, token, playlistId, 0, 5)})})@@ -215,14 +215,14 @@ describe('Test video playlists', function () {this.timeout(30000)await createVideoPlaylist({- url: servers[ 0 ].url,- token: servers[ 0 ].accessToken,+ url: servers[0].url,+ token: servers[0].accessToken,playlistAttrs: {displayName: 'my super playlist',privacy: VideoPlaylistPrivacy.PUBLIC,description: 'my super description',thumbnailfile: 'thumbnail.jpg',- videoChannelId: servers[ 0 ].videoChannel.id+ videoChannelId: servers[0].videoChannel.id}})@@ -233,7 +233,7 @@ describe('Test video playlists', function () {expect(res.body.total).to.equal(1)expect(res.body.data).to.have.lengthOf(1)- const playlistFromList = res.body.data[ 0 ] as VideoPlaylist+ const playlistFromList = res.body.data[0] as VideoPlaylistconst res2 = await getVideoPlaylist(server.url, playlistFromList.uuid)const playlistFromGet = res2.body@@ -266,12 +266,12 @@ describe('Test video playlists', function () {{const res = await createVideoPlaylist({- url: servers[ 1 ].url,- token: servers[ 1 ].accessToken,+ url: servers[1].url,+ token: servers[1].accessToken,playlistAttrs: {displayName: 'playlist 2',privacy: VideoPlaylistPrivacy.PUBLIC,- videoChannelId: servers[ 1 ].videoChannel.id+ videoChannelId: servers[1].videoChannel.id}})playlistServer2Id1 = res.body.videoPlaylist.id@@ -279,13 +279,13 @@ describe('Test video playlists', function () {{const res = await createVideoPlaylist({- url: servers[ 1 ].url,- token: servers[ 1 ].accessToken,+ url: servers[1].url,+ token: servers[1].accessToken,playlistAttrs: {displayName: 'playlist 3',privacy: VideoPlaylistPrivacy.PUBLIC,thumbnailfile: 'thumbnail.jpg',- videoChannelId: servers[ 1 ].videoChannel.id+ videoChannelId: servers[1].videoChannel.id}})@@ -293,24 +293,24 @@ describe('Test video playlists', function () {playlistServer2UUID2 = res.body.videoPlaylist.uuid}- for (let id of [ playlistServer2Id1, playlistServer2Id2 ]) {+ for (const id of [ playlistServer2Id1, playlistServer2Id2 ]) {await addVideoInPlaylist({- url: servers[ 1 ].url,- token: servers[ 1 ].accessToken,+ url: servers[1].url,+ token: servers[1].accessToken,playlistId: id,- elementAttrs: { videoId: servers[ 1 ].videos[ 0 ].id, startTimestamp: 1, stopTimestamp: 2 }+ elementAttrs: { videoId: servers[1].videos[0].id, startTimestamp: 1, stopTimestamp: 2 }})await addVideoInPlaylist({- url: servers[ 1 ].url,- token: servers[ 1 ].accessToken,+ url: servers[1].url,+ token: servers[1].accessToken,playlistId: id,- elementAttrs: { videoId: servers[ 1 ].videos[ 1 ].id }+ elementAttrs: { videoId: servers[1].videos[1].id }})}await waitJobs(servers)- for (const server of [ servers[ 0 ], servers[ 1 ] ]) {+ for (const server of [ servers[0], servers[1] ]) {const res = await getVideoPlaylistsList(server.url, 0, 5)const playlist2 = res.body.data.find(p => p.displayName === 'playlist 2')@@ -322,7 +322,7 @@ describe('Test video playlists', function () {await testImage(server.url, 'thumbnail', playlist3.thumbnailPath)}- const res = await getVideoPlaylistsList(servers[ 2 ].url, 0, 5)+ const res = await getVideoPlaylistsList(servers[2].url, 0, 5)expect(res.body.data.find(p => p.displayName === 'playlist 2')).to.be.undefinedexpect(res.body.data.find(p => p.displayName === 'playlist 3')).to.be.undefined})@@ -331,13 +331,13 @@ describe('Test video playlists', function () {this.timeout(30000)// Server 2 and server 3 follow each other- await doubleFollow(servers[ 1 ], servers[ 2 ])+ await doubleFollow(servers[1], servers[2])- const res = await getVideoPlaylistsList(servers[ 2 ].url, 0, 5)+ const res = await getVideoPlaylistsList(servers[2].url, 0, 5)const playlist2 = res.body.data.find(p => p.displayName === 'playlist 2')expect(playlist2).to.not.be.undefined- await testImage(servers[ 2 ].url, 'thumbnail-playlist', playlist2.thumbnailPath)+ await testImage(servers[2].url, 'thumbnail-playlist', playlist2.thumbnailPath)expect(res.body.data.find(p => p.displayName === 'playlist 3')).to.not.be.undefined})@@ -349,25 +349,25 @@ describe('Test video playlists', function () {this.timeout(30000){- const res = await getVideoPlaylistsList(servers[ 2 ].url, 1, 2, 'createdAt')+ const res = await getVideoPlaylistsList(servers[2].url, 1, 2, 'createdAt')expect(res.body.total).to.equal(3)const data: VideoPlaylist[] = res.body.dataexpect(data).to.have.lengthOf(2)- expect(data[ 0 ].displayName).to.equal('playlist 2')- expect(data[ 1 ].displayName).to.equal('playlist 3')+ expect(data[0].displayName).to.equal('playlist 2')+ expect(data[1].displayName).to.equal('playlist 3')}{- const res = await getVideoPlaylistsList(servers[ 2 ].url, 1, 2, '-createdAt')+ const res = await getVideoPlaylistsList(servers[2].url, 1, 2, '-createdAt')expect(res.body.total).to.equal(3)const data: VideoPlaylist[] = res.body.dataexpect(data).to.have.lengthOf(2)- expect(data[ 0 ].displayName).to.equal('playlist 2')- expect(data[ 1 ].displayName).to.equal('my super playlist')+ expect(data[0].displayName).to.equal('playlist 2')+ expect(data[1].displayName).to.equal('my super playlist')}})@@ -375,13 +375,13 @@ describe('Test video playlists', function () {this.timeout(30000){- const res = await getVideoChannelPlaylistsList(servers[ 0 ].url, 'root_channel', 0, 2, '-createdAt')+ const res = await getVideoChannelPlaylistsList(servers[0].url, 'root_channel', 0, 2, '-createdAt')expect(res.body.total).to.equal(1)const data: VideoPlaylist[] = res.body.dataexpect(data).to.have.lengthOf(1)- expect(data[ 0 ].displayName).to.equal('my super playlist')+ expect(data[0].displayName).to.equal('my super playlist')}})@@ -389,37 +389,37 @@ describe('Test video playlists', function () {this.timeout(30000){- const res = await getAccountPlaylistsList(servers[ 1 ].url, 'root', 1, 2, '-createdAt')+ const res = await getAccountPlaylistsList(servers[1].url, 'root', 1, 2, '-createdAt')expect(res.body.total).to.equal(2)const data: VideoPlaylist[] = res.body.dataexpect(data).to.have.lengthOf(1)- expect(data[ 0 ].displayName).to.equal('playlist 2')+ expect(data[0].displayName).to.equal('playlist 2')}{- const res = await getAccountPlaylistsList(servers[ 1 ].url, 'root', 1, 2, 'createdAt')+ const res = await getAccountPlaylistsList(servers[1].url, 'root', 1, 2, 'createdAt')expect(res.body.total).to.equal(2)const data: VideoPlaylist[] = res.body.dataexpect(data).to.have.lengthOf(1)- expect(data[ 0 ].displayName).to.equal('playlist 3')+ expect(data[0].displayName).to.equal('playlist 3')}{- const res = await getAccountPlaylistsList(servers[ 1 ].url, 'root', 0, 10, 'createdAt', '3')+ const res = await getAccountPlaylistsList(servers[1].url, 'root', 0, 10, 'createdAt', '3')expect(res.body.total).to.equal(1)const data: VideoPlaylist[] = res.body.dataexpect(data).to.have.lengthOf(1)- expect(data[ 0 ].displayName).to.equal('playlist 3')+ expect(data[0].displayName).to.equal('playlist 3')}{- const res = await getAccountPlaylistsList(servers[ 1 ].url, 'root', 0, 10, 'createdAt', '4')+ const res = await getAccountPlaylistsList(servers[1].url, 'root', 0, 10, 'createdAt', '4')expect(res.body.total).to.equal(0)@@ -432,8 +432,8 @@ describe('Test video playlists', function () {this.timeout(30000)await createVideoPlaylist({- url: servers[ 1 ].url,- token: servers[ 1 ].accessToken,+ url: servers[1].url,+ token: servers[1].accessToken,playlistAttrs: {displayName: 'playlist unlisted',privacy: VideoPlaylistPrivacy.UNLISTED@@ -441,8 +441,8 @@ describe('Test video playlists', function () {})await createVideoPlaylist({- url: servers[ 1 ].url,- token: servers[ 1 ].accessToken,+ url: servers[1].url,+ token: servers[1].accessToken,playlistAttrs: {displayName: 'playlist private',privacy: VideoPlaylistPrivacy.PRIVATE@@ -453,18 +453,18 @@ describe('Test video playlists', function () {for (const server of servers) {const results = [- await getAccountPlaylistsList(server.url, 'root@localhost:' + servers[ 1 ].port, 0, 5, '-createdAt'),+ await getAccountPlaylistsList(server.url, 'root@localhost:' + servers[1].port, 0, 5, '-createdAt'),await getVideoPlaylistsList(server.url, 0, 2, '-createdAt')]- expect(results[ 0 ].body.total).to.equal(2)- expect(results[ 1 ].body.total).to.equal(3)+ expect(results[0].body.total).to.equal(2)+ expect(results[1].body.total).to.equal(3)for (const res of results) {const data: VideoPlaylist[] = res.body.dataexpect(data).to.have.lengthOf(2)- expect(data[ 0 ].displayName).to.equal('playlist 3')- expect(data[ 1 ].displayName).to.equal('playlist 2')+ expect(data[0].displayName).to.equal('playlist 3')+ expect(data[1].displayName).to.equal('playlist 2')}}})@@ -519,32 +519,32 @@ describe('Test video playlists', function () {this.timeout(30000)const addVideo = (elementAttrs: any) => {- return addVideoInPlaylist({ url: servers[ 0 ].url, token: servers[ 0 ].accessToken, playlistId: playlistServer1Id, elementAttrs })+ return addVideoInPlaylist({ url: servers[0].url, token: servers[0].accessToken, playlistId: playlistServer1Id, elementAttrs })}const res = await createVideoPlaylist({- url: servers[ 0 ].url,- token: servers[ 0 ].accessToken,+ url: servers[0].url,+ token: servers[0].accessToken,playlistAttrs: {displayName: 'playlist 4',privacy: VideoPlaylistPrivacy.PUBLIC,- videoChannelId: servers[ 0 ].videoChannel.id+ videoChannelId: servers[0].videoChannel.id}})playlistServer1Id = res.body.videoPlaylist.idplaylistServer1UUID = res.body.videoPlaylist.uuid- await addVideo({ videoId: servers[ 0 ].videos[ 0 ].uuid, startTimestamp: 15, stopTimestamp: 28 })- await addVideo({ videoId: servers[ 2 ].videos[ 1 ].uuid, startTimestamp: 35 })- await addVideo({ videoId: servers[ 2 ].videos[ 2 ].uuid })+ await addVideo({ videoId: servers[0].videos[0].uuid, startTimestamp: 15, stopTimestamp: 28 })+ await addVideo({ videoId: servers[2].videos[1].uuid, startTimestamp: 35 })+ await addVideo({ videoId: servers[2].videos[2].uuid }){- const res = await addVideo({ videoId: servers[ 0 ].videos[ 3 ].uuid, stopTimestamp: 35 })+ const res = await addVideo({ videoId: servers[0].videos[3].uuid, stopTimestamp: 35 })playlistElementServer1Video4 = res.body.videoPlaylistElement.id}{- const res = await addVideo({ videoId: servers[ 0 ].videos[ 4 ].uuid, startTimestamp: 45, stopTimestamp: 60 })+ const res = await addVideo({ videoId: servers[0].videos[4].uuid, startTimestamp: 45, stopTimestamp: 60 })playlistElementServer1Video5 = res.body.videoPlaylistElement.id}@@ -567,35 +567,35 @@ describe('Test video playlists', function () {const videoElements: VideoPlaylistElement[] = res.body.dataexpect(videoElements).to.have.lengthOf(6)- expect(videoElements[ 0 ].video.name).to.equal('video 0 server 1')- expect(videoElements[ 0 ].position).to.equal(1)- expect(videoElements[ 0 ].startTimestamp).to.equal(15)- expect(videoElements[ 0 ].stopTimestamp).to.equal(28)+ expect(videoElements[0].video.name).to.equal('video 0 server 1')+ expect(videoElements[0].position).to.equal(1)+ expect(videoElements[0].startTimestamp).to.equal(15)+ expect(videoElements[0].stopTimestamp).to.equal(28)- expect(videoElements[ 1 ].video.name).to.equal('video 1 server 3')- expect(videoElements[ 1 ].position).to.equal(2)- expect(videoElements[ 1 ].startTimestamp).to.equal(35)- expect(videoElements[ 1 ].stopTimestamp).to.be.null+ expect(videoElements[1].video.name).to.equal('video 1 server 3')+ expect(videoElements[1].position).to.equal(2)+ expect(videoElements[1].startTimestamp).to.equal(35)+ expect(videoElements[1].stopTimestamp).to.be.null- expect(videoElements[ 2 ].video.name).to.equal('video 2 server 3')- expect(videoElements[ 2 ].position).to.equal(3)- expect(videoElements[ 2 ].startTimestamp).to.be.null- expect(videoElements[ 2 ].stopTimestamp).to.be.null+ expect(videoElements[2].video.name).to.equal('video 2 server 3')+ expect(videoElements[2].position).to.equal(3)+ expect(videoElements[2].startTimestamp).to.be.null+ expect(videoElements[2].stopTimestamp).to.be.null- expect(videoElements[ 3 ].video.name).to.equal('video 3 server 1')- expect(videoElements[ 3 ].position).to.equal(4)- expect(videoElements[ 3 ].startTimestamp).to.be.null- expect(videoElements[ 3 ].stopTimestamp).to.equal(35)+ expect(videoElements[3].video.name).to.equal('video 3 server 1')+ expect(videoElements[3].position).to.equal(4)+ expect(videoElements[3].startTimestamp).to.be.null+ expect(videoElements[3].stopTimestamp).to.equal(35)- expect(videoElements[ 4 ].video.name).to.equal('video 4 server 1')- expect(videoElements[ 4 ].position).to.equal(5)- expect(videoElements[ 4 ].startTimestamp).to.equal(45)- expect(videoElements[ 4 ].stopTimestamp).to.equal(60)+ expect(videoElements[4].video.name).to.equal('video 4 server 1')+ expect(videoElements[4].position).to.equal(5)+ expect(videoElements[4].startTimestamp).to.equal(45)+ expect(videoElements[4].stopTimestamp).to.equal(60)- expect(videoElements[ 5 ].video.name).to.equal('NSFW video')- expect(videoElements[ 5 ].position).to.equal(6)- expect(videoElements[ 5 ].startTimestamp).to.equal(5)- expect(videoElements[ 5 ].stopTimestamp).to.be.null+ expect(videoElements[5].video.name).to.equal('NSFW video')+ expect(videoElements[5].position).to.equal(6)+ expect(videoElements[5].startTimestamp).to.equal(5)+ expect(videoElements[5].stopTimestamp).to.be.nullconst res3 = await getPlaylistVideos(server.url, server.accessToken, playlistServer1UUID, 0, 2)expect(res3.body.data).to.have.lengthOf(2)@@ -616,18 +616,18 @@ describe('Test video playlists', function () {before(async function () {this.timeout(30000)- groupUser1 = [ Object.assign({}, servers[ 0 ], { accessToken: userAccessTokenServer1 }) ]- groupWithoutToken1 = [ Object.assign({}, servers[ 0 ], { accessToken: undefined }) ]- group1 = [ servers[ 0 ] ]- group2 = [ servers[ 1 ], servers[ 2 ] ]+ groupUser1 = [ Object.assign({}, servers[0], { accessToken: userAccessTokenServer1 }) ]+ groupWithoutToken1 = [ Object.assign({}, servers[0], { accessToken: undefined }) ]+ group1 = [ servers[0] ]+ group2 = [ servers[1], servers[2] ]const res = await createVideoPlaylist({- url: servers[ 0 ].url,+ url: servers[0].url,token: userAccessTokenServer1,playlistAttrs: {displayName: 'playlist 56',privacy: VideoPlaylistPrivacy.PUBLIC,- videoChannelId: servers[ 0 ].videoChannel.id+ videoChannelId: servers[0].videoChannel.id}})@@ -635,7 +635,7 @@ describe('Test video playlists', function () {playlistServer1UUID2 = res.body.videoPlaylist.uuidconst addVideo = (elementAttrs: any) => {- return addVideoInPlaylist({ url: servers[ 0 ].url, token: userAccessTokenServer1, playlistId: playlistServer1Id2, elementAttrs })+ return addVideoInPlaylist({ url: servers[0].url, token: userAccessTokenServer1, playlistId: playlistServer1Id2, elementAttrs })}video1 = (await uploadVideoAndGetId({ server: servers[0], videoName: 'video 89', token: userAccessTokenServer1 })).uuid@@ -656,7 +656,7 @@ describe('Test video playlists', function () {const position = 1{- await updateVideo(servers[ 0 ].url, servers[ 0 ].accessToken, video1, { privacy: VideoPrivacy.PRIVATE })+ await updateVideo(servers[0].url, servers[0].accessToken, video1, { privacy: VideoPrivacy.PRIVATE })await waitJobs(servers)await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)@@ -666,7 +666,7 @@ describe('Test video playlists', function () {}{- await updateVideo(servers[ 0 ].url, servers[ 0 ].accessToken, video1, { privacy: VideoPrivacy.PUBLIC })+ await updateVideo(servers[0].url, servers[0].accessToken, video1, { privacy: VideoPrivacy.PUBLIC })await waitJobs(servers)await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)@@ -684,7 +684,7 @@ describe('Test video playlists', function () {const position = 1{- await addVideoToBlacklist(servers[ 0 ].url, servers[ 0 ].accessToken, video1, 'reason', true)+ await addVideoToBlacklist(servers[0].url, servers[0].accessToken, video1, 'reason', true)await waitJobs(servers)await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)@@ -694,7 +694,7 @@ describe('Test video playlists', function () {}{- await removeVideoFromBlacklist(servers[ 0 ].url, servers[ 0 ].accessToken, video1)+ await removeVideoFromBlacklist(servers[0].url, servers[0].accessToken, video1)await waitJobs(servers)await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)@@ -712,52 +712,52 @@ describe('Test video playlists', function () {const position = 2{- await addAccountToAccountBlocklist(servers[ 0 ].url, userAccessTokenServer1, 'root@localhost:' + servers[1].port)+ await addAccountToAccountBlocklist(servers[0].url, userAccessTokenServer1, 'root@localhost:' + servers[1].port)await waitJobs(servers)await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3)await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)- await removeAccountFromAccountBlocklist(servers[ 0 ].url, userAccessTokenServer1, 'root@localhost:' + servers[1].port)+ await removeAccountFromAccountBlocklist(servers[0].url, userAccessTokenServer1, 'root@localhost:' + servers[1].port)await waitJobs(servers)await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)}{- await addServerToAccountBlocklist(servers[ 0 ].url, userAccessTokenServer1, 'localhost:' + servers[1].port)+ await addServerToAccountBlocklist(servers[0].url, userAccessTokenServer1, 'localhost:' + servers[1].port)await waitJobs(servers)await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3)await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)- await removeServerFromAccountBlocklist(servers[ 0 ].url, userAccessTokenServer1, 'localhost:' + servers[1].port)+ await removeServerFromAccountBlocklist(servers[0].url, userAccessTokenServer1, 'localhost:' + servers[1].port)await waitJobs(servers)await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)}{- await addAccountToServerBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, 'root@localhost:' + servers[1].port)+ await addAccountToServerBlocklist(servers[0].url, servers[0].accessToken, 'root@localhost:' + servers[1].port)await waitJobs(servers)await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3)await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)- await removeAccountFromServerBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, 'root@localhost:' + servers[1].port)+ await removeAccountFromServerBlocklist(servers[0].url, servers[0].accessToken, 'root@localhost:' + servers[1].port)await waitJobs(servers)await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)}{- await addServerToServerBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, 'localhost:' + servers[1].port)+ await addServerToServerBlocklist(servers[0].url, servers[0].accessToken, 'localhost:' + servers[1].port)await waitJobs(servers)await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3)await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)- await removeServerFromServerBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, 'localhost:' + servers[1].port)+ await removeServerFromServerBlocklist(servers[0].url, servers[0].accessToken, 'localhost:' + servers[1].port)await waitJobs(servers)await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)@@ -785,8 +785,8 @@ describe('Test video playlists', function () {{await reorderVideosPlaylist({- url: servers[ 0 ].url,- token: servers[ 0 ].accessToken,+ url: servers[0].url,+ token: servers[0].accessToken,playlistId: playlistServer1Id,elementAttrs: {startPosition: 2,@@ -813,8 +813,8 @@ describe('Test video playlists', function () {{await reorderVideosPlaylist({- url: servers[ 0 ].url,- token: servers[ 0 ].accessToken,+ url: servers[0].url,+ token: servers[0].accessToken,playlistId: playlistServer1Id,elementAttrs: {startPosition: 1,@@ -842,8 +842,8 @@ describe('Test video playlists', function () {{await reorderVideosPlaylist({- url: servers[ 0 ].url,- token: servers[ 0 ].accessToken,+ url: servers[0].url,+ token: servers[0].accessToken,playlistId: playlistServer1Id,elementAttrs: {startPosition: 6,@@ -868,7 +868,7 @@ describe('Test video playlists', function () {])for (let i = 1; i <= elements.length; i++) {- expect(elements[ i - 1 ].position).to.equal(i)+ expect(elements[i - 1].position).to.equal(i)}}}@@ -878,8 +878,8 @@ describe('Test video playlists', function () {this.timeout(30000)await updateVideoPlaylistElement({- url: servers[ 0 ].url,- token: servers[ 0 ].accessToken,+ url: servers[0].url,+ token: servers[0].accessToken,playlistId: playlistServer1Id,playlistElementId: playlistElementServer1Video4,elementAttrs: {@@ -888,8 +888,8 @@ describe('Test video playlists', function () {})await updateVideoPlaylistElement({- url: servers[ 0 ].url,- token: servers[ 0 ].accessToken,+ url: servers[0].url,+ token: servers[0].accessToken,playlistId: playlistServer1Id,playlistElementId: playlistElementServer1Video5,elementAttrs: {@@ -903,62 +903,62 @@ describe('Test video playlists', function () {const res = await getPlaylistVideos(server.url, server.accessToken, playlistServer1UUID, 0, 10)const elements: VideoPlaylistElement[] = res.body.data- expect(elements[ 0 ].video.name).to.equal('video 3 server 1')- expect(elements[ 0 ].position).to.equal(1)- expect(elements[ 0 ].startTimestamp).to.equal(1)- expect(elements[ 0 ].stopTimestamp).to.equal(35)+ expect(elements[0].video.name).to.equal('video 3 server 1')+ expect(elements[0].position).to.equal(1)+ expect(elements[0].startTimestamp).to.equal(1)+ expect(elements[0].stopTimestamp).to.equal(35)- expect(elements[ 5 ].video.name).to.equal('video 4 server 1')- expect(elements[ 5 ].position).to.equal(6)- expect(elements[ 5 ].startTimestamp).to.equal(45)- expect(elements[ 5 ].stopTimestamp).to.be.null+ expect(elements[5].video.name).to.equal('video 4 server 1')+ expect(elements[5].position).to.equal(6)+ expect(elements[5].startTimestamp).to.equal(45)+ expect(elements[5].stopTimestamp).to.be.null}})it('Should check videos existence in my playlist', async function () {const videoIds = [- servers[ 0 ].videos[ 0 ].id,+ servers[0].videos[0].id,42000,- servers[ 0 ].videos[ 3 ].id,+ servers[0].videos[3].id,43000,- servers[ 0 ].videos[ 4 ].id+ servers[0].videos[4].id]- const res = await doVideosExistInMyPlaylist(servers[ 0 ].url, servers[ 0 ].accessToken, videoIds)+ const res = await doVideosExistInMyPlaylist(servers[0].url, servers[0].accessToken, videoIds)const obj = res.body as VideoExistInPlaylist{- const elem = obj[ servers[ 0 ].videos[ 0 ].id ]+ const elem = obj[servers[0].videos[0].id]expect(elem).to.have.lengthOf(1)- expect(elem[ 0 ].playlistElementId).to.exist- expect(elem[ 0 ].playlistId).to.equal(playlistServer1Id)- expect(elem[ 0 ].startTimestamp).to.equal(15)- expect(elem[ 0 ].stopTimestamp).to.equal(28)+ expect(elem[0].playlistElementId).to.exist+ expect(elem[0].playlistId).to.equal(playlistServer1Id)+ expect(elem[0].startTimestamp).to.equal(15)+ expect(elem[0].stopTimestamp).to.equal(28)}{- const elem = obj[ servers[ 0 ].videos[ 3 ].id ]+ const elem = obj[servers[0].videos[3].id]expect(elem).to.have.lengthOf(1)- expect(elem[ 0 ].playlistElementId).to.equal(playlistElementServer1Video4)- expect(elem[ 0 ].playlistId).to.equal(playlistServer1Id)- expect(elem[ 0 ].startTimestamp).to.equal(1)- expect(elem[ 0 ].stopTimestamp).to.equal(35)+ expect(elem[0].playlistElementId).to.equal(playlistElementServer1Video4)+ expect(elem[0].playlistId).to.equal(playlistServer1Id)+ expect(elem[0].startTimestamp).to.equal(1)+ expect(elem[0].stopTimestamp).to.equal(35)}{- const elem = obj[ servers[ 0 ].videos[ 4 ].id ]+ const elem = obj[servers[0].videos[4].id]expect(elem).to.have.lengthOf(1)- expect(elem[ 0 ].playlistId).to.equal(playlistServer1Id)- expect(elem[ 0 ].startTimestamp).to.equal(45)- expect(elem[ 0 ].stopTimestamp).to.equal(null)+ expect(elem[0].playlistId).to.equal(playlistServer1Id)+ expect(elem[0].startTimestamp).to.equal(45)+ expect(elem[0].stopTimestamp).to.equal(null)}- expect(obj[ 42000 ]).to.have.lengthOf(0)- expect(obj[ 43000 ]).to.have.lengthOf(0)+ expect(obj[42000]).to.have.lengthOf(0)+ expect(obj[43000]).to.have.lengthOf(0)})it('Should automatically update updatedAt field of playlists', async function () {- const server = servers[ 1 ]- const videoId = servers[ 1 ].videos[ 5 ].id+ const server = servers[1]+ const videoId = servers[1].videos[5].idasync function getPlaylistNames () {const res = await getAccountPlaylistsListWithToken(server.url, server.accessToken, 'root', 0, 5, undefined, '-updatedAt')@@ -974,8 +974,8 @@ describe('Test video playlists', function () {const element2 = res2.body.videoPlaylistElement.idconst names1 = await getPlaylistNames()- expect(names1[ 0 ]).to.equal('playlist 3 updated')- expect(names1[ 1 ]).to.equal('playlist 2')+ expect(names1[0]).to.equal('playlist 3 updated')+ expect(names1[1]).to.equal('playlist 2')await removeVideoFromPlaylist({url: server.url,@@ -985,8 +985,8 @@ describe('Test video playlists', function () {})const names2 = await getPlaylistNames()- expect(names2[ 0 ]).to.equal('playlist 2')- expect(names2[ 1 ]).to.equal('playlist 3 updated')+ expect(names2[0]).to.equal('playlist 2')+ expect(names2[1]).to.equal('playlist 3 updated')await removeVideoFromPlaylist({url: server.url,@@ -996,23 +996,23 @@ describe('Test video playlists', function () {})const names3 = await getPlaylistNames()- expect(names3[ 0 ]).to.equal('playlist 3 updated')- expect(names3[ 1 ]).to.equal('playlist 2')+ expect(names3[0]).to.equal('playlist 3 updated')+ expect(names3[1]).to.equal('playlist 2')})it('Should delete some elements', async function () {this.timeout(30000)await removeVideoFromPlaylist({- url: servers[ 0 ].url,- token: servers[ 0 ].accessToken,+ url: servers[0].url,+ token: servers[0].accessToken,playlistId: playlistServer1Id,playlistElementId: playlistElementServer1Video4})await removeVideoFromPlaylist({- url: servers[ 0 ].url,- token: servers[ 0 ].accessToken,+ url: servers[0].url,+ token: servers[0].accessToken,playlistId: playlistServer1Id,playlistElementId: playlistElementNSFW})@@ -1027,17 +1027,17 @@ describe('Test video playlists', function () {const elements: VideoPlaylistElement[] = res.body.dataexpect(elements).to.have.lengthOf(4)- expect(elements[ 0 ].video.name).to.equal('video 0 server 1')- expect(elements[ 0 ].position).to.equal(1)+ expect(elements[0].video.name).to.equal('video 0 server 1')+ expect(elements[0].position).to.equal(1)- expect(elements[ 1 ].video.name).to.equal('video 2 server 3')- expect(elements[ 1 ].position).to.equal(2)+ expect(elements[1].video.name).to.equal('video 2 server 3')+ expect(elements[1].position).to.equal(2)- expect(elements[ 2 ].video.name).to.equal('video 1 server 3')- expect(elements[ 2 ].position).to.equal(3)+ expect(elements[2].video.name).to.equal('video 1 server 3')+ expect(elements[2].position).to.equal(3)- expect(elements[ 3 ].video.name).to.equal('video 4 server 1')- expect(elements[ 3 ].position).to.equal(4)+ expect(elements[3].video.name).to.equal('video 4 server 1')+ expect(elements[3].position).to.equal(4)}})@@ -1045,12 +1045,12 @@ describe('Test video playlists', function () {this.timeout(30000)const res = await createVideoPlaylist({- url: servers[ 0 ].url,- token: servers[ 0 ].accessToken,+ url: servers[0].url,+ token: servers[0].accessToken,playlistAttrs: {displayName: 'my super public playlist',privacy: VideoPlaylistPrivacy.PUBLIC,- videoChannelId: servers[ 0 ].videoChannel.id+ videoChannelId: servers[0].videoChannel.id}})const videoPlaylistIds = res.body.videoPlaylist@@ -1062,16 +1062,16 @@ describe('Test video playlists', function () {}const playlistAttrs = { privacy: VideoPlaylistPrivacy.PRIVATE }- await updateVideoPlaylist({ url: servers[ 0 ].url, token: servers[ 0 ].accessToken, playlistId: videoPlaylistIds.id, playlistAttrs })+ await updateVideoPlaylist({ url: servers[0].url, token: servers[0].accessToken, playlistId: videoPlaylistIds.id, playlistAttrs })await waitJobs(servers)- for (const server of [ servers[ 1 ], servers[ 2 ] ]) {+ for (const server of [ servers[1], servers[2] ]) {await getVideoPlaylist(server.url, videoPlaylistIds.uuid, 404)}- await getVideoPlaylist(servers[ 0 ].url, videoPlaylistIds.uuid, 401)+ await getVideoPlaylist(servers[0].url, videoPlaylistIds.uuid, 401)- await getVideoPlaylistWithToken(servers[ 0 ].url, servers[ 0 ].accessToken, videoPlaylistIds.uuid, 200)+ await getVideoPlaylistWithToken(servers[0].url, servers[0].accessToken, videoPlaylistIds.uuid, 200)})})@@ -1080,7 +1080,7 @@ describe('Test video playlists', function () {it('Should delete the playlist on server 1 and delete on server 2 and 3', async function () {this.timeout(30000)- await deleteVideoPlaylist(servers[ 0 ].url, servers[ 0 ].accessToken, playlistServer1Id)+ await deleteVideoPlaylist(servers[0].url, servers[0].accessToken, playlistServer1Id)await waitJobs(servers)@@ -1103,15 +1103,15 @@ describe('Test video playlists', function () {const finder = data => data.find(p => p.displayName === 'my super playlist'){- const res = await getVideoPlaylistsList(servers[ 2 ].url, 0, 5)+ const res = await getVideoPlaylistsList(servers[2].url, 0, 5)expect(res.body.total).to.equal(3)expect(finder(res.body.data)).to.not.be.undefined}- await unfollow(servers[ 2 ].url, servers[ 2 ].accessToken, servers[ 0 ])+ await unfollow(servers[2].url, servers[2].accessToken, servers[0]){- const res = await getVideoPlaylistsList(servers[ 2 ].url, 0, 5)+ const res = await getVideoPlaylistsList(servers[2].url, 0, 5)expect(res.body.total).to.equal(1)expect(finder(res.body.data)).to.be.undefined@@ -1121,12 +1121,12 @@ describe('Test video playlists', function () {it('Should delete a channel and put the associated playlist in private mode', async function () {this.timeout(30000)- const res = await addVideoChannel(servers[ 0 ].url, servers[ 0 ].accessToken, { name: 'super_channel', displayName: 'super channel' })+ const res = await addVideoChannel(servers[0].url, servers[0].accessToken, { name: 'super_channel', displayName: 'super channel' })const videoChannelId = res.body.videoChannel.idconst res2 = await createVideoPlaylist({- url: servers[ 0 ].url,- token: servers[ 0 ].accessToken,+ url: servers[0].url,+ token: servers[0].accessToken,playlistAttrs: {displayName: 'channel playlist',privacy: VideoPlaylistPrivacy.PUBLIC,@@ -1137,15 +1137,15 @@ describe('Test video playlists', function () {await waitJobs(servers)- await deleteVideoChannel(servers[ 0 ].url, servers[ 0 ].accessToken, 'super_channel')+ await deleteVideoChannel(servers[0].url, servers[0].accessToken, 'super_channel')await waitJobs(servers)- const res3 = await getVideoPlaylistWithToken(servers[ 0 ].url, servers[ 0 ].accessToken, videoPlaylistUUID)+ const res3 = await getVideoPlaylistWithToken(servers[0].url, servers[0].accessToken, videoPlaylistUUID)expect(res3.body.displayName).to.equal('channel playlist')expect(res3.body.privacy.id).to.equal(VideoPlaylistPrivacy.PRIVATE)- await getVideoPlaylist(servers[ 1 ].url, videoPlaylistUUID, 404)+ await getVideoPlaylist(servers[1].url, videoPlaylistUUID, 404)})it('Should delete an account and delete its playlists', async function () {@@ -1153,20 +1153,20 @@ describe('Test video playlists', function () {const user = { username: 'user_1', password: 'password' }const res = await createUser({- url: servers[ 0 ].url,- accessToken: servers[ 0 ].accessToken,+ url: servers[0].url,+ accessToken: servers[0].accessToken,username: user.username,password: user.password})const userId = res.body.user.id- const userAccessToken = await userLogin(servers[ 0 ], user)+ const userAccessToken = await userLogin(servers[0], user)- const resChannel = await getMyUserInformation(servers[ 0 ].url, userAccessToken)- const userChannel = (resChannel.body as User).videoChannels[ 0 ]+ const resChannel = await getMyUserInformation(servers[0].url, userAccessToken)+ const userChannel = (resChannel.body as User).videoChannels[0]await createVideoPlaylist({- url: servers[ 0 ].url,+ url: servers[0].url,token: userAccessToken,playlistAttrs: {displayName: 'playlist to be deleted',@@ -1180,17 +1180,17 @@ describe('Test video playlists', function () {const finder = data => data.find(p => p.displayName === 'playlist to be deleted'){- for (const server of [ servers[ 0 ], servers[ 1 ] ]) {+ for (const server of [ servers[0], servers[1] ]) {const res = await getVideoPlaylistsList(server.url, 0, 15)expect(finder(res.body.data)).to.not.be.undefined}}- await removeUser(servers[ 0 ].url, userId, servers[ 0 ].accessToken)+ await removeUser(servers[0].url, userId, servers[0].accessToken)await waitJobs(servers){- for (const server of [ servers[ 0 ], servers[ 1 ] ]) {+ for (const server of [ servers[0], servers[1] ]) {const res = await getVideoPlaylistsList(server.url, 0, 15)expect(finder(res.body.data)).to.be.undefined}diff --git a/server/tests/api/videos/video-privacy.ts b/server/tests/api/videos/video-privacy.tsindex e630ca84af..4bbbb90f3d 100644--- a/server/tests/api/videos/video-privacy.ts+++ b/server/tests/api/videos/video-privacy.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'@@ -6,7 +6,8 @@ import { VideoPrivacy } from '../../../../shared/models/videos/video-privacy.enuimport {cleanupTests,flushAndRunMultipleServers,- getVideosList, getVideosListWithToken,+ getVideosList,+ getVideosListWithToken,ServerInfo,setAccessTokensToServers,uploadVideo@@ -110,7 +111,7 @@ describe('Test video privacy', function () {username: 'hello',password: 'super password'}- await createUser({ url: servers[ 0 ].url, accessToken: servers[ 0 ].accessToken, username: user.username, password: user.password })+ await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: user.username, password: user.password })anotherUserToken = await userLogin(servers[0], user)await getVideoWithToken(servers[0].url, anotherUserToken, privateVideoUUID, 403)@@ -174,7 +175,7 @@ describe('Test video privacy', function () {privacy: VideoPrivacy.PUBLIC}- await updateVideo(servers[ 0 ].url, servers[ 0 ].accessToken, privateVideoId, attribute)+ await updateVideo(servers[0].url, servers[0].accessToken, privateVideoId, attribute)}{@@ -182,7 +183,7 @@ describe('Test video privacy', function () {name: 'internal video becomes public',privacy: VideoPrivacy.PUBLIC}- await updateVideo(servers[ 0 ].url, servers[ 0 ].accessToken, internalVideoId, attribute)+ await updateVideo(servers[0].url, servers[0].accessToken, internalVideoId, attribute)}await waitJobs(servers)diff --git a/server/tests/api/videos/video-schedule-update.ts b/server/tests/api/videos/video-schedule-update.tsindex 65a8eafb85..204f436116 100644--- a/server/tests/api/videos/video-schedule-update.ts+++ b/server/tests/api/videos/video-schedule-update.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'@@ -10,7 +10,6 @@ import {getMyVideos,getVideosList,getVideoWithToken,- killallServers,ServerInfo,setAccessTokensToServers,updateVideo,diff --git a/server/tests/api/videos/video-transcoder.ts b/server/tests/api/videos/video-transcoder.tsindex 55eb76b3ba..3e73ccbfa5 100644--- a/server/tests/api/videos/video-transcoder.ts+++ b/server/tests/api/videos/video-transcoder.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'@@ -56,19 +56,19 @@ describe('Test video transcoding', function () {for (const server of servers) {const res = await getVideosList(server.url)- const video = res.body.data[ 0 ]+ const video = res.body.data[0]const res2 = await getVideo(server.url, video.id)const videoDetails = res2.bodyexpect(videoDetails.files).to.have.lengthOf(1)- const magnetUri = videoDetails.files[ 0 ].magnetUri+ const magnetUri = videoDetails.files[0].magnetUriexpect(magnetUri).to.match(/\.webm/)const torrent = await webtorrentAdd(magnetUri, true)expect(torrent.files).to.be.an('array')expect(torrent.files.length).to.equal(1)- expect(torrent.files[ 0 ].path).match(/\.webm$/)+ expect(torrent.files[0].path).match(/\.webm$/)}})@@ -93,13 +93,13 @@ describe('Test video transcoding', function () {expect(videoDetails.files).to.have.lengthOf(4)- const magnetUri = videoDetails.files[ 0 ].magnetUri+ const magnetUri = videoDetails.files[0].magnetUriexpect(magnetUri).to.match(/\.mp4/)const torrent = await webtorrentAdd(magnetUri, true)expect(torrent.files).to.be.an('array')expect(torrent.files.length).to.equal(1)- expect(torrent.files[ 0 ].path).match(/\.mp4$/)+ expect(torrent.files[0].path).match(/\.mp4$/)}})@@ -127,8 +127,8 @@ describe('Test video transcoding', function () {const probe = await audio.get(path)if (probe.audioStream) {- expect(probe.audioStream[ 'codec_name' ]).to.be.equal('aac')- expect(probe.audioStream[ 'bit_rate' ]).to.be.at.most(384 * 8000)+ expect(probe.audioStream['codec_name']).to.be.equal('aac')+ expect(probe.audioStream['bit_rate']).to.be.at.most(384 * 8000)} else {this.fail('Could not retrieve the audio stream on ' + probe.absolutePath)}@@ -212,10 +212,10 @@ describe('Test video transcoding', function () {const videoDetails: VideoDetails = res2.bodyexpect(videoDetails.files).to.have.lengthOf(4)- expect(videoDetails.files[ 0 ].fps).to.be.above(58).and.below(62)- expect(videoDetails.files[ 1 ].fps).to.be.below(31)- expect(videoDetails.files[ 2 ].fps).to.be.below(31)- expect(videoDetails.files[ 3 ].fps).to.be.below(31)+ expect(videoDetails.files[0].fps).to.be.above(58).and.below(62)+ expect(videoDetails.files[1].fps).to.be.below(31)+ expect(videoDetails.files[2].fps).to.be.below(31)+ expect(videoDetails.files[3].fps).to.be.below(31)for (const resolution of [ '240', '360', '480' ]) {const path = join(root(), 'test' + servers[1].internalServerNumber, 'videos', video.uuid + '-' + resolution + '.mp4')@@ -241,11 +241,11 @@ describe('Test video transcoding', function () {fixture: 'video_short1.webm',waitTranscoding: true}- const resVideo = await uploadVideo(servers[ 1 ].url, servers[ 1 ].accessToken, videoAttributes)+ const resVideo = await uploadVideo(servers[1].url, servers[1].accessToken, videoAttributes)const videoId = resVideo.body.video.uuid// Should be in transcode state- const { body } = await getVideo(servers[ 1 ].url, videoId)+ const { body } = await getVideo(servers[1].url, videoId)expect(body.name).to.equal('waiting video')expect(body.state.id).to.equal(VideoState.TO_TRANSCODE)expect(body.state.label).to.equal('To transcode')@@ -311,7 +311,7 @@ describe('Test video transcoding', function () {const video = res.body.data.find(v => v.name === videoAttributes.name)- for (const resolution of ['240', '360', '480', '720', '1080']) {+ for (const resolution of [ '240', '360', '480', '720', '1080' ]) {const path = join(root(), 'test' + servers[1].internalServerNumber, 'videos', video.uuid + '-' + resolution + '.mp4')const bitrate = await getVideoFileBitrate(path)const fps = await getVideoFileFPS(path)@@ -341,7 +341,7 @@ describe('Test video transcoding', function () {fixture}- await uploadVideo(servers[ 1 ].url, servers[ 1 ].accessToken, videoAttributes)+ await uploadVideo(servers[1].url, servers[1].accessToken, videoAttributes)await waitJobs(servers)@@ -354,7 +354,7 @@ describe('Test video transcoding', function () {expect(videoDetails.files).to.have.lengthOf(4)- const magnetUri = videoDetails.files[ 0 ].magnetUri+ const magnetUri = videoDetails.files[0].magnetUriexpect(magnetUri).to.contain('.mp4')}}@@ -371,7 +371,7 @@ describe('Test video transcoding', function () {this.timeout(60000)const videoAttributesArg = { name: 'audio_with_preview', previewfile: 'preview.jpg', fixture: 'sample.ogg' }- await uploadVideo(servers[ 1 ].url, servers[ 1 ].accessToken, videoAttributesArg)+ await uploadVideo(servers[1].url, servers[1].accessToken, videoAttributesArg)await waitJobs(servers)@@ -387,7 +387,7 @@ describe('Test video transcoding', function () {await makeGetRequest({ url: server.url, path: videoDetails.thumbnailPath, statusCodeExpected: 200 })await makeGetRequest({ url: server.url, path: videoDetails.previewPath, statusCodeExpected: 200 })- const magnetUri = videoDetails.files[ 0 ].magnetUri+ const magnetUri = videoDetails.files[0].magnetUriexpect(magnetUri).to.contain('.mp4')}})@@ -396,7 +396,7 @@ describe('Test video transcoding', function () {this.timeout(60000)const videoAttributesArg = { name: 'audio_without_preview', fixture: 'sample.ogg' }- await uploadVideo(servers[ 1 ].url, servers[ 1 ].accessToken, videoAttributesArg)+ await uploadVideo(servers[1].url, servers[1].accessToken, videoAttributesArg)await waitJobs(servers)@@ -412,7 +412,7 @@ describe('Test video transcoding', function () {await makeGetRequest({ url: server.url, path: videoDetails.thumbnailPath, statusCodeExpected: 200 })await makeGetRequest({ url: server.url, path: videoDetails.previewPath, statusCodeExpected: 200 })- const magnetUri = videoDetails.files[ 0 ].magnetUri+ const magnetUri = videoDetails.files[0].magnetUriexpect(magnetUri).to.contain('.mp4')}})@@ -445,13 +445,13 @@ describe('Test video transcoding', function () {const video = res.body.data.find(v => v.name === videoAttributes.name){- const path = join(root(), 'test' + servers[ 1 ].internalServerNumber, 'videos', video.uuid + '-240.mp4')+ const path = join(root(), 'test' + servers[1].internalServerNumber, 'videos', video.uuid + '-240.mp4')const fps = await getVideoFileFPS(path)expect(fps).to.be.equal(25)}{- const path = join(root(), 'test' + servers[ 1 ].internalServerNumber, 'videos', video.uuid + '-720.mp4')+ const path = join(root(), 'test' + servers[1].internalServerNumber, 'videos', video.uuid + '-720.mp4')const fps = await getVideoFileFPS(path)expect(fps).to.be.equal(59)}diff --git a/server/tests/api/videos/videos-filter.ts b/server/tests/api/videos/videos-filter.tsindex e1e65260fe..95e12e43cd 100644--- a/server/tests/api/videos/videos-filter.ts+++ b/server/tests/api/videos/videos-filter.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'@@ -7,8 +7,6 @@ import {createUser,doubleFollow,flushAndRunMultipleServers,- flushTests,- killallServers,makeGetRequest,ServerInfo,setAccessTokensToServers,@@ -98,7 +96,7 @@ describe('Test videos filter validator', function () {const namesResults = await getVideosNames(server, server.accessToken, 'local')for (const names of namesResults) {expect(names).to.have.lengthOf(1)- expect(names[ 0 ]).to.equal('public ' + server.serverNumber)+ expect(names[0]).to.equal('public ' + server.serverNumber)}}})@@ -111,9 +109,9 @@ describe('Test videos filter validator', function () {for (const names of namesResults) {expect(names).to.have.lengthOf(3)- expect(names[ 0 ]).to.equal('public ' + server.serverNumber)- expect(names[ 1 ]).to.equal('unlisted ' + server.serverNumber)- expect(names[ 2 ]).to.equal('private ' + server.serverNumber)+ expect(names[0]).to.equal('public ' + server.serverNumber)+ expect(names[1]).to.equal('unlisted ' + server.serverNumber)+ expect(names[2]).to.equal('private ' + server.serverNumber)}}}diff --git a/server/tests/api/videos/videos-history.ts b/server/tests/api/videos/videos-history.tsindex c7e55c1ab7..6f90e9a57b 100644--- a/server/tests/api/videos/videos-history.ts+++ b/server/tests/api/videos/videos-history.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'diff --git a/server/tests/api/videos/videos-overview.ts b/server/tests/api/videos/videos-overview.tsindex 975a5c87a5..ca08ab5b1b 100644--- a/server/tests/api/videos/videos-overview.ts+++ b/server/tests/api/videos/videos-overview.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'diff --git a/server/tests/api/videos/videos-views-cleaner.ts b/server/tests/api/videos/videos-views-cleaner.tsindex fbddd40f49..d063d79736 100644--- a/server/tests/api/videos/videos-views-cleaner.ts+++ b/server/tests/api/videos/videos-views-cleaner.ts@@ -1,20 +1,22 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'import {+ cleanupTests,+ closeAllSequelize,+ countVideoViewsOf,+ doubleFollow,flushAndRunMultipleServers,- flushTests,killallServers,reRunServer,- flushAndRunServer,ServerInfo,setAccessTokensToServers,- uploadVideo, uploadVideoAndGetId, viewVideo, wait, countVideoViewsOf, doubleFollow, waitJobs, cleanupTests, closeAllSequelize+ uploadVideoAndGetId,+ viewVideo,+ wait,+ waitJobs} from '../../../../shared/extra-utils'-import { getVideosOverview } from '../../../../shared/extra-utils/overviews/overviews'-import { VideosOverview } from '../../../../shared/models/overviews'-import { listMyVideosHistory } from '../../../../shared/extra-utils/videos/video-history'const expect = chai.expectdiff --git a/server/tests/cli/create-import-video-file-job.ts b/server/tests/cli/create-import-video-file-job.tsindex aca3216bb6..dac049fe4c 100644--- a/server/tests/cli/create-import-video-file-job.ts+++ b/server/tests/cli/create-import-video-file-job.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'import * as chai from 'chai'@@ -71,7 +71,7 @@ describe('Test create import video jobs', function () {const videoDetail: VideoDetails = (await getVideo(server.url, video.uuid)).bodyexpect(videoDetail.files).to.have.lengthOf(2)- const [originalVideo, transcodedVideo] = videoDetail.files+ const [ originalVideo, transcodedVideo ] = videoDetail.filesassertVideoProperties(originalVideo, 720, 'webm', 218910)assertVideoProperties(transcodedVideo, 480, 'webm', 69217)@@ -95,7 +95,7 @@ describe('Test create import video jobs', function () {const videoDetail: VideoDetails = (await getVideo(server.url, video.uuid)).bodyexpect(videoDetail.files).to.have.lengthOf(4)- const [originalVideo, transcodedVideo420, transcodedVideo320, transcodedVideo240] = videoDetail.files+ const [ originalVideo, transcodedVideo420, transcodedVideo320, transcodedVideo240 ] = videoDetail.filesassertVideoProperties(originalVideo, 720, 'ogv', 140849)assertVideoProperties(transcodedVideo420, 480, 'mp4')assertVideoProperties(transcodedVideo320, 360, 'mp4')diff --git a/server/tests/cli/create-transcoding-job.ts b/server/tests/cli/create-transcoding-job.tsindex 7897ff1b37..997a9a1fda 100644--- a/server/tests/cli/create-transcoding-job.ts+++ b/server/tests/cli/create-transcoding-job.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'import * as chai from 'chai'@@ -8,14 +8,13 @@ import {doubleFollow,execCLI,flushAndRunMultipleServers,- flushTests,getEnvCli,getVideo,getVideosList,- killallServers,ServerInfo,- setAccessTokensToServers, updateCustomSubConfig,- uploadVideo, wait+ setAccessTokensToServers,+ updateCustomSubConfig,+ uploadVideo} from '../../../shared/extra-utils'import { waitJobs } from '../../../shared/extra-utils/server/jobs'@@ -23,7 +22,7 @@ const expect = chai.expectdescribe('Test create transcoding jobs', function () {let servers: ServerInfo[] = []- let videosUUID: string[] = []+ const videosUUID: string[] = []const config = {transcoding: {@@ -54,7 +53,7 @@ describe('Test create transcoding jobs', function () {await doubleFollow(servers[0], servers[1])for (let i = 1; i <= 5; i++) {- const res = await uploadVideo(servers[ 0 ].url, servers[ 0 ].accessToken, { name: 'video' + i })+ const res = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video' + i })videosUUID.push(res.body.video.uuid)}@@ -90,7 +89,7 @@ describe('Test create transcoding jobs', function () {const res = await getVideosList(server.url)const videos = res.body.data- let infoHashes: { [ id: number ]: string }+ let infoHashes: { [id: number]: string }for (const video of videos) {const res2 = await getVideo(server.url, video.uuid)diff --git a/server/tests/cli/optimize-old-videos.ts b/server/tests/cli/optimize-old-videos.tsindex de5d672f54..e2e13598fc 100644--- a/server/tests/cli/optimize-old-videos.ts+++ b/server/tests/cli/optimize-old-videos.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'import * as chai from 'chai'@@ -28,7 +28,9 @@ const expect = chai.expectdescribe('Test optimize old videos', function () {let servers: ServerInfo[] = []+ // eslint-disable-next-line @typescript-eslint/no-unused-varslet video1UUID: string+ // eslint-disable-next-line @typescript-eslint/no-unused-varslet video2UUID: stringbefore(async function () {diff --git a/server/tests/cli/peertube.ts b/server/tests/cli/peertube.tsindex 15b6755f22..27fbde02de 100644--- a/server/tests/cli/peertube.ts+++ b/server/tests/cli/peertube.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'import { expect } from 'chai'@@ -6,15 +6,18 @@ import {addVideoChannel,buildAbsoluteFixturePath,cleanupTests,- createUser, doubleFollow,+ createUser,+ doubleFollow,execCLI,flushAndRunServer,- getEnvCli, getLocalIdByUUID,+ getEnvCli,+ getLocalIdByUUID,getVideo,getVideosList,- getVideosListWithToken, removeVideo,+ removeVideo,ServerInfo,- setAccessTokensToServers, uploadVideo, uploadVideoAndGetId,+ setAccessTokensToServers,+ uploadVideoAndGetId,userLogin,waitJobs} from '../../../shared/extra-utils'@@ -101,7 +104,7 @@ describe('Test CLI wrapper', function () {const videos: Video[] = res.body.data- const video: VideoDetails = (await getVideo(server.url, videos[ 0 ].uuid)).body+ const video: VideoDetails = (await getVideo(server.url, videos[0].uuid)).bodyexpect(video.name).to.equal('test upload')expect(video.support).to.equal('support_text')@@ -250,7 +253,7 @@ describe('Test CLI wrapper', function () {{const env = getEnvCli(server)- const params = `list-my-redundancies`+ const params = 'list-my-redundancies'const stdout = await execCLI(`${env} ${cmd} redundancy ${params}`)expect(stdout).to.contain('super video')@@ -271,7 +274,7 @@ describe('Test CLI wrapper', function () {{const env = getEnvCli(server)- const params = `list-my-redundancies`+ const params = 'list-my-redundancies'const stdout = await execCLI(`${env} ${cmd} redundancy ${params}`)expect(stdout).to.not.contain('super video')diff --git a/server/tests/cli/plugins.ts b/server/tests/cli/plugins.tsindex a5257d671b..7f19f14b7f 100644--- a/server/tests/cli/plugins.ts+++ b/server/tests/cli/plugins.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'import {diff --git a/server/tests/cli/prune-storage.ts b/server/tests/cli/prune-storage.tsindex 144e67c44e..304c8ca56b 100644--- a/server/tests/cli/prune-storage.ts+++ b/server/tests/cli/prune-storage.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'import * as chai from 'chai'@@ -11,9 +11,11 @@ import {execCLI,flushAndRunMultipleServers,getAccount,- getEnvCli, makeGetRequest, makeRawRequest,+ getEnvCli,+ makeGetRequest,ServerInfo,- setAccessTokensToServers, setDefaultVideoChannel,+ setAccessTokensToServers,+ setDefaultVideoChannel,updateMyAvatar,uploadVideo,wait@@ -22,7 +24,6 @@ import { Account, VideoPlaylistPrivacy } from '../../../shared/models'import { createFile, readdir } from 'fs-extra'import * as uuidv4 from 'uuid/v4'import { join } from 'path'-import * as request from 'supertest'const expect = chai.expect@@ -61,7 +62,7 @@ async function assertCountAreOkay (servers: ServerInfo[]) {describe('Test prune storage scripts', function () {let servers: ServerInfo[]- const badNames: { [ directory: string ]: string[] } = {}+ const badNames: { [directory: string]: string[] } = {}before(async function () {this.timeout(120000)@@ -92,20 +93,20 @@ describe('Test prune storage scripts', function () {// Lazy load the remote avatar{- const res = await getAccount(servers[ 0 ].url, 'root@localhost:' + servers[ 1 ].port)+ const res = await getAccount(servers[0].url, 'root@localhost:' + servers[1].port)const account: Account = res.bodyawait makeGetRequest({- url: servers[ 0 ].url,+ url: servers[0].url,path: account.avatar.path,statusCodeExpected: 200})}{- const res = await getAccount(servers[ 1 ].url, 'root@localhost:' + servers[ 0 ].port)+ const res = await getAccount(servers[1].url, 'root@localhost:' + servers[0].port)const account: Account = res.bodyawait makeGetRequest({- url: servers[ 1 ].url,+ url: servers[1].url,path: account.avatar.path,statusCodeExpected: 200})diff --git a/server/tests/cli/update-host.ts b/server/tests/cli/update-host.tsindex 55c43b32fc..2070f16f57 100644--- a/server/tests/cli/update-host.ts+++ b/server/tests/cli/update-host.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'import * as chai from 'chai'diff --git a/server/tests/client.ts b/server/tests/client.tsindex 778dcd08e5..d61724e511 100644--- a/server/tests/client.ts+++ b/server/tests/client.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'import * as chai from 'chai'diff --git a/server/tests/feeds/feeds.ts b/server/tests/feeds/feeds.tsindex 437470327b..4510177ccf 100644--- a/server/tests/feeds/feeds.ts+++ b/server/tests/feeds/feeds.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'@@ -51,7 +51,7 @@ describe('Test syndication feeds', () => {{const attr = { username: 'john', password: 'password' }- await createUser({ url: servers[ 0 ].url, accessToken: servers[ 0 ].accessToken, username: attr.username, password: attr.password })+ await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: attr.username, password: attr.password })userAccessToken = await userLogin(servers[0], attr)const res = await getMyUserInformation(servers[0].url, userAccessToken)@@ -61,7 +61,7 @@ describe('Test syndication feeds', () => {}{- await uploadVideo(servers[ 0 ].url, userAccessToken, { name: 'user video' })+ await uploadVideo(servers[0].url, userAccessToken, { name: 'user video' })}{@@ -70,11 +70,11 @@ describe('Test syndication feeds', () => {description: 'my super description for server 1',fixture: 'video_short.webm'}- const res = await uploadVideo(servers[ 0 ].url, servers[ 0 ].accessToken, videoAttributes)+ const res = await uploadVideo(servers[0].url, servers[0].accessToken, videoAttributes)const videoId = res.body.video.id- await addVideoCommentThread(servers[ 0 ].url, servers[ 0 ].accessToken, videoId, 'super comment 1')- await addVideoCommentThread(servers[ 0 ].url, servers[ 0 ].accessToken, videoId, 'super comment 2')+ await addVideoCommentThread(servers[0].url, servers[0].accessToken, videoId, 'super comment 1')+ await addVideoCommentThread(servers[0].url, servers[0].accessToken, videoId, 'super comment 2')}await waitJobs(servers)@@ -84,18 +84,18 @@ describe('Test syndication feeds', () => {it('Should be well formed XML (covers RSS 2.0 and ATOM 1.0 endpoints)', async function () {for (const feed of [ 'video-comments' as 'video-comments', 'videos' as 'videos' ]) {- const rss = await getXMLfeed(servers[ 0 ].url, feed)+ const rss = await getXMLfeed(servers[0].url, feed)expect(rss.text).xml.to.be.valid()- const atom = await getXMLfeed(servers[ 0 ].url, feed, 'atom')+ const atom = await getXMLfeed(servers[0].url, feed, 'atom')expect(atom.text).xml.to.be.valid()}})it('Should be well formed JSON (covers JSON feed 1.0 endpoint)', async function () {for (const feed of [ 'video-comments' as 'video-comments', 'videos' as 'videos' ]) {- const json = await getJSONfeed(servers[ 0 ].url, feed)- expect(JSON.parse(json.text)).to.be.jsonSchema({ 'type': 'object' })+ const json = await getJSONfeed(servers[0].url, feed)+ expect(JSON.parse(json.text)).to.be.jsonSchema({ type: 'object' })}})})@@ -118,11 +118,11 @@ describe('Test syndication feeds', () => {const json = await getJSONfeed(server.url, 'videos')const jsonObj = JSON.parse(json.text)expect(jsonObj.items.length).to.be.equal(2)- expect(jsonObj.items[ 0 ].attachments).to.exist- expect(jsonObj.items[ 0 ].attachments.length).to.be.eq(1)- expect(jsonObj.items[ 0 ].attachments[ 0 ].mime_type).to.be.eq('application/x-bittorrent')- expect(jsonObj.items[ 0 ].attachments[ 0 ].size_in_bytes).to.be.eq(218910)- expect(jsonObj.items[ 0 ].attachments[ 0 ].url).to.contain('720.torrent')+ expect(jsonObj.items[0].attachments).to.exist+ expect(jsonObj.items[0].attachments.length).to.be.eq(1)+ expect(jsonObj.items[0].attachments[0].mime_type).to.be.eq('application/x-bittorrent')+ expect(jsonObj.items[0].attachments[0].size_in_bytes).to.be.eq(218910)+ expect(jsonObj.items[0].attachments[0].url).to.contain('720.torrent')}})@@ -131,16 +131,16 @@ describe('Test syndication feeds', () => {const json = await getJSONfeed(servers[0].url, 'videos', { accountId: rootAccountId })const jsonObj = JSON.parse(json.text)expect(jsonObj.items.length).to.be.equal(1)- expect(jsonObj.items[ 0 ].title).to.equal('my super name for server 1')- expect(jsonObj.items[ 0 ].author.name).to.equal('root')+ expect(jsonObj.items[0].title).to.equal('my super name for server 1')+ expect(jsonObj.items[0].author.name).to.equal('root')}{const json = await getJSONfeed(servers[0].url, 'videos', { accountId: userAccountId })const jsonObj = JSON.parse(json.text)expect(jsonObj.items.length).to.be.equal(1)- expect(jsonObj.items[ 0 ].title).to.equal('user video')- expect(jsonObj.items[ 0 ].author.name).to.equal('john')+ expect(jsonObj.items[0].title).to.equal('user video')+ expect(jsonObj.items[0].author.name).to.equal('john')}for (const server of servers) {@@ -148,14 +148,14 @@ describe('Test syndication feeds', () => {const json = await getJSONfeed(server.url, 'videos', { accountName: 'root@localhost:' + servers[0].port })const jsonObj = JSON.parse(json.text)expect(jsonObj.items.length).to.be.equal(1)- expect(jsonObj.items[ 0 ].title).to.equal('my super name for server 1')+ expect(jsonObj.items[0].title).to.equal('my super name for server 1')}{const json = await getJSONfeed(server.url, 'videos', { accountName: 'john@localhost:' + servers[0].port })const jsonObj = JSON.parse(json.text)expect(jsonObj.items.length).to.be.equal(1)- expect(jsonObj.items[ 0 ].title).to.equal('user video')+ expect(jsonObj.items[0].title).to.equal('user video')}}})@@ -165,16 +165,16 @@ describe('Test syndication feeds', () => {const json = await getJSONfeed(servers[0].url, 'videos', { videoChannelId: rootChannelId })const jsonObj = JSON.parse(json.text)expect(jsonObj.items.length).to.be.equal(1)- expect(jsonObj.items[ 0 ].title).to.equal('my super name for server 1')- expect(jsonObj.items[ 0 ].author.name).to.equal('root')+ expect(jsonObj.items[0].title).to.equal('my super name for server 1')+ expect(jsonObj.items[0].author.name).to.equal('root')}{const json = await getJSONfeed(servers[0].url, 'videos', { videoChannelId: userChannelId })const jsonObj = JSON.parse(json.text)expect(jsonObj.items.length).to.be.equal(1)- expect(jsonObj.items[ 0 ].title).to.equal('user video')- expect(jsonObj.items[ 0 ].author.name).to.equal('john')+ expect(jsonObj.items[0].title).to.equal('user video')+ expect(jsonObj.items[0].author.name).to.equal('john')}for (const server of servers) {@@ -182,14 +182,14 @@ describe('Test syndication feeds', () => {const json = await getJSONfeed(server.url, 'videos', { videoChannelName: 'root_channel@localhost:' + servers[0].port })const jsonObj = JSON.parse(json.text)expect(jsonObj.items.length).to.be.equal(1)- expect(jsonObj.items[ 0 ].title).to.equal('my super name for server 1')+ expect(jsonObj.items[0].title).to.equal('my super name for server 1')}{const json = await getJSONfeed(server.url, 'videos', { videoChannelName: 'john_channel@localhost:' + servers[0].port })const jsonObj = JSON.parse(json.text)expect(jsonObj.items.length).to.be.equal(1)- expect(jsonObj.items[ 0 ].title).to.equal('user video')+ expect(jsonObj.items[0].title).to.equal('user video')}}})@@ -202,8 +202,8 @@ describe('Test syndication feeds', () => {const jsonObj = JSON.parse(json.text)expect(jsonObj.items.length).to.be.equal(2)- expect(jsonObj.items[ 0 ].html_content).to.equal('super comment 2')- expect(jsonObj.items[ 1 ].html_content).to.equal('super comment 1')+ expect(jsonObj.items[0].html_content).to.equal('super comment 2')+ expect(jsonObj.items[1].html_content).to.equal('super comment 1')}})})diff --git a/server/tests/helpers/comment-model.ts b/server/tests/helpers/comment-model.tsindex ebfd779e1a..4c51b70003 100644--- a/server/tests/helpers/comment-model.ts+++ b/server/tests/helpers/comment-model.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'@@ -20,7 +20,7 @@ describe('Comment model', function () {comment.text = '@florian @jean@localhost:9000 @flo @another@localhost:9000 @[email protected] hello ' +'email@localhost:9000 coucou.com no? @chocobozzz @chocobozzz @end'- const result = comment.extractMentions().sort()+ const result = comment.extractMentions().sort((a, b) => a.localeCompare(b))expect(result).to.deep.equal([ 'another', 'chocobozzz', 'end', 'flo', 'florian', 'jean' ])})diff --git a/server/tests/helpers/core-utils.ts b/server/tests/helpers/core-utils.tsindex 31fc6dd7c0..c028b316d9 100644--- a/server/tests/helpers/core-utils.ts+++ b/server/tests/helpers/core-utils.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'diff --git a/server/tests/helpers/request.ts b/server/tests/helpers/request.tsindex a754bc6e27..f8b2d599b8 100644--- a/server/tests/helpers/request.ts+++ b/server/tests/helpers/request.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'import { doRequest, doRequestAndSaveToFile } from '../../helpers/requests'diff --git a/server/tests/misc-endpoints.ts b/server/tests/misc-endpoints.tsindex ab2dd3a0ff..32b035c9ef 100644--- a/server/tests/misc-endpoints.ts+++ b/server/tests/misc-endpoints.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import 'mocha'import * as chai from 'chai'diff --git a/server/tests/plugins/action-hooks.ts b/server/tests/plugins/action-hooks.tsindex 510ec31519..ca57a4b518 100644--- a/server/tests/plugins/action-hooks.ts+++ b/server/tests/plugins/action-hooks.ts@@ -1,6 +1,5 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import * as chai from 'chai'import 'mocha'import {cleanupTests,@@ -17,18 +16,18 @@ import {createUser,deleteVideoComment,getPluginTestPath,- installPlugin, login,- registerUser, removeUser,+ installPlugin,+ registerUser,+ removeUser,setAccessTokensToServers,- unblockUser, updateUser,+ unblockUser,+ updateUser,updateVideo,uploadVideo,- viewVideo,- userLogin+ userLogin,+ viewVideo} from '../../../shared/extra-utils'-const expect = chai.expect-describe('Test plugin action hooks', function () {let servers: ServerInfo[]let videoUUID: stringdiff --git a/server/tests/plugins/filter-hooks.ts b/server/tests/plugins/filter-hooks.tsindex 6a5ea46415..6c1fd40ba7 100644--- a/server/tests/plugins/filter-hooks.ts+++ b/server/tests/plugins/filter-hooks.ts@@ -1,34 +1,27 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'-import {- cleanupTests,- flushAndRunMultipleServers,- flushAndRunServer, killallServers, reRunServer,- ServerInfo,- waitUntilLog-} from '../../../shared/extra-utils/server/servers'+import { cleanupTests, flushAndRunMultipleServers, ServerInfo } from '../../../shared/extra-utils/server/servers'import {addVideoCommentReply,addVideoCommentThread,- deleteVideoComment,+ doubleFollow,+ getConfig,getPluginTestPath,- getVideosList,- installPlugin,- removeVideo,- setAccessTokensToServers,- updateVideo,- uploadVideo,- viewVideo,- getVideosListPagination,getVideo,getVideoCommentThreads,+ getVideosList,+ getVideosListPagination,getVideoThreadComments,getVideoWithToken,+ installPlugin,+ registerUser,+ setAccessTokensToServers,setDefaultVideoChannel,- waitJobs,- doubleFollow, getConfig, registerUser+ updateVideo,+ uploadVideo,+ waitJobs} from '../../../shared/extra-utils'import { VideoCommentThreadTree } from '../../../shared/models/videos/video-comment.model'import { VideoDetails } from '../../../shared/models/videos'@@ -140,7 +133,7 @@ describe('Test plugin filter hooks', function () {}it('Should blacklist on upload', async function () {- const res = await uploadVideo(servers[ 0 ].url, servers[ 0 ].accessToken, { name: 'video please blacklist me' })+ const res = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video please blacklist me' })await checkIsBlacklisted(res, true)})@@ -157,18 +150,18 @@ describe('Test plugin filter hooks', function () {})it('Should blacklist on update', async function () {- const res = await uploadVideo(servers[ 0 ].url, servers[ 0 ].accessToken, { name: 'video' })+ const res = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video' })const videoId = res.body.video.uuidawait checkIsBlacklisted(res, false)- await updateVideo(servers[ 0 ].url, servers[ 0 ].accessToken, videoId, { name: 'please blacklist me' })+ await updateVideo(servers[0].url, servers[0].accessToken, videoId, { name: 'please blacklist me' })await checkIsBlacklisted(res, true)})it('Should blacklist on remote upload', async function () {this.timeout(45000)- const res = await uploadVideo(servers[ 1 ].url, servers[ 1 ].accessToken, { name: 'remote please blacklist me' })+ const res = await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'remote please blacklist me' })await waitJobs(servers)await checkIsBlacklisted(res, true)@@ -177,7 +170,7 @@ describe('Test plugin filter hooks', function () {it('Should blacklist on remote update', async function () {this.timeout(45000)- const res = await uploadVideo(servers[ 1 ].url, servers[ 1 ].accessToken, { name: 'video' })+ const res = await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'video' })await waitJobs(servers)const videoId = res.body.video.uuiddiff --git a/server/tests/plugins/translations.ts b/server/tests/plugins/translations.tsindex 88d91a0333..8dc2043b85 100644--- a/server/tests/plugins/translations.ts+++ b/server/tests/plugins/translations.ts@@ -1,38 +1,15 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'+import { cleanupTests, flushAndRunServer, ServerInfo } from '../../../shared/extra-utils/server/servers'import {- cleanupTests,- flushAndRunMultipleServers,- flushAndRunServer, killallServers, reRunServer,- ServerInfo,- waitUntilLog-} from '../../../shared/extra-utils/server/servers'-import {- addVideoCommentReply,- addVideoCommentThread,- deleteVideoComment,getPluginTestPath,- getVideosList,+ getPluginTranslations,installPlugin,- removeVideo,setAccessTokensToServers,- updateVideo,- uploadVideo,- viewVideo,- getVideosListPagination,- getVideo,- getVideoCommentThreads,- getVideoThreadComments,- getVideoWithToken,- setDefaultVideoChannel,- waitJobs,- doubleFollow, getVideoLanguages, getVideoLicences, getVideoCategories, uninstallPlugin, getPluginTranslations+ uninstallPlugin} from '../../../shared/extra-utils'-import { VideoCommentThreadTree } from '../../../shared/models/videos/video-comment.model'-import { VideoDetails } from '../../../shared/models/videos'-import { getYoutubeVideoUrl, importVideo } from '../../../shared/extra-utils/videos/video-imports'const expect = chai.expect@@ -69,7 +46,7 @@ describe('Test plugin translations', function () {expect(res.body).to.deep.equal({'peertube-plugin-test': {- 'Hi': 'Coucou'+ Hi: 'Coucou'},'peertube-plugin-test-two': {'Hello world': 'Bonjour le monde'@@ -95,7 +72,7 @@ describe('Test plugin translations', function () {expect(res.body).to.deep.equal({'peertube-plugin-test': {- 'Hi': 'Coucou'+ Hi: 'Coucou'}})}diff --git a/server/tests/plugins/video-constants.ts b/server/tests/plugins/video-constants.tsindex 6562e2b455..5374b5eccc 100644--- a/server/tests/plugins/video-constants.ts+++ b/server/tests/plugins/video-constants.ts@@ -1,38 +1,20 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import 'mocha'+import { cleanupTests, flushAndRunServer, ServerInfo } from '../../../shared/extra-utils/server/servers'import {- cleanupTests,- flushAndRunMultipleServers,- flushAndRunServer, killallServers, reRunServer,- ServerInfo,- waitUntilLog-} from '../../../shared/extra-utils/server/servers'-import {- addVideoCommentReply,- addVideoCommentThread,- deleteVideoComment,getPluginTestPath,- getVideosList,+ getVideo,+ getVideoCategories,+ getVideoLanguages,+ getVideoLicences,installPlugin,- removeVideo,setAccessTokensToServers,- updateVideo,- uploadVideo,- viewVideo,- getVideosListPagination,- getVideo,- getVideoCommentThreads,- getVideoThreadComments,- getVideoWithToken,- setDefaultVideoChannel,- waitJobs,- doubleFollow, getVideoLanguages, getVideoLicences, getVideoCategories, uninstallPlugin+ uninstallPlugin,+ uploadVideo} from '../../../shared/extra-utils'-import { VideoCommentThreadTree } from '../../../shared/models/videos/video-comment.model'import { VideoDetails } from '../../../shared/models/videos'-import { getYoutubeVideoUrl, importVideo } from '../../../shared/extra-utils/videos/video-imports'const expect = chai.expect@@ -104,33 +86,33 @@ describe('Test plugin altering video constants', function () {const res = await getVideoLanguages(server.url)const languages = res.body- expect(languages[ 'en' ]).to.equal('English')- expect(languages[ 'fr' ]).to.equal('French')+ expect(languages['en']).to.equal('English')+ expect(languages['fr']).to.equal('French')- expect(languages[ 'al_bhed' ]).to.not.exist- expect(languages[ 'al_bhed2' ]).to.not.exist+ expect(languages['al_bhed']).to.not.exist+ expect(languages['al_bhed2']).to.not.exist}{const res = await getVideoCategories(server.url)const categories = res.body- expect(categories[ 1 ]).to.equal('Music')- expect(categories[ 2 ]).to.equal('Films')+ expect(categories[1]).to.equal('Music')+ expect(categories[2]).to.equal('Films')- expect(categories[ 42 ]).to.not.exist- expect(categories[ 43 ]).to.not.exist+ expect(categories[42]).to.not.exist+ expect(categories[43]).to.not.exist}{const res = await getVideoLicences(server.url)const licences = res.body- expect(licences[ 1 ]).to.equal('Attribution')- expect(licences[ 7 ]).to.equal('Public Domain Dedication')+ expect(licences[1]).to.equal('Attribution')+ expect(licences[7]).to.equal('Public Domain Dedication')- expect(licences[ 42 ]).to.not.exist- expect(licences[ 43 ]).to.not.exist+ expect(licences[42]).to.not.exist+ expect(licences[43]).to.not.exist}})diff --git a/server/tests/real-world/populate-database.ts b/server/tests/real-world/populate-database.tsdeleted file mode 100644index b1c1688e7c..0000000000--- a/server/tests/real-world/populate-database.ts+++ /dev/null@@ -1,122 +0,0 @@-import { VideoRateType } from '../../../shared'-import {- addVideoChannel,- createUser,- flushTests,- getVideosList,- killallServers,- rateVideo,- flushAndRunServer,- ServerInfo,- setAccessTokensToServers,- uploadVideo-} from '../../../shared/extra-utils'-import * as Bluebird from 'bluebird'--start()- .catch(err => console.error(err))--// ------------------------------------------------------------------------------async function start () {-- console.log('Flushed tests.')-- const server = await flushAndRunServer(6)-- process.on('exit', async () => {- killallServers([ server ])- return- })- process.on('SIGINT', goodbye)- process.on('SIGTERM', goodbye)-- await setAccessTokensToServers([ server ])-- console.log('Servers ran.')-- // Forever- const fakeTab = Array.from(Array(1000000).keys())- const funs = [- uploadCustom- // uploadCustom,- // uploadCustom,- // uploadCustom,- // likeCustom,- // createUserCustom,- // createCustomChannel- ]- const promises = []-- for (const fun of funs) {- promises.push(- Bluebird.map(fakeTab, () => {- return fun(server).catch(err => console.error(err))- }, { concurrency: 3 })- )- }-- await Promise.all(promises)-}--function getRandomInt (min, max) {- return Math.floor(Math.random() * (max - min)) + min-}--function createCustomChannel (server: ServerInfo) {- const videoChannel = {- name: Date.now().toString(),- displayName: Date.now().toString(),- description: Date.now().toString()- }-- return addVideoChannel(server.url, server.accessToken, videoChannel)-}--function createUserCustom (server: ServerInfo) {- const username = Date.now().toString() + getRandomInt(0, 100000)- console.log('Creating user %s.', username)-- return createUser({ url: server.url, accessToken: server.accessToken, username: username, password: 'coucou' })-}--function uploadCustom (server: ServerInfo) {- console.log('Uploading video.')-- const videoAttributes = {- name: Date.now() + ' name',- category: 4,- nsfw: false,- licence: 2,- language: 'en',- description: Date.now() + ' description',- tags: [ Date.now().toString().substring(0, 5) + 't1', Date.now().toString().substring(0, 5) + 't2' ],- fixture: 'video_short.mp4'- }-- return uploadVideo(server.url, server.accessToken, videoAttributes)-}--function likeCustom (server: ServerInfo) {- return rateCustom(server, 'like')-}--function dislikeCustom (server: ServerInfo) {- return rateCustom(server, 'dislike')-}--async function rateCustom (server: ServerInfo, rating: VideoRateType) {- const res = await getVideosList(server.url)-- const videos = res.body.data- if (videos.length === 0) return undefined-- const videoToRate = videos[getRandomInt(0, videos.length)]-- console.log('Rating (%s) video.', rating)- return rateVideo(server.url, server.accessToken, videoToRate.id, rating)-}--function goodbye () {- return process.exit(-1)-}diff --git a/server/tests/real-world/real-world.ts b/server/tests/real-world/real-world.tsdeleted file mode 100644index cba5ac3119..0000000000--- a/server/tests/real-world/real-world.ts+++ /dev/null@@ -1,375 +0,0 @@-// /!\ Before imports /!\-process.env.NODE_ENV = 'test'--import * as program from 'commander'-import { Video, VideoFile, VideoRateType } from '../../../shared'-import { JobState } from '../../../shared/models'-import {- flushAndRunMultipleServers,- flushTests, follow,- getVideo,- getVideosList, getVideosListPagination,- killallServers,- removeVideo,- ServerInfo as DefaultServerInfo,- setAccessTokensToServers,- updateVideo,- uploadVideo, viewVideo,- wait-} from '../../../shared/extra-utils'-import { getJobsListPaginationAndSort } from '../../../shared/extra-utils/server/jobs'--interface ServerInfo extends DefaultServerInfo {- requestsNumber: number-}--program- .option('-c, --create [weight]', 'Weight for creating videos')- .option('-r, --remove [weight]', 'Weight for removing videos')- .option('-u, --update [weight]', 'Weight for updating videos')- .option('-v, --view [weight]', 'Weight for viewing videos')- .option('-l, --like [weight]', 'Weight for liking videos')- .option('-s, --dislike [weight]', 'Weight for disliking videos')- .option('-p, --servers [n]', 'Number of servers to run (3 or 6)', /^3|6$/, 3)- .option('-i, --interval-action [interval]', 'Interval in ms for an action')- .option('-I, --interval-integrity [interval]', 'Interval in ms for an integrity check')- .option('-f, --flush', 'Flush data on exit')- .option('-d, --difference', 'Display difference if integrity is not okay')- .parse(process.argv)--const createWeight = program['create'] !== undefined ? parseInt(program['create'], 10) : 5-const removeWeight = program['remove'] !== undefined ? parseInt(program['remove'], 10) : 4-const updateWeight = program['update'] !== undefined ? parseInt(program['update'], 10) : 4-const viewWeight = program['view'] !== undefined ? parseInt(program['view'], 10) : 4-const likeWeight = program['like'] !== undefined ? parseInt(program['like'], 10) : 4-const dislikeWeight = program['dislike'] !== undefined ? parseInt(program['dislike'], 10) : 4-const flushAtExit = program['flush'] || false-const actionInterval = program['intervalAction'] !== undefined ? parseInt(program['intervalAction'], 10) : 500-const integrityInterval = program['intervalIntegrity'] !== undefined ? parseInt(program['intervalIntegrity'], 10) : 60000-const displayDiffOnFail = program['difference'] || false--const numberOfServers = 6--console.log(- 'Create weight: %d, update weight: %d, remove weight: %d, view weight: %d, like weight: %d, dislike weight: %d.',- createWeight, updateWeight, removeWeight, viewWeight, likeWeight, dislikeWeight-)--if (flushAtExit) {- console.log('Program will flush data on exit.')-} else {- console.log('Program will not flush data on exit.')-}-if (displayDiffOnFail) {- console.log('Program will display diff on failure.')-} else {- console.log('Program will not display diff on failure')-}-console.log('Interval in ms for each action: %d.', actionInterval)-console.log('Interval in ms for each integrity check: %d.', integrityInterval)--console.log('Run servers...')--start()--// ------------------------------------------------------------------------------async function start () {- const servers = await runServers(numberOfServers)-- process.on('exit', async () => {- await exitServers(servers, flushAtExit)-- return- })- process.on('SIGINT', goodbye)- process.on('SIGTERM', goodbye)-- console.log('Servers ran')- initializeRequestsPerServer(servers)-- let checking = false-- setInterval(async () => {- if (checking === true) return-- const rand = getRandomInt(0, createWeight + updateWeight + removeWeight + viewWeight + likeWeight + dislikeWeight)-- const numServer = getRandomNumServer(servers)- servers[numServer].requestsNumber++-- if (rand < createWeight) {- await upload(servers, numServer)- } else if (rand < createWeight + updateWeight) {- await update(servers, numServer)- } else if (rand < createWeight + updateWeight + removeWeight) {- await remove(servers, numServer)- } else if (rand < createWeight + updateWeight + removeWeight + viewWeight) {- await view(servers, numServer)- } else if (rand < createWeight + updateWeight + removeWeight + viewWeight + likeWeight) {- await like(servers, numServer)- } else {- await dislike(servers, numServer)- }- }, actionInterval)-- // The function will check the consistency between servers (should have the same videos with same attributes...)- setInterval(function () {- if (checking === true) return-- console.log('Checking integrity...')- checking = true-- const waitingInterval = setInterval(async () => {- const pendingRequests = await isTherePendingRequests(servers)- if (pendingRequests === true) {- console.log('A server has pending requests, waiting...')- return- }-- // Even if there are no pending request, wait some potential processes- await wait(2000)- await checkIntegrity(servers)-- initializeRequestsPerServer(servers)- checking = false- clearInterval(waitingInterval)- }, 10000)- }, integrityInterval)-}--function initializeRequestsPerServer (servers: ServerInfo[]) {- servers.forEach(server => server.requestsNumber = 0)-}--function getRandomInt (min, max) {- return Math.floor(Math.random() * (max - min)) + min-}--function getRandomNumServer (servers) {- return getRandomInt(0, servers.length)-}--async function runServers (numberOfServers: number) {- const servers: ServerInfo[] = (await flushAndRunMultipleServers(numberOfServers))- .map(s => Object.assign({ requestsNumber: 0 }, s))-- // Get the access tokens- await setAccessTokensToServers(servers)-- for (let i = 0; i < numberOfServers; i++) {- for (let j = 0; j < numberOfServers; j++) {- if (i === j) continue-- await follow(servers[i].url, [ servers[j].url ], servers[i].accessToken)- }- }-- return servers-}--async function exitServers (servers: ServerInfo[], flushAtExit: boolean) {- killallServers(servers)-- if (flushAtExit) await flushTests()-}--function upload (servers: ServerInfo[], numServer: number) {- console.log('Uploading video to server ' + numServer)-- const videoAttributes = {- name: Date.now() + ' name',- category: 4,- nsfw: false,- licence: 2,- language: 'en',- description: Date.now() + ' description',- tags: [ Date.now().toString().substring(0, 5) + 't1', Date.now().toString().substring(0, 5) + 't2' ],- fixture: 'video_short1.webm'- }- return uploadVideo(servers[numServer].url, servers[numServer].accessToken, videoAttributes)-}--async function update (servers: ServerInfo[], numServer: number) {- const res = await getVideosList(servers[numServer].url)-- const videos = res.body.data.filter(video => video.isLocal === true)- if (videos.length === 0) return undefined-- const toUpdate = videos[getRandomInt(0, videos.length)].id- const attributes = {- name: Date.now() + ' name',- description: Date.now() + ' description',- tags: [ Date.now().toString().substring(0, 5) + 't1', Date.now().toString().substring(0, 5) + 't2' ]- }-- console.log('Updating video of server ' + numServer)-- return updateVideo(servers[numServer].url, servers[numServer].accessToken, toUpdate, attributes)-}--async function remove (servers: ServerInfo[], numServer: number) {- const res = await getVideosList(servers[numServer].url)- const videos = res.body.data.filter(video => video.isLocal === true)- if (videos.length === 0) return undefined-- const toRemove = videos[getRandomInt(0, videos.length)].id-- console.log('Removing video from server ' + numServer)- return removeVideo(servers[numServer].url, servers[numServer].accessToken, toRemove)-}--async function view (servers: ServerInfo[], numServer: number) {- const res = await getVideosList(servers[numServer].url)-- const videos = res.body.data- if (videos.length === 0) return undefined-- const toView = videos[getRandomInt(0, videos.length)].id-- console.log('Viewing video from server ' + numServer)- return viewVideo(servers[numServer].url, toView)-}--function like (servers: ServerInfo[], numServer: number) {- return rate(servers, numServer, 'like')-}--function dislike (servers: ServerInfo[], numServer: number) {- return rate(servers, numServer, 'dislike')-}--async function rate (servers: ServerInfo[], numServer: number, rating: VideoRateType) {- const res = await getVideosList(servers[numServer].url)-- const videos = res.body.data- if (videos.length === 0) return undefined-- const toRate = videos[getRandomInt(0, videos.length)].id-- console.log('Rating (%s) video from server %d', rating, numServer)- return getVideo(servers[numServer].url, toRate)-}--async function checkIntegrity (servers: ServerInfo[]) {- const videos: Video[][] = []- const tasks: Promise<any>[] = []-- // Fetch all videos and remove some fields that can differ between servers- for (const server of servers) {- const p = getVideosListPagination(server.url, 0, 1000000, '-createdAt')- .then(res => videos.push(res.body.data))- tasks.push(p)- }-- await Promise.all(tasks)-- let i = 0- for (const video of videos) {- const differences = areDifferences(video, videos[0])- if (differences !== undefined) {- console.error('Integrity not ok with server %d!', i + 1)-- if (displayDiffOnFail) {- console.log(differences)- }-- process.exit(-1)- }-- i++- }-- console.log('Integrity ok.')-}--function areDifferences (videos1: Video[], videos2: Video[]) {- // Remove some keys we don't want to compare- videos1.concat(videos2).forEach(video => {- delete video.id- delete video.isLocal- delete video.thumbnailPath- delete video.updatedAt- delete video.views- })-- if (videos1.length !== videos2.length) {- return `Videos length are different (${videos1.length}/${videos2.length}).`- }-- for (const video1 of videos1) {- const video2 = videos2.find(video => video.uuid === video1.uuid)-- if (!video2) return 'Video ' + video1.uuid + ' is missing.'-- for (const videoKey of Object.keys(video1)) {- const attribute1 = video1[videoKey]- const attribute2 = video2[videoKey]-- if (videoKey === 'tags') {- if (attribute1.length !== attribute2.length) {- return 'Tags are different.'- }-- attribute1.forEach(tag1 => {- if (attribute2.indexOf(tag1) === -1) {- return 'Tag ' + tag1 + ' is missing.'- }- })- } else if (videoKey === 'files') {- if (attribute1.length !== attribute2.length) {- return 'Video files are different.'- }-- attribute1.forEach((videoFile1: VideoFile) => {- const videoFile2: VideoFile = attribute2.find(videoFile => videoFile.magnetUri === videoFile1.magnetUri)- if (!videoFile2) {- return `Video ${video1.uuid} has missing video file ${videoFile1.magnetUri}.`- }-- if (videoFile1.size !== videoFile2.size || videoFile1.resolution.label !== videoFile2.resolution.label) {- return `Video ${video1.uuid} has different video file ${videoFile1.magnetUri}.`- }- })- } else {- if (attribute1 !== attribute2) {- return `Video ${video1.uuid} has different value for attribute ${videoKey}.`- }- }- }- }-- return undefined-}--function goodbye () {- return process.exit(-1)-}--async function isTherePendingRequests (servers: ServerInfo[]) {- const states: JobState[] = [ 'waiting', 'active', 'delayed' ]- const tasks: Promise<any>[] = []- let pendingRequests = false-- // Check if each server has pending request- for (const server of servers) {- for (const state of states) {- const p = getJobsListPaginationAndSort({- url: server.url,- accessToken: server.accessToken,- state: state,- start: 0,- count: 10,- sort: '-createdAt'- })- .then(res => {- if (res.body.total > 0) pendingRequests = true- })- tasks.push(p)- }- }-- await Promise.all(tasks)-- return pendingRequests-}diff --git a/server/tools/cli.ts b/server/tools/cli.tsindex 15ac6c6a8c..d1a631b69e 100644--- a/server/tools/cli.ts+++ b/server/tools/cli.ts@@ -31,7 +31,7 @@ async function getAdminTokenOrDie (url: string, username: string, password: stri}interface Settings {- remotes: any[],+ remotes: any[]default: number}@@ -90,9 +90,9 @@ function getRemoteObjectOrDie (if (!program['url'] || !program['username'] || !program['password']) {// No remote and we don't have program parameters: quitif (settings.remotes.length === 0 || Object.keys(netrc.machines).length === 0) {- if (!program[ 'url' ]) console.error('--url field is required.')- if (!program[ 'username' ]) console.error('--username field is required.')- if (!program[ 'password' ]) console.error('--password field is required.')+ if (!program['url']) console.error('--url field is required.')+ if (!program['username']) console.error('--username field is required.')+ if (!program['password']) console.error('--password field is required.')return process.exit(-1)}@@ -112,9 +112,9 @@ function getRemoteObjectOrDie (}return {- url: program[ 'url' ],- username: program[ 'username' ],- password: program[ 'password' ]+ url: program['url'],+ username: program['username'],+ password: program['password']}}@@ -150,8 +150,8 @@ async function buildVideoAttributesFromCommander (url: string, command: Command,const booleanAttributes: { [id in keyof typeof defaultBooleanAttributes]: boolean } | {} = {}for (const key of Object.keys(defaultBooleanAttributes)) {- if (command[ key ] !== undefined) {- booleanAttributes[key] = command[ key ]+ if (command[key] !== undefined) {+ booleanAttributes[key] = command[key]} else if (defaultAttributes[key] !== undefined) {booleanAttributes[key] = defaultAttributes[key]} else {@@ -160,19 +160,19 @@ async function buildVideoAttributesFromCommander (url: string, command: Command,}const videoAttributes = {- name: command[ 'videoName' ] || defaultAttributes.name,- category: command[ 'category' ] || defaultAttributes.category || undefined,- licence: command[ 'licence' ] || defaultAttributes.licence || undefined,- language: command[ 'language' ] || defaultAttributes.language || undefined,- privacy: command[ 'privacy' ] || defaultAttributes.privacy || VideoPrivacy.PUBLIC,- support: command[ 'support' ] || defaultAttributes.support || undefined,- description: command[ 'videoDescription' ] || defaultAttributes.description || undefined,- tags: command[ 'tags' ] || defaultAttributes.tags || undefined+ name: command['videoName'] || defaultAttributes.name,+ category: command['category'] || defaultAttributes.category || undefined,+ licence: command['licence'] || defaultAttributes.licence || undefined,+ language: command['language'] || defaultAttributes.language || undefined,+ privacy: command['privacy'] || defaultAttributes.privacy || VideoPrivacy.PUBLIC,+ support: command['support'] || defaultAttributes.support || undefined,+ description: command['videoDescription'] || defaultAttributes.description || undefined,+ tags: command['tags'] || defaultAttributes.tags || undefined}Object.assign(videoAttributes, booleanAttributes)- if (command[ 'channelName' ]) {+ if (command['channelName']) {const res = await getVideoChannel(url, command['channelName'])const videoChannel: VideoChannel = res.body@@ -188,9 +188,9 @@ async function buildVideoAttributesFromCommander (url: string, command: Command,function getServerCredentials (program: any) {return Promise.all([ getSettings(), getNetrc() ])- .then(([ settings, netrc ]) => {- return getRemoteObjectOrDie(program, settings, netrc)- })+ .then(([ settings, netrc ]) => {+ return getRemoteObjectOrDie(program, settings, netrc)+ })}function getLogger (logLevel = 'info') {diff --git a/server/tools/peertube-auth.ts b/server/tools/peertube-auth.tsindex acac750346..6b486e5751 100644--- a/server/tools/peertube-auth.ts+++ b/server/tools/peertube-auth.ts@@ -1,3 +1,5 @@+// eslint-disable @typescript-eslint/no-unnecessary-type-assertion+import { registerTSPaths } from '../helpers/register-ts-paths'registerTSPaths()@@ -5,7 +7,7 @@ import * as program from 'commander'import * as prompt from 'prompt'import { getNetrc, getSettings, writeSettings } from './cli'import { isUserUsernameValid } from '../helpers/custom-validators/users'-import { getAccessToken, login } from '../../shared/extra-utils'+import { getAccessToken } from '../../shared/extra-utils'import * as CliTable3 from 'cli-table3'async function delInstance (url: string) {@@ -108,9 +110,9 @@ programconst [ settings, netrc ] = await Promise.all([ getSettings(), getNetrc() ])const table = new CliTable3({- head: ['instance', 'login'],- colWidths: [30, 30]- }) as CliTable3.HorizontalTable+ head: [ 'instance', 'login' ],+ colWidths: [ 30, 30 ]+ }) as anysettings.remotes.forEach(element => {if (!netrc.machines[element]) returndiff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.tsindex c7e85b570b..0efe87810c 100644--- a/server/tools/peertube-import-videos.ts+++ b/server/tools/peertube-import-videos.ts@@ -12,7 +12,7 @@ import { accessSync, constants } from 'fs'import { remove } from 'fs-extra'import { sha256 } from '../helpers/core-utils'import { buildOriginallyPublishedAt, safeGetYoutubeDL } from '../helpers/youtube-dl'-import { buildCommonVideoOptions, buildVideoAttributesFromCommander, getServerCredentials, getLogger } from './cli'+import { buildCommonVideoOptions, buildVideoAttributesFromCommander, getLogger, getServerCredentials } from './cli'type UserInfo = {username: string@@ -40,30 +40,29 @@ command.option('-T, --tmpdir <tmpdir>', 'Working directory', __dirname).parse(process.argv)-let log = getLogger(program[ 'verbose' ])+const log = getLogger(program['verbose'])getServerCredentials(command).then(({ url, username, password }) => {- if (!program[ 'targetUrl' ]) {+ if (!program['targetUrl']) {exitError('--target-url field is required.')}try {- accessSync(program[ 'tmpdir' ], constants.R_OK | constants.W_OK)+ accessSync(program['tmpdir'], constants.R_OK | constants.W_OK)} catch (e) {- exitError('--tmpdir %s: directory does not exist or is not accessible', program[ 'tmpdir' ])+ exitError('--tmpdir %s: directory does not exist or is not accessible', program['tmpdir'])}url = normalizeTargetUrl(url)- program[ 'targetUrl' ] = normalizeTargetUrl(program[ 'targetUrl' ])+ program['targetUrl'] = normalizeTargetUrl(program['targetUrl'])const user = { username, password }run(url, user)- .catch(err => {- exitError(err)- })+ .catch(err => exitError(err))})+ .catch(err => console.error(err))async function run (url: string, user: UserInfo) {if (!user.password) {@@ -73,7 +72,7 @@ async function run (url: string, user: UserInfo) {const youtubeDL = await safeGetYoutubeDL()const options = [ '-j', '--flat-playlist', '--playlist-reverse' ]- youtubeDL.getInfo(program[ 'targetUrl' ], options, processOptions, async (err, info) => {+ youtubeDL.getInfo(program['targetUrl'], options, processOptions, async (err, info) => {if (err) {exitError(err.message)}@@ -82,10 +81,10 @@ async function run (url: string, user: UserInfo) {// Normalize utf8 fieldsinfoArray = [].concat(info)- if (program[ 'first' ]) {- infoArray = infoArray.slice(0, program[ 'first' ])- } else if (program[ 'last' ]) {- infoArray = infoArray.slice(-program[ 'last' ])+ if (program['first']) {+ infoArray = infoArray.slice(0, program['first'])+ } else if (program['last']) {+ infoArray = infoArray.slice(-program['last'])}infoArray = infoArray.map(i => normalizeObject(i))@@ -93,22 +92,22 @@ async function run (url: string, user: UserInfo) {for (const info of infoArray) {await processVideo({- cwd: program[ 'tmpdir' ],+ cwd: program['tmpdir'],url,user,youtubeInfo: info})}- log.info('Video/s for user %s imported: %s', user.username, program[ 'targetUrl' ])+ log.info('Video/s for user %s imported: %s', user.username, program['targetUrl'])process.exit(0)})}function processVideo (parameters: {- cwd: string,- url: string,- user: { username: string, password: string },+ cwd: string+ url: string+ user: { username: string, password: string }youtubeInfo: any}) {const { youtubeInfo, cwd, url, user } = parameters@@ -119,17 +118,17 @@ function processVideo (parameters: {const videoInfo = await fetchObject(youtubeInfo)log.debug('Fetched object.', videoInfo)- if (program[ 'since' ]) {- if (buildOriginallyPublishedAt(videoInfo).getTime() < program[ 'since' ].getTime()) {+ if (program['since']) {+ if (buildOriginallyPublishedAt(videoInfo).getTime() < program['since'].getTime()) {log.info('Video "%s" has been published before "%s", don\'t upload it.\n',- videoInfo.title, formatDate(program[ 'since' ]))+ videoInfo.title, formatDate(program['since']))return res()}}- if (program[ 'until' ]) {- if (buildOriginallyPublishedAt(videoInfo).getTime() > program[ 'until' ].getTime()) {+ if (program['until']) {+ if (buildOriginallyPublishedAt(videoInfo).getTime() > program['until'].getTime()) {log.info('Video "%s" has been published after "%s", don\'t upload it.\n',- videoInfo.title, formatDate(program[ 'until' ]))+ videoInfo.title, formatDate(program['until']))return res()}}@@ -174,11 +173,11 @@ function processVideo (parameters: {}async function uploadVideoOnPeerTube (parameters: {- videoInfo: any,- videoPath: string,- cwd: string,- url: string,- user: { username: string; password: string }+ videoInfo: any+ videoPath: string+ cwd: string+ url: string+ user: { username: string, password: string }}) {const { videoInfo, videoPath, cwd, url, user } = parameters@@ -206,9 +205,9 @@ async function uploadVideoOnPeerTube (parameters: {const defaultAttributes = {name: truncate(videoInfo.title, {- 'length': CONSTRAINTS_FIELDS.VIDEOS.NAME.max,- 'separator': /,? +/,- 'omission': ' […]'+ length: CONSTRAINTS_FIELDS.VIDEOS.NAME.max,+ separator: /,? +/,+ omission: ' […]'}),category,licence,@@ -255,7 +254,7 @@ async function uploadVideoOnPeerTube (parameters: {async function getCategory (categories: string[], url: string) {if (!categories) return undefined- const categoryString = categories[ 0 ]+ const categoryString = categories[0]if (categoryString === 'News & Politics') return 11@@ -263,7 +262,7 @@ async function getCategory (categories: string[], url: string) {const categoriesServer = res.bodyfor (const key of Object.keys(categoriesServer)) {- const categoryServer = categoriesServer[ key ]+ const categoryServer = categoriesServer[key]if (categoryString.toLowerCase() === categoryServer.toLowerCase()) return parseInt(key, 10)}@@ -285,12 +284,12 @@ function normalizeObject (obj: any) {// Deprecated keyif (key === 'resolution') continue- const value = obj[ key ]+ const value = obj[key]if (typeof value === 'string') {- newObj[ key ] = value.normalize()+ newObj[key] = value.normalize()} else {- newObj[ key ] = value+ newObj[key] = value}}@@ -302,7 +301,7 @@ function fetchObject (info: any) {return new Promise<any>(async (res, rej) => {const youtubeDL = await safeGetYoutubeDL()- youtubeDL.getInfo(url, undefined, processOptions, async (err, videoInfo) => {+ youtubeDL.getInfo(url, undefined, processOptions, (err, videoInfo) => {if (err) return rej(err)const videoInfoWithUrl = Object.assign(videoInfo, { url })@@ -313,10 +312,10 @@ function fetchObject (info: any) {function buildUrl (info: any) {const webpageUrl = info.webpage_url as string- if (webpageUrl && webpageUrl.match(/^https?:\/\//)) return webpageUrl+ if (webpageUrl?.match(/^https?:\/\//)) return webpageUrlconst url = info.url as string- if (url && url.match(/^https?:\/\//)) return url+ if (url?.match(/^https?:\/\//)) return url// It seems youtube-dl does not return the video urlreturn 'https://www.youtube.com/watch?v=' + info.id@@ -384,7 +383,7 @@ function parseDate (dateAsStr: string): Date {}function formatDate (date: Date): string {- return date.toISOString().split('T')[ 0 ]+ return date.toISOString().split('T')[0]}function exitError (message: string, ...meta: any[]) {diff --git a/server/tools/peertube-plugins.ts b/server/tools/peertube-plugins.tsindex b341c14c11..05b75fab2b 100644--- a/server/tools/peertube-plugins.ts+++ b/server/tools/peertube-plugins.ts@@ -1,3 +1,5 @@+// eslint-disable @typescript-eslint/no-unnecessary-type-assertion+import { registerTSPaths } from '../helpers/register-ts-paths'registerTSPaths()@@ -79,9 +81,9 @@ async function pluginsListCLI () {const plugins: PeerTubePlugin[] = res.body.dataconst table = new CliTable3({- head: ['name', 'version', 'homepage'],+ head: [ 'name', 'version', 'homepage' ],colWidths: [ 50, 10, 50 ]- }) as CliTable3.HorizontalTable+ }) as anyfor (const plugin of plugins) {const npmName = plugin.type === PluginType.PLUGIN@@ -124,7 +126,6 @@ async function installPluginCLI (options: any) {} catch (err) {console.error('Cannot install plugin.', err)process.exit(-1)- return}console.log('Plugin installed.')@@ -156,7 +157,6 @@ async function updatePluginCLI (options: any) {} catch (err) {console.error('Cannot update plugin.', err)process.exit(-1)- return}console.log('Plugin updated.')@@ -177,12 +177,11 @@ async function uninstallPluginCLI (options: any) {await uninstallPlugin({url,accessToken,- npmName: options[ 'npmName' ]+ npmName: options['npmName']})} catch (err) {console.error('Cannot uninstall plugin.', err)process.exit(-1)- return}console.log('Plugin uninstalled.')diff --git a/server/tools/peertube-redundancy.ts b/server/tools/peertube-redundancy.tsindex a71f48104e..1ab58a438f 100644--- a/server/tools/peertube-redundancy.ts+++ b/server/tools/peertube-redundancy.ts@@ -1,3 +1,5 @@+// eslint-disable @typescript-eslint/no-unnecessary-type-assertion+import { registerTSPaths } from '../helpers/register-ts-paths'registerTSPaths()@@ -6,11 +8,12 @@ import { getAdminTokenOrDie, getServerCredentials } from './cli'import { VideoRedundanciesTarget, VideoRedundancy } from '@shared/models'import { addVideoRedundancy, listVideoRedundancies, removeVideoRedundancy } from '@shared/extra-utils/server/redundancy'import validator from 'validator'-import bytes = require('bytes')import * as CliTable3 from 'cli-table3'-import { parse } from 'url'+import { URL } from 'url'import { uniq } from 'lodash'+import bytes = require('bytes')+program.name('plugins').usage('[command] [options]')@@ -65,7 +68,7 @@ async function listRedundanciesCLI (target: VideoRedundanciesTarget) {const table = new CliTable3({head: [ 'video id', 'video name', 'video url', 'files', 'playlists', 'by instances', 'total size' ]- }) as CliTable3.HorizontalTable+ }) as anyfor (const redundancy of redundancies) {const webtorrentFiles = redundancy.redundancies.files@@ -82,7 +85,7 @@ async function listRedundanciesCLI (target: VideoRedundanciesTarget) {const instances = uniq(webtorrentFiles.concat(streamingPlaylists).map(r => r.fileUrl)- .map(u => parse(u).host)+ .map(u => new URL(u).host))table.push([@@ -104,7 +107,7 @@ async function addRedundancyCLI (options: { videoId: number }) {const { url, username, password } = await getServerCredentials(program)const accessToken = await getAdminTokenOrDie(url, username, password)- if (!options[ 'video' ] || validator.isInt('' + options[ 'video' ]) === false) {+ if (!options['video'] || validator.isInt('' + options['video']) === false) {console.error('You need to specify the video id to duplicate and it should be a number.\n')program.outputHelp()process.exit(-1)@@ -114,7 +117,7 @@ async function addRedundancyCLI (options: { videoId: number }) {await addVideoRedundancy({url,accessToken,- videoId: options[ 'video' ]+ videoId: options['video']})console.log('Video will be duplicated by your instance!')@@ -137,13 +140,13 @@ async function removeRedundancyCLI (options: { videoId: number }) {const { url, username, password } = await getServerCredentials(program)const accessToken = await getAdminTokenOrDie(url, username, password)- if (!options[ 'video' ] || validator.isInt('' + options[ 'video' ]) === false) {+ if (!options['video'] || validator.isInt('' + options['video']) === false) {console.error('You need to specify the video id to remove from your redundancies.\n')program.outputHelp()process.exit(-1)}- const videoId = parseInt(options[ 'video' ] + '', 10)+ const videoId = parseInt(options['video'] + '', 10)let redundancies = await listVideoRedundanciesData(url, accessToken, 'my-videos')let videoRedundancy = redundancies.find(r => videoId === r.id)diff --git a/server/tools/peertube-repl.ts b/server/tools/peertube-repl.tsindex ab6e215d9d..7c936ae0d8 100644--- a/server/tools/peertube-repl.ts+++ b/server/tools/peertube-repl.ts@@ -1,6 +1,4 @@import { registerTSPaths } from '../helpers/register-ts-paths'-registerTSPaths()-import * as repl from 'repl'import * as path from 'path'import * as _ from 'lodash'@@ -23,6 +21,8 @@ import * as signupUtils from '../helpers/signup'import * as utils from '../helpers/utils'import * as YoutubeDLUtils from '../helpers/youtube-dl'+registerTSPaths()+const start = async () => {await initDatabaseModels(true)@@ -31,22 +31,39 @@ const start = async () => {const initContext = (replServer) => {return (context) => {const properties = {- context, repl: replServer, env: process.env,- lodash: _, path,- uuidv1, uuidv3, uuidv4, uuidv5,- cli, logger, constants,- Sequelize, sequelizeTypescript, modelsUtils,- models: sequelizeTypescript.models, transaction: sequelizeTypescript.transaction,- query: sequelizeTypescript.query, queryInterface: sequelizeTypescript.getQueryInterface(),+ context,+ repl: replServer,+ env: process.env,+ lodash: _,+ path,+ uuidv1,+ uuidv3,+ uuidv4,+ uuidv5,+ cli,+ logger,+ constants,+ Sequelize,+ sequelizeTypescript,+ modelsUtils,+ models: sequelizeTypescript.models,+ transaction: sequelizeTypescript.transaction,+ query: sequelizeTypescript.query,+ queryInterface: sequelizeTypescript.getQueryInterface(),YoutubeDL,- coreUtils, ffmpegUtils, peertubeCryptoUtils, signupUtils, utils, YoutubeDLUtils+ coreUtils,+ ffmpegUtils,+ peertubeCryptoUtils,+ signupUtils,+ utils,+ YoutubeDLUtils}- for (let prop in properties) {+ for (const prop in properties) {Object.defineProperty(context, prop, {configurable: false,enumerable: true,- value: properties[ prop ]+ value: properties[prop]})}}diff --git a/server/tools/peertube-upload.ts b/server/tools/peertube-upload.tsindex f604c9bee8..8de952e7b3 100644--- a/server/tools/peertube-upload.ts+++ b/server/tools/peertube-upload.ts@@ -24,14 +24,14 @@ commandgetServerCredentials(command).then(({ url, username, password }) => {- if (!program[ 'videoName' ] || !program[ 'file' ]) {- if (!program[ 'videoName' ]) console.error('--video-name is required.')- if (!program[ 'file' ]) console.error('--file is required.')+ if (!program['videoName'] || !program['file']) {+ if (!program['videoName']) console.error('--video-name is required.')+ if (!program['file']) console.error('--file is required.')process.exit(-1)}- if (isAbsolute(program[ 'file' ]) === false) {+ if (isAbsolute(program['file']) === false) {console.error('File path should be absolute.')process.exit(-1)}@@ -41,25 +41,26 @@ getServerCredentials(command)process.exit(-1)})})+ .catch(err => console.error(err))async function run (url: string, username: string, password: string) {const accessToken = await getAccessToken(url, username, password)- await access(program[ 'file' ], constants.F_OK)+ await access(program['file'], constants.F_OK)- console.log('Uploading %s video...', program[ 'videoName' ])+ console.log('Uploading %s video...', program['videoName'])const videoAttributes = await buildVideoAttributesFromCommander(url, program)Object.assign(videoAttributes, {- fixture: program[ 'file' ],- thumbnailfile: program[ 'thumbnail' ],- previewfile: program[ 'preview' ]+ fixture: program['file'],+ thumbnailfile: program['thumbnail'],+ previewfile: program['preview']})try {await uploadVideo(url, accessToken, videoAttributes)- console.log(`Video ${program[ 'videoName' ]} uploaded.`)+ console.log(`Video ${program['videoName']} uploaded.`)process.exit(0)} catch (err) {console.error(require('util').inspect(err))diff --git a/server/tools/peertube-watch.ts b/server/tools/peertube-watch.tsindex 9ac1d05f91..5f7d1bb07d 100644--- a/server/tools/peertube-watch.ts+++ b/server/tools/peertube-watch.ts@@ -29,16 +29,10 @@ programconsole.log(' $ peertube watch https://peertube.cpy.re/videos/watch/e8a1af4e-414a-4d58-bfe6-2146eed06d10')console.log()})- .action((url, cmd) => {- run(url, cmd)- .catch(err => {- console.error(err)- process.exit(-1)- })- })+ .action((url, cmd) => run(url, cmd)).parse(process.argv)-async function run (url: string, program: any) {+function run (url: string, program: any) {if (!url) {console.error('<url> positional argument is required.')process.exit(-1)diff --git a/server/tools/peertube.ts b/server/tools/peertube.tsindex 9883bbf05b..88dd5f7f6c 100644--- a/server/tools/peertube.ts+++ b/server/tools/peertube.ts@@ -1,13 +1,12 @@#!/usr/bin/env node+/* eslint-disable no-useless-escape */+import { registerTSPaths } from '../helpers/register-ts-paths'registerTSPaths()import * as program from 'commander'-import {- version,- getSettings-} from './cli'+import { getSettings, version } from './cli'program.version(version, '-v, --version')@@ -26,14 +25,15 @@ program/* Not Yet Implemented */program- .command('diagnostic [action]',- 'like couple therapy, but for your instance',- { noHelp: true } as program.CommandOptions- ).alias('d')+ .command(+ 'diagnostic [action]',+ 'like couple therapy, but for your instance',+ { noHelp: true } as program.CommandOptions+ ).alias('d').command('admin',- 'manage an instance where you have elevated rights',- { noHelp: true } as program.CommandOptions- ).alias('a')+ 'manage an instance where you have elevated rights',+ { noHelp: true } as program.CommandOptions+ ).alias('a')// help on no commandif (!process.argv.slice(2).length) {@@ -82,3 +82,4 @@ getSettings()}).parse(process.argv)})+ .catch(err => console.error(err))diff --git a/server/typings/models/account/account-blocklist.ts b/server/typings/models/account/account-blocklist.tsindex c9cb553325..0d8bf11bd9 100644--- a/server/typings/models/account/account-blocklist.ts+++ b/server/typings/models/account/account-blocklist.ts@@ -12,7 +12,8 @@ export type MAccountBlocklist = Omit<AccountBlocklistModel, 'ByAccount' | 'Blockexport type MAccountBlocklistId = Pick<AccountBlocklistModel, 'id'>-export type MAccountBlocklistAccounts = MAccountBlocklist &+export type MAccountBlocklistAccounts =+ MAccountBlocklist &Use<'ByAccount', MAccountDefault> &Use<'BlockedAccount', MAccountDefault>@@ -20,6 +21,7 @@ export type MAccountBlocklistAccounts = MAccountBlocklist &// Format for API or AP object-export type MAccountBlocklistFormattable = Pick<MAccountBlocklist, 'createdAt'> &+export type MAccountBlocklistFormattable =+ Pick<MAccountBlocklist, 'createdAt'> &Use<'ByAccount', MAccountFormattable> &Use<'BlockedAccount', MAccountFormattable>diff --git a/server/typings/models/account/account.ts b/server/typings/models/account/account.tsindex adb1f36893..7b826ee046 100644--- a/server/typings/models/account/account.ts+++ b/server/typings/models/account/account.ts@@ -21,7 +21,8 @@ type Use<K extends keyof AccountModel, M> = PickWith<AccountModel, K, M>// ############################################################################-export type MAccount = Omit<AccountModel, 'Actor' | 'User' | 'Application' | 'VideoChannels' | 'VideoPlaylists' |+export type MAccount =+ Omit<AccountModel, 'Actor' | 'User' | 'Application' | 'VideoChannels' | 'VideoPlaylists' |'VideoComments' | 'BlockedAccounts'>// ############################################################################@@ -34,62 +35,75 @@ export type MAccountUserId = Pick<MAccount, 'userId'>export type MAccountUrl = Use<'Actor', MActorUrl>export type MAccountAudience = Use<'Actor', MActorAudience>-export type MAccountIdActor = MAccountId &+export type MAccountIdActor =+ MAccountId &Use<'Actor', MActor>-export type MAccountIdActorId = MAccountId &+export type MAccountIdActorId =+ MAccountId &Use<'Actor', MActorId>// ############################################################################// Default scope-export type MAccountDefault = MAccount &+export type MAccountDefault =+ MAccount &Use<'Actor', MActorDefault>// Default with default association scopes-export type MAccountDefaultChannelDefault = MAccount &+export type MAccountDefaultChannelDefault =+ MAccount &Use<'Actor', MActorDefault> &Use<'VideoChannels', MChannelDefault[]>// We don't need some actors attributes-export type MAccountLight = MAccount &+export type MAccountLight =+ MAccount &Use<'Actor', MActorDefaultLight>// ############################################################################// Full actor-export type MAccountActor = MAccount &+export type MAccountActor =+ MAccount &Use<'Actor', MActor>// Full actor with server-export type MAccountServer = MAccount &+export type MAccountServer =+ MAccount &Use<'Actor', MActorServer>// ############################################################################// For API-export type MAccountSummary = FunctionProperties<MAccount> &+export type MAccountSummary =+ FunctionProperties<MAccount> &Pick<MAccount, 'id' | 'name'> &Use<'Actor', MActorSummary>-export type MAccountSummaryBlocks = MAccountSummary &+export type MAccountSummaryBlocks =+ MAccountSummary &Use<'BlockedAccounts', MAccountBlocklistId[]>-export type MAccountAPI = MAccount &+export type MAccountAPI =+ MAccount &Use<'Actor', MActorAPI>// ############################################################################// Format for API or AP object-export type MAccountSummaryFormattable = FunctionProperties<MAccount> &+export type MAccountSummaryFormattable =+ FunctionProperties<MAccount> &Pick<MAccount, 'id' | 'name'> &Use<'Actor', MActorSummaryFormattable>-export type MAccountFormattable = FunctionProperties<MAccount> &+export type MAccountFormattable =+ FunctionProperties<MAccount> &Pick<MAccount, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'userId'> &Use<'Actor', MActorFormattable>-export type MAccountAP = Pick<MAccount, 'name' | 'description'> &+export type MAccountAP =+ Pick<MAccount, 'name' | 'description'> &Use<'Actor', MActorAP>diff --git a/server/typings/models/account/actor-follow.ts b/server/typings/models/account/actor-follow.tsindex f44157eba1..5d0c03c8d5 100644--- a/server/typings/models/account/actor-follow.ts+++ b/server/typings/models/account/actor-follow.ts@@ -20,22 +20,26 @@ export type MActorFollow = Omit<ActorFollowModel, 'ActorFollower' | 'ActorFollow// ############################################################################-export type MActorFollowFollowingHost = MActorFollow &+export type MActorFollowFollowingHost =+ MActorFollow &Use<'ActorFollowing', MActorUsername & MActorHost>// ############################################################################// With actors or actors default-export type MActorFollowActors = MActorFollow &+export type MActorFollowActors =+ MActorFollow &Use<'ActorFollower', MActor> &Use<'ActorFollowing', MActor>-export type MActorFollowActorsDefault = MActorFollow &+export type MActorFollowActorsDefault =+ MActorFollow &Use<'ActorFollower', MActorDefault> &Use<'ActorFollowing', MActorDefault>-export type MActorFollowFull = MActorFollow &+export type MActorFollowFull =+ MActorFollow &Use<'ActorFollower', MActorDefaultAccountChannel> &Use<'ActorFollowing', MActorDefaultAccountChannel>@@ -43,20 +47,24 @@ export type MActorFollowFull = MActorFollow &// For subscriptions-type SubscriptionFollowing = MActorDefault &+type SubscriptionFollowing =+ MActorDefault &PickWith<ActorModel, 'VideoChannel', MChannelDefault>-export type MActorFollowActorsDefaultSubscription = MActorFollow &+export type MActorFollowActorsDefaultSubscription =+ MActorFollow &Use<'ActorFollower', MActorDefault> &Use<'ActorFollowing', SubscriptionFollowing>-export type MActorFollowSubscriptions = MActorFollow &+export type MActorFollowSubscriptions =+ MActorFollow &Use<'ActorFollowing', MActorChannelAccountActor>// ############################################################################// Format for API or AP object-export type MActorFollowFormattable = Pick<MActorFollow, 'id' | 'score' | 'state' | 'createdAt' | 'updatedAt'> &+export type MActorFollowFormattable =+ Pick<MActorFollow, 'id' | 'score' | 'state' | 'createdAt' | 'updatedAt'> &Use<'ActorFollower', MActorFormattable> &Use<'ActorFollowing', MActorFormattable>diff --git a/server/typings/models/account/actor.ts b/server/typings/models/account/actor.tsindex ee4ece755b..1160e84cb7 100644--- a/server/typings/models/account/actor.ts+++ b/server/typings/models/account/actor.ts@@ -31,18 +31,23 @@ export type MActorLight = Omit<MActor, 'privateKey' | 'privateKey'>export type MActorHost = Use<'Server', MServerHost>export type MActorRedundancyAllowedOpt = PickWithOpt<ActorModel, 'Server', MServerRedundancyAllowed>-export type MActorDefaultLight = MActorLight &+export type MActorDefaultLight =+ MActorLight &Use<'Server', MServerHost> &Use<'Avatar', MAvatar>-export type MActorAccountId = MActor &+export type MActorAccountId =+ MActor &Use<'Account', MAccountId>-export type MActorAccountIdActor = MActor &+export type MActorAccountIdActor =+ MActor &Use<'Account', MAccountIdActor>-export type MActorChannelId = MActor &+export type MActorChannelId =+ MActor &Use<'VideoChannel', MChannelId>-export type MActorChannelIdActor = MActor &+export type MActorChannelIdActor =+ MActor &Use<'VideoChannel', MChannelIdActor>export type MActorAccountChannelId = MActorAccountId & MActorChannelId@@ -52,38 +57,45 @@ export type MActorAccountChannelIdActor = MActorAccountIdActor & MActorChannelId// Include raw account/channel/server-export type MActorAccount = MActor &+export type MActorAccount =+ MActor &Use<'Account', MAccount>-export type MActorChannel = MActor &+export type MActorChannel =+ MActor &Use<'VideoChannel', MChannel>export type MActorDefaultAccountChannel = MActorDefault & MActorAccount & MActorChannel-export type MActorServer = MActor &+export type MActorServer =+ MActor &Use<'Server', MServer>// ############################################################################// Complex actor associations-export type MActorDefault = MActor &+export type MActorDefault =+ MActor &Use<'Server', MServer> &Use<'Avatar', MAvatar>// Actor with channel that is associated to an account and its actor// Actor -> VideoChannel -> Account -> Actor-export type MActorChannelAccountActor = MActor &+export type MActorChannelAccountActor =+ MActor &Use<'VideoChannel', MChannelAccountActor>-export type MActorFull = MActor &+export type MActorFull =+ MActor &Use<'Server', MServer> &Use<'Avatar', MAvatar> &Use<'Account', MAccount> &Use<'VideoChannel', MChannelAccountActor>// Same than ActorFull, but the account and the channel have their actor-export type MActorFullActor = MActor &+export type MActorFullActor =+ MActor &Use<'Server', MServer> &Use<'Avatar', MAvatar> &Use<'Account', MAccountDefault> &@@ -93,29 +105,35 @@ export type MActorFullActor = MActor &// API-export type MActorSummary = FunctionProperties<MActor> &+export type MActorSummary =+ FunctionProperties<MActor> &Pick<MActor, 'id' | 'preferredUsername' | 'url' | 'serverId' | 'avatarId'> &Use<'Server', MServerHost> &Use<'Avatar', MAvatar>-export type MActorSummaryBlocks = MActorSummary &+export type MActorSummaryBlocks =+ MActorSummary &Use<'Server', MServerHostBlocks>-export type MActorAPI = Omit<MActorDefault, 'publicKey' | 'privateKey' | 'inboxUrl' | 'outboxUrl' | 'sharedInboxUrl' |+export type MActorAPI =+ Omit<MActorDefault, 'publicKey' | 'privateKey' | 'inboxUrl' | 'outboxUrl' | 'sharedInboxUrl' |'followersUrl' | 'followingUrl' | 'url' | 'createdAt' | 'updatedAt'>// ############################################################################// Format for API or AP object-export type MActorSummaryFormattable = FunctionProperties<MActor> &+export type MActorSummaryFormattable =+ FunctionProperties<MActor> &Pick<MActor, 'url' | 'preferredUsername'> &Use<'Server', MServerHost> &Use<'Avatar', MAvatarFormattable>-export type MActorFormattable = MActorSummaryFormattable &+export type MActorFormattable =+ MActorSummaryFormattable &Pick<MActor, 'id' | 'followingCount' | 'followersCount' | 'createdAt' | 'updatedAt'> &Use<'Server', MServerHost & Partial<Pick<MServer, 'redundancyAllowed'>>>-export type MActorAP = MActor &+export type MActorAP =+ MActor &Use<'Avatar', MAvatar>diff --git a/server/typings/models/account/avatar.ts b/server/typings/models/account/avatar.tsindex 8af6cc7877..21b47180f7 100644--- a/server/typings/models/account/avatar.ts+++ b/server/typings/models/account/avatar.ts@@ -7,5 +7,6 @@ export type MAvatar = AvatarModel// Format for API or AP object-export type MAvatarFormattable = FunctionProperties<MAvatar> &+export type MAvatarFormattable =+ FunctionProperties<MAvatar> &Pick<MAvatar, 'filename' | 'createdAt' | 'updatedAt'>diff --git a/server/typings/models/oauth/oauth-token.ts b/server/typings/models/oauth/oauth-token.tsindex 8ef042d4e8..b24a95fd89 100644--- a/server/typings/models/oauth/oauth-token.ts+++ b/server/typings/models/oauth/oauth-token.ts@@ -8,6 +8,7 @@ type Use<K extends keyof OAuthTokenModel, M> = PickWith<OAuthTokenModel, K, M>export type MOAuthToken = Omit<OAuthTokenModel, 'User' | 'OAuthClients'>-export type MOAuthTokenUser = MOAuthToken &+export type MOAuthTokenUser =+ MOAuthToken &Use<'User', MUserAccountUrl> &{ user?: MUserAccountUrl }diff --git a/server/typings/models/server/plugin.ts b/server/typings/models/server/plugin.tsindex 94674c318b..83eb837948 100644--- a/server/typings/models/server/plugin.ts+++ b/server/typings/models/server/plugin.ts@@ -6,5 +6,6 @@ export type MPlugin = PluginModel// Format for API or AP object-export type MPluginFormattable = Pick<MPlugin, 'name' | 'type' | 'version' | 'latestVersion' | 'enabled' | 'uninstalled'+export type MPluginFormattable =+ Pick<MPlugin, 'name' | 'type' | 'version' | 'latestVersion' | 'enabled' | 'uninstalled'| 'peertubeEngine' | 'description' | 'homepage' | 'settings' | 'createdAt' | 'updatedAt'>diff --git a/server/typings/models/server/server-blocklist.ts b/server/typings/models/server/server-blocklist.tsindex c3e6230f29..ff6f49176d 100644--- a/server/typings/models/server/server-blocklist.ts+++ b/server/typings/models/server/server-blocklist.ts@@ -11,7 +11,8 @@ export type MServerBlocklist = Omit<ServerBlocklistModel, 'ByAccount' | 'Blocked// ############################################################################-export type MServerBlocklistAccountServer = MServerBlocklist &+export type MServerBlocklistAccountServer =+ MServerBlocklist &Use<'ByAccount', MAccountDefault> &Use<'BlockedServer', MServer>@@ -19,6 +20,7 @@ export type MServerBlocklistAccountServer = MServerBlocklist &// Format for API or AP object-export type MServerBlocklistFormattable = Pick<MServerBlocklist, 'createdAt'> &+export type MServerBlocklistFormattable =+ Pick<MServerBlocklist, 'createdAt'> &Use<'ByAccount', MAccountFormattable> &Use<'BlockedServer', MServerFormattable>diff --git a/server/typings/models/server/server.ts b/server/typings/models/server/server.tsindex 190cc0c289..b35e55aeb5 100644--- a/server/typings/models/server/server.ts+++ b/server/typings/models/server/server.ts@@ -13,12 +13,14 @@ export type MServer = Omit<ServerModel, 'Actors' | 'BlockedByAccounts'>export type MServerHost = Pick<MServer, 'host'>export type MServerRedundancyAllowed = Pick<MServer, 'redundancyAllowed'>-export type MServerHostBlocks = MServerHost &+export type MServerHostBlocks =+ MServerHost &Use<'BlockedByAccounts', MAccountBlocklistId[]>// ############################################################################// Format for API or AP object-export type MServerFormattable = FunctionProperties<MServer> &+export type MServerFormattable =+ FunctionProperties<MServer> &Pick<MServer, 'host'>diff --git a/server/typings/models/user/user-notification.ts b/server/typings/models/user/user-notification.tsindex 1cdc691b06..2080360e12 100644--- a/server/typings/models/user/user-notification.ts+++ b/server/typings/models/user/user-notification.ts@@ -16,59 +16,73 @@ type Use<K extends keyof UserNotificationModel, M> = PickWith<UserNotificationMo// ############################################################################-export namespace UserNotificationIncludes {+export module UserNotificationIncludes {+export type VideoInclude = Pick<VideoModel, 'id' | 'uuid' | 'name'>- export type VideoIncludeChannel = VideoInclude &+ export type VideoIncludeChannel =+ VideoInclude &PickWith<VideoModel, 'VideoChannel', VideoChannelIncludeActor>- export type ActorInclude = Pick<ActorModel, 'preferredUsername' | 'getHost'> &+ export type ActorInclude =+ Pick<ActorModel, 'preferredUsername' | 'getHost'> &PickWith<ActorModel, 'Avatar', Pick<AvatarModel, 'filename' | 'getStaticPath'>> &PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>>export type VideoChannelInclude = Pick<VideoChannelModel, 'id' | 'name' | 'getDisplayName'>- export type VideoChannelIncludeActor = VideoChannelInclude &+ export type VideoChannelIncludeActor =+ VideoChannelInclude &PickWith<VideoChannelModel, 'Actor', ActorInclude>export type AccountInclude = Pick<AccountModel, 'id' | 'name' | 'getDisplayName'>- export type AccountIncludeActor = AccountInclude &+ export type AccountIncludeActor =+ AccountInclude &PickWith<AccountModel, 'Actor', ActorInclude>- export type VideoCommentInclude = Pick<VideoCommentModel, 'id' | 'originCommentId' | 'getThreadId'> &+ export type VideoCommentInclude =+ Pick<VideoCommentModel, 'id' | 'originCommentId' | 'getThreadId'> &PickWith<VideoCommentModel, 'Account', AccountIncludeActor> &PickWith<VideoCommentModel, 'Video', VideoInclude>- export type VideoAbuseInclude = Pick<VideoAbuseModel, 'id'> &+ export type VideoAbuseInclude =+ Pick<VideoAbuseModel, 'id'> &PickWith<VideoAbuseModel, 'Video', VideoInclude>- export type VideoBlacklistInclude = Pick<VideoBlacklistModel, 'id'> &+ export type VideoBlacklistInclude =+ Pick<VideoBlacklistModel, 'id'> &PickWith<VideoAbuseModel, 'Video', VideoInclude>- export type VideoImportInclude = Pick<VideoImportModel, 'id' | 'magnetUri' | 'targetUrl' | 'torrentName'> &+ export type VideoImportInclude =+ Pick<VideoImportModel, 'id' | 'magnetUri' | 'targetUrl' | 'torrentName'> &PickWith<VideoImportModel, 'Video', VideoInclude>- export type ActorFollower = Pick<ActorModel, 'preferredUsername' | 'getHost'> &+ export type ActorFollower =+ Pick<ActorModel, 'preferredUsername' | 'getHost'> &PickWith<ActorModel, 'Account', AccountInclude> &PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>> &PickWithOpt<ActorModel, 'Avatar', Pick<AvatarModel, 'filename' | 'getStaticPath'>>- export type ActorFollowing = Pick<ActorModel, 'preferredUsername' | 'type' | 'getHost'> &+ export type ActorFollowing =+ Pick<ActorModel, 'preferredUsername' | 'type' | 'getHost'> &PickWith<ActorModel, 'VideoChannel', VideoChannelInclude> &PickWith<ActorModel, 'Account', AccountInclude> &PickWith<ActorModel, 'Server', Pick<ServerModel, 'host'>>- export type ActorFollowInclude = Pick<ActorFollowModel, 'id' | 'state'> &+ export type ActorFollowInclude =+ Pick<ActorFollowModel, 'id' | 'state'> &PickWith<ActorFollowModel, 'ActorFollower', ActorFollower> &PickWith<ActorFollowModel, 'ActorFollowing', ActorFollowing>}// ############################################################################-export type MUserNotification = Omit<UserNotificationModel, 'User' | 'Video' | 'Comment' | 'VideoAbuse' | 'VideoBlacklist' |+export type MUserNotification =+ Omit<UserNotificationModel, 'User' | 'Video' | 'Comment' | 'VideoAbuse' | 'VideoBlacklist' |'VideoImport' | 'Account' | 'ActorFollow'>// ############################################################################-export type UserNotificationModelForApi = MUserNotification &+export type UserNotificationModelForApi =+ MUserNotification &Use<'Video', UserNotificationIncludes.VideoIncludeChannel> &Use<'Comment', UserNotificationIncludes.VideoCommentInclude> &Use<'VideoAbuse', UserNotificationIncludes.VideoAbuseInclude> &diff --git a/server/typings/models/user/user.ts b/server/typings/models/user/user.tsindex 6ac19c20b6..31cf075eff 100644--- a/server/typings/models/user/user.ts+++ b/server/typings/models/user/user.ts@@ -29,36 +29,44 @@ export type MUserId = Pick<UserModel, 'id'>// With account-export type MUserAccountId = MUser &+export type MUserAccountId =+ MUser &Use<'Account', MAccountId>-export type MUserAccountUrl = MUser &+export type MUserAccountUrl =+ MUser &Use<'Account', MAccountUrl & MAccountIdActorId>-export type MUserAccount = MUser &+export type MUserAccount =+ MUser &Use<'Account', MAccount>-export type MUserAccountDefault = MUser &+export type MUserAccountDefault =+ MUser &Use<'Account', MAccountDefault>// With channel-export type MUserNotifSettingChannelDefault = MUser &+export type MUserNotifSettingChannelDefault =+ MUser &Use<'NotificationSetting', MNotificationSetting> &Use<'Account', MAccountDefaultChannelDefault>// With notification settings-export type MUserWithNotificationSetting = MUser &+export type MUserWithNotificationSetting =+ MUser &Use<'NotificationSetting', MNotificationSetting>-export type MUserNotifSettingAccount = MUser &+export type MUserNotifSettingAccount =+ MUser &Use<'NotificationSetting', MNotificationSetting> &Use<'Account', MAccount>// Default scope-export type MUserDefault = MUser &+export type MUserDefault =+ MUser &Use<'NotificationSetting', MNotificationSetting> &Use<'Account', MAccountDefault>@@ -67,12 +75,15 @@ export type MUserDefault = MUser &// Format for API or AP objecttype MAccountWithChannels = MAccountFormattable & PickWithOpt<AccountModel, 'VideoChannels', MChannelFormattable[]>-type MAccountWithChannelsAndSpecialPlaylists = MAccountWithChannels &+type MAccountWithChannelsAndSpecialPlaylists =+ MAccountWithChannels &PickWithOpt<AccountModel, 'VideoPlaylists', MVideoPlaylist[]>-export type MUserFormattable = MUserQuotaUsed &+export type MUserFormattable =+ MUserQuotaUsed &Use<'Account', MAccountWithChannels> &PickWithOpt<UserModel, 'NotificationSetting', MNotificationSettingFormattable>-export type MMyUserFormattable = MUserFormattable &+export type MMyUserFormattable =+ MUserFormattable &Use<'Account', MAccountWithChannelsAndSpecialPlaylists>diff --git a/server/typings/models/video/schedule-video-update.ts b/server/typings/models/video/schedule-video-update.tsindex e6f478cdfc..95a53d1396 100644--- a/server/typings/models/video/schedule-video-update.ts+++ b/server/typings/models/video/schedule-video-update.ts@@ -10,7 +10,8 @@ export type MScheduleVideoUpdate = Omit<ScheduleVideoUpdateModel, 'Video'>// ############################################################################-export type MScheduleVideoUpdateVideoAll = MScheduleVideoUpdate &+export type MScheduleVideoUpdateVideoAll =+ MScheduleVideoUpdate &Use<'Video', MVideoAPWithoutCaption & MVideoWithBlacklistLight>// Format for API or AP objectdiff --git a/server/typings/models/video/video-abuse.ts b/server/typings/models/video/video-abuse.tsindex e38c3f5860..955ec47805 100644--- a/server/typings/models/video/video-abuse.ts+++ b/server/typings/models/video/video-abuse.ts@@ -13,11 +13,13 @@ export type MVideoAbuse = Omit<VideoAbuseModel, 'Account' | 'Video' | 'toActivitexport type MVideoAbuseId = Pick<VideoAbuseModel, 'id'>-export type MVideoAbuseVideo = MVideoAbuse &+export type MVideoAbuseVideo =+ MVideoAbuse &Pick<VideoAbuseModel, 'toActivityPubObject'> &Use<'Video', MVideo>-export type MVideoAbuseAccountVideo = MVideoAbuse &+export type MVideoAbuseAccountVideo =+ MVideoAbuse &Pick<VideoAbuseModel, 'toActivityPubObject'> &Use<'Video', MVideo> &Use<'Account', MAccountDefault>@@ -26,6 +28,7 @@ export type MVideoAbuseAccountVideo = MVideoAbuse &// Format for API or AP object-export type MVideoAbuseFormattable = MVideoAbuse &+export type MVideoAbuseFormattable =+ MVideoAbuse &Use<'Account', MAccountFormattable> &Use<'Video', Pick<MVideo, 'id' | 'uuid' | 'name'>>diff --git a/server/typings/models/video/video-blacklist.ts b/server/typings/models/video/video-blacklist.tsindex 7122a9dc00..ddb4db832f 100644--- a/server/typings/models/video/video-blacklist.ts+++ b/server/typings/models/video/video-blacklist.ts@@ -13,15 +13,18 @@ export type MVideoBlacklistUnfederated = Pick<MVideoBlacklist, 'unfederated'>// ############################################################################-export type MVideoBlacklistLightVideo = MVideoBlacklistLight &+export type MVideoBlacklistLightVideo =+ MVideoBlacklistLight &Use<'Video', MVideo>-export type MVideoBlacklistVideo = MVideoBlacklist &+export type MVideoBlacklistVideo =+ MVideoBlacklist &Use<'Video', MVideo>// ############################################################################// Format for API or AP object-export type MVideoBlacklistFormattable = MVideoBlacklist &+export type MVideoBlacklistFormattable =+ MVideoBlacklist &Use<'Video', MVideoFormattable>diff --git a/server/typings/models/video/video-caption.ts b/server/typings/models/video/video-caption.tsindex eeddedb401..e7aff69566 100644--- a/server/typings/models/video/video-caption.ts+++ b/server/typings/models/video/video-caption.ts@@ -13,13 +13,15 @@ export type MVideoCaption = Omit<VideoCaptionModel, 'Video'>export type MVideoCaptionLanguage = Pick<MVideoCaption, 'language'>export type MVideoCaptionLanguageUrl = Pick<MVideoCaption, 'language' | 'fileUrl' | 'getFileUrl'>-export type MVideoCaptionVideo = MVideoCaption &+export type MVideoCaptionVideo =+ MVideoCaption &Use<'Video', Pick<MVideo, 'id' | 'remote' | 'uuid'>>// ############################################################################// Format for API or AP object-export type MVideoCaptionFormattable = FunctionProperties<MVideoCaption> &+export type MVideoCaptionFormattable =+ FunctionProperties<MVideoCaption> &Pick<MVideoCaption, 'language'> &Use<'Video', MVideoUUID>diff --git a/server/typings/models/video/video-change-ownership.ts b/server/typings/models/video/video-change-ownership.tsindex e5b5bbc1d4..971dc3db5b 100644--- a/server/typings/models/video/video-change-ownership.ts+++ b/server/typings/models/video/video-change-ownership.ts@@ -9,7 +9,8 @@ type Use<K extends keyof VideoChangeOwnershipModel, M> = PickWith<VideoChangeOwnexport type MVideoChangeOwnership = Omit<VideoChangeOwnershipModel, 'Initiator' | 'NextOwner' | 'Video'>-export type MVideoChangeOwnershipFull = MVideoChangeOwnership &+export type MVideoChangeOwnershipFull =+ MVideoChangeOwnership &Use<'Initiator', MAccountDefault> &Use<'NextOwner', MAccountDefault> &Use<'Video', MVideoWithAllFiles>@@ -18,7 +19,8 @@ export type MVideoChangeOwnershipFull = MVideoChangeOwnership &// Format for API or AP object-export type MVideoChangeOwnershipFormattable = Pick<MVideoChangeOwnership, 'id' | 'status' | 'createdAt'> &+export type MVideoChangeOwnershipFormattable =+ Pick<MVideoChangeOwnership, 'id' | 'status' | 'createdAt'> &Use<'Initiator', MAccountFormattable> &Use<'NextOwner', MAccountFormattable> &Use<'Video', Pick<MVideo, 'id' | 'uuid' | 'url' | 'name'>>diff --git a/server/typings/models/video/video-channels.ts b/server/typings/models/video/video-channels.tsindex 292d0ac953..50f7c2d8a0 100644--- a/server/typings/models/video/video-channels.ts+++ b/server/typings/models/video/video-channels.ts@@ -35,32 +35,39 @@ export type MChannelId = Pick<MChannel, 'id'>// ############################################################################-export type MChannelIdActor = MChannelId &+export type MChannelIdActor =+ MChannelId &Use<'Actor', MActorAccountChannelId>-export type MChannelUserId = Pick<MChannel, 'accountId'> &+export type MChannelUserId =+ Pick<MChannel, 'accountId'> &Use<'Account', MAccountUserId>-export type MChannelActor = MChannel &+export type MChannelActor =+ MChannel &Use<'Actor', MActor>export type MChannelUrl = Use<'Actor', MActorUrl>// Default scope-export type MChannelDefault = MChannel &+export type MChannelDefault =+ MChannel &Use<'Actor', MActorDefault>// ############################################################################// Not all association attributes-export type MChannelLight = MChannel &+export type MChannelLight =+ MChannel &Use<'Actor', MActorDefaultLight>-export type MChannelActorLight = MChannel &+export type MChannelActorLight =+ MChannel &Use<'Actor', MActorLight>-export type MChannelAccountLight = MChannel &+export type MChannelAccountLight =+ MChannel &Use<'Actor', MActorDefaultLight> &Use<'Account', MAccountLight>@@ -68,24 +75,29 @@ export type MChannelAccountLight = MChannel &// Account associations-export type MChannelAccountActor = MChannel &+export type MChannelAccountActor =+ MChannel &Use<'Account', MAccountActor>-export type MChannelAccountDefault = MChannel &+export type MChannelAccountDefault =+ MChannel &Use<'Actor', MActorDefault> &Use<'Account', MAccountDefault>-export type MChannelActorAccountActor = MChannel &+export type MChannelActorAccountActor =+ MChannel &Use<'Account', MAccountActor> &Use<'Actor', MActor>// ############################################################################// Videos associations-export type MChannelVideos = MChannel &+export type MChannelVideos =+ MChannel &Use<'Videos', MVideo[]>-export type MChannelActorAccountDefaultVideos = MChannel &+export type MChannelActorAccountDefaultVideos =+ MChannel &Use<'Actor', MActorDefault> &Use<'Account', MAccountDefault> &Use<'Videos', MVideo[]>@@ -94,14 +106,17 @@ export type MChannelActorAccountDefaultVideos = MChannel &// For API-export type MChannelSummary = FunctionProperties<MChannel> &+export type MChannelSummary =+ FunctionProperties<MChannel> &Pick<MChannel, 'id' | 'name' | 'description' | 'actorId'> &Use<'Actor', MActorSummary>-export type MChannelSummaryAccount = MChannelSummary &+export type MChannelSummaryAccount =+ MChannelSummary &Use<'Account', MAccountSummaryBlocks>-export type MChannelAPI = MChannel &+export type MChannelAPI =+ MChannel &Use<'Actor', MActorAPI> &Use<'Account', MAccountAPI>@@ -109,18 +124,22 @@ export type MChannelAPI = MChannel &// Format for API or AP object-export type MChannelSummaryFormattable = FunctionProperties<MChannel> &+export type MChannelSummaryFormattable =+ FunctionProperties<MChannel> &Pick<MChannel, 'id' | 'name'> &Use<'Actor', MActorSummaryFormattable>-export type MChannelAccountSummaryFormattable = MChannelSummaryFormattable &+export type MChannelAccountSummaryFormattable =+ MChannelSummaryFormattable &Use<'Account', MAccountSummaryFormattable>-export type MChannelFormattable = FunctionProperties<MChannel> &+export type MChannelFormattable =+ FunctionProperties<MChannel> &Pick<MChannel, 'id' | 'name' | 'description' | 'createdAt' | 'updatedAt' | 'support'> &Use<'Actor', MActorFormattable> &PickWithOpt<VideoChannelModel, 'Account', MAccountFormattable>-export type MChannelAP = Pick<MChannel, 'name' | 'description' | 'support'> &+export type MChannelAP =+ Pick<MChannel, 'name' | 'description' | 'support'> &Use<'Actor', MActorAP> &Use<'Account', MAccountUrl>diff --git a/server/typings/models/video/video-comment.ts b/server/typings/models/video/video-comment.tsindex d693f91867..d6e0b66f54 100644--- a/server/typings/models/video/video-comment.ts+++ b/server/typings/models/video/video-comment.ts@@ -14,30 +14,37 @@ export type MCommentUrl = Pick<MComment, 'url'>// ############################################################################-export type MCommentOwner = MComment &+export type MCommentOwner =+ MComment &Use<'Account', MAccountDefault>-export type MCommentVideo = MComment &+export type MCommentVideo =+ MComment &Use<'Video', MVideoAccountLight>-export type MCommentReply = MComment &+export type MCommentReply =+ MComment &Use<'InReplyToVideoComment', MComment>-export type MCommentOwnerVideo = MComment &+export type MCommentOwnerVideo =+ MComment &Use<'Account', MAccountDefault> &Use<'Video', MVideoAccountLight>-export type MCommentOwnerVideoReply = MComment &+export type MCommentOwnerVideoReply =+ MComment &Use<'Account', MAccountDefault> &Use<'Video', MVideoAccountLight> &Use<'InReplyToVideoComment', MComment>-export type MCommentOwnerReplyVideoLight = MComment &+export type MCommentOwnerReplyVideoLight =+ MComment &Use<'Account', MAccountDefault> &Use<'InReplyToVideoComment', MComment> &Use<'Video', MVideoIdUrl>-export type MCommentOwnerVideoFeed = MCommentOwner &+export type MCommentOwnerVideoFeed =+ MCommentOwner &Use<'Video', MVideoFeed>// ############################################################################@@ -48,10 +55,12 @@ export type MCommentAPI = MComment & { totalReplies: number }// Format for API or AP object-export type MCommentFormattable = MCommentTotalReplies &+export type MCommentFormattable =+ MCommentTotalReplies &Use<'Account', MAccountFormattable>-export type MCommentAP = MComment &+export type MCommentAP =+ MComment &Use<'Account', MAccountUrl> &PickWithOpt<VideoCommentModel, 'Video', MVideoUrl> &PickWithOpt<VideoCommentModel, 'InReplyToVideoComment', MCommentUrl>diff --git a/server/typings/models/video/video-file.ts b/server/typings/models/video/video-file.tsindex 139b22b2c9..3fcaca78f6 100644--- a/server/typings/models/video/video-file.ts+++ b/server/typings/models/video/video-file.ts@@ -10,22 +10,28 @@ type Use<K extends keyof VideoFileModel, M> = PickWith<VideoFileModel, K, M>export type MVideoFile = Omit<VideoFileModel, 'Video' | 'RedundancyVideos' | 'VideoStreamingPlaylist'>-export type MVideoFileVideo = MVideoFile &+export type MVideoFileVideo =+ MVideoFile &Use<'Video', MVideo>-export type MVideoFileStreamingPlaylist = MVideoFile &+export type MVideoFileStreamingPlaylist =+ MVideoFile &Use<'VideoStreamingPlaylist', MStreamingPlaylist>-export type MVideoFileStreamingPlaylistVideo = MVideoFile &+export type MVideoFileStreamingPlaylistVideo =+ MVideoFile &Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo>-export type MVideoFileVideoUUID = MVideoFile &+export type MVideoFileVideoUUID =+ MVideoFile &Use<'Video', MVideoUUID>-export type MVideoFileRedundanciesAll = MVideoFile &+export type MVideoFileRedundanciesAll =+ MVideoFile &PickWithOpt<VideoFileModel, 'RedundancyVideos', MVideoRedundancy[]>-export type MVideoFileRedundanciesOpt = MVideoFile &+export type MVideoFileRedundanciesOpt =+ MVideoFile &PickWithOpt<VideoFileModel, 'RedundancyVideos', MVideoRedundancyFileUrl[]>export function isStreamingPlaylistFile (file: any): file is MVideoFileStreamingPlaylist {diff --git a/server/typings/models/video/video-import.ts b/server/typings/models/video/video-import.tsindex e119f17f97..4e5c2e4f0a 100644--- a/server/typings/models/video/video-import.ts+++ b/server/typings/models/video/video-import.ts@@ -9,18 +9,21 @@ type Use<K extends keyof VideoImportModel, M> = PickWith<VideoImportModel, K, M>export type MVideoImport = Omit<VideoImportModel, 'User' | 'Video'>-export type MVideoImportVideo = MVideoImport &+export type MVideoImportVideo =+ MVideoImport &Use<'Video', MVideo>// ############################################################################type VideoAssociation = MVideoTag & MVideoAccountLight & MVideoThumbnail-export type MVideoImportDefault = MVideoImport &+export type MVideoImportDefault =+ MVideoImport &Use<'User', MUser> &Use<'Video', VideoAssociation>-export type MVideoImportDefaultFiles = MVideoImport &+export type MVideoImportDefaultFiles =+ MVideoImport &Use<'User', MUser> &Use<'Video', VideoAssociation & MVideoWithFile>@@ -28,5 +31,6 @@ export type MVideoImportDefaultFiles = MVideoImport &// Format for API or AP object-export type MVideoImportFormattable = MVideoImport &+export type MVideoImportFormattable =+ MVideoImport &PickWithOpt<VideoImportModel, 'Video', MVideoFormattable & MVideoTag>diff --git a/server/typings/models/video/video-playlist-element.ts b/server/typings/models/video/video-playlist-element.tsindex 1aeff78d88..f33c765949 100644--- a/server/typings/models/video/video-playlist-element.ts+++ b/server/typings/models/video/video-playlist-element.ts@@ -17,10 +17,12 @@ export type MVideoPlaylistElementLight = Pick<MVideoPlaylistElement, 'id' | 'vid// ############################################################################-export type MVideoPlaylistVideoThumbnail = MVideoPlaylistElement &+export type MVideoPlaylistVideoThumbnail =+ MVideoPlaylistElement &Use<'Video', MVideoThumbnail>-export type MVideoPlaylistElementVideoUrlPlaylistPrivacy = MVideoPlaylistElement &+export type MVideoPlaylistElementVideoUrlPlaylistPrivacy =+ MVideoPlaylistElement &Use<'Video', MVideoUrl> &Use<'VideoPlaylist', MVideoPlaylistPrivacy>@@ -28,8 +30,10 @@ export type MVideoPlaylistElementVideoUrlPlaylistPrivacy = MVideoPlaylistElement// Format for API or AP object-export type MVideoPlaylistElementFormattable = MVideoPlaylistElement &+export type MVideoPlaylistElementFormattable =+ MVideoPlaylistElement &Use<'Video', MVideoFormattable>-export type MVideoPlaylistElementAP = MVideoPlaylistElement &+export type MVideoPlaylistElementAP =+ MVideoPlaylistElement &Use<'Video', MVideoUrl>diff --git a/server/typings/models/video/video-playlist.ts b/server/typings/models/video/video-playlist.tsindex a40c7aca9f..49c27f4a77 100644--- a/server/typings/models/video/video-playlist.ts+++ b/server/typings/models/video/video-playlist.ts@@ -22,30 +22,36 @@ export type MVideoPlaylistVideosLength = MVideoPlaylist & { videosLength?: numbe// With elements-export type MVideoPlaylistWithElements = MVideoPlaylist &+export type MVideoPlaylistWithElements =+ MVideoPlaylist &Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]>-export type MVideoPlaylistIdWithElements = MVideoPlaylistId &+export type MVideoPlaylistIdWithElements =+ MVideoPlaylistId &Use<'VideoPlaylistElements', MVideoPlaylistElementLight[]>// ############################################################################// With account-export type MVideoPlaylistOwner = MVideoPlaylist &+export type MVideoPlaylistOwner =+ MVideoPlaylist &Use<'OwnerAccount', MAccount>-export type MVideoPlaylistOwnerDefault = MVideoPlaylist &+export type MVideoPlaylistOwnerDefault =+ MVideoPlaylist &Use<'OwnerAccount', MAccountDefault>// ############################################################################// With thumbnail-export type MVideoPlaylistThumbnail = MVideoPlaylist &+export type MVideoPlaylistThumbnail =+ MVideoPlaylist &Use<'Thumbnail', MThumbnail>-export type MVideoPlaylistAccountThumbnail = MVideoPlaylist &+export type MVideoPlaylistAccountThumbnail =+ MVideoPlaylist &Use<'OwnerAccount', MAccountDefault> &Use<'Thumbnail', MThumbnail>@@ -53,7 +59,8 @@ export type MVideoPlaylistAccountThumbnail = MVideoPlaylist &// With channel-export type MVideoPlaylistAccountChannelDefault = MVideoPlaylist &+export type MVideoPlaylistAccountChannelDefault =+ MVideoPlaylist &Use<'OwnerAccount', MAccountDefault> &Use<'VideoChannel', MChannelDefault>@@ -61,7 +68,8 @@ export type MVideoPlaylistAccountChannelDefault = MVideoPlaylist &// With all associations-export type MVideoPlaylistFull = MVideoPlaylist &+export type MVideoPlaylistFull =+ MVideoPlaylist &Use<'OwnerAccount', MAccountDefault> &Use<'VideoChannel', MChannelDefault> &Use<'Thumbnail', MThumbnail>@@ -70,11 +78,13 @@ export type MVideoPlaylistFull = MVideoPlaylist &// For API-export type MVideoPlaylistAccountChannelSummary = MVideoPlaylist &+export type MVideoPlaylistAccountChannelSummary =+ MVideoPlaylist &Use<'OwnerAccount', MAccountSummary> &Use<'VideoChannel', MChannelSummary>-export type MVideoPlaylistFullSummary = MVideoPlaylist &+export type MVideoPlaylistFullSummary =+ MVideoPlaylist &Use<'Thumbnail', MThumbnail> &Use<'OwnerAccount', MAccountSummary> &Use<'VideoChannel', MChannelSummary>@@ -83,10 +93,12 @@ export type MVideoPlaylistFullSummary = MVideoPlaylist &// Format for API or AP object-export type MVideoPlaylistFormattable = MVideoPlaylistVideosLength &+export type MVideoPlaylistFormattable =+ MVideoPlaylistVideosLength &Use<'OwnerAccount', MAccountSummaryFormattable> &Use<'VideoChannel', MChannelSummaryFormattable>-export type MVideoPlaylistAP = MVideoPlaylist &+export type MVideoPlaylistAP =+ MVideoPlaylist &Use<'Thumbnail', MThumbnail> &Use<'VideoChannel', MChannelUrl>diff --git a/server/typings/models/video/video-rate.ts b/server/typings/models/video/video-rate.tsindex f6bb527fc8..64ce4965b9 100644--- a/server/typings/models/video/video-rate.ts+++ b/server/typings/models/video/video-rate.ts@@ -9,10 +9,12 @@ type Use<K extends keyof AccountVideoRateModel, M> = PickWith<AccountVideoRateMoexport type MAccountVideoRate = Omit<AccountVideoRateModel, 'Video' | 'Account'>-export type MAccountVideoRateAccountUrl = MAccountVideoRate &+export type MAccountVideoRateAccountUrl =+ MAccountVideoRate &Use<'Account', MAccountUrl>-export type MAccountVideoRateAccountVideo = MAccountVideoRate &+export type MAccountVideoRateAccountVideo =+ MAccountVideoRate &Use<'Account', MAccountAudience> &Use<'Video', MVideo>@@ -20,5 +22,6 @@ export type MAccountVideoRateAccountVideo = MAccountVideoRate &// Format for API or AP object-export type MAccountVideoRateFormattable = Pick<MAccountVideoRate, 'type'> &+export type MAccountVideoRateFormattable =+ Pick<MAccountVideoRate, 'type'> &Use<'Video', MVideoFormattable>diff --git a/server/typings/models/video/video-redundancy.ts b/server/typings/models/video/video-redundancy.tsindex 25bdac057e..5107aa7f40 100644--- a/server/typings/models/video/video-redundancy.ts+++ b/server/typings/models/video/video-redundancy.ts@@ -16,16 +16,20 @@ export type MVideoRedundancyFileUrl = Pick<MVideoRedundancy, 'fileUrl'>// ############################################################################-export type MVideoRedundancyFile = MVideoRedundancy &+export type MVideoRedundancyFile =+ MVideoRedundancy &Use<'VideoFile', MVideoFile>-export type MVideoRedundancyFileVideo = MVideoRedundancy &+export type MVideoRedundancyFileVideo =+ MVideoRedundancy &Use<'VideoFile', MVideoFileVideo>-export type MVideoRedundancyStreamingPlaylistVideo = MVideoRedundancy &+export type MVideoRedundancyStreamingPlaylistVideo =+ MVideoRedundancy &Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo>-export type MVideoRedundancyVideo = MVideoRedundancy &+export type MVideoRedundancyVideo =+ MVideoRedundancy &Use<'VideoFile', MVideoFileVideo> &Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo>@@ -33,6 +37,7 @@ export type MVideoRedundancyVideo = MVideoRedundancy &// Format for API or AP object-export type MVideoRedundancyAP = MVideoRedundancy &+export type MVideoRedundancyAP =+ MVideoRedundancy &PickWithOpt<VideoRedundancyModel, 'VideoFile', MVideoFile & PickWith<VideoFileModel, 'Video', MVideoUrl>> &PickWithOpt<VideoRedundancyModel, 'VideoStreamingPlaylist', PickWith<VideoStreamingPlaylistModel, 'Video', MVideoUrl>>diff --git a/server/typings/models/video/video-share.ts b/server/typings/models/video/video-share.tsindex a7a90beeb7..50ca75d269 100644--- a/server/typings/models/video/video-share.ts+++ b/server/typings/models/video/video-share.ts@@ -9,9 +9,11 @@ type Use<K extends keyof VideoShareModel, M> = PickWith<VideoShareModel, K, M>export type MVideoShare = Omit<VideoShareModel, 'Actor' | 'Video'>-export type MVideoShareActor = MVideoShare &+export type MVideoShareActor =+ MVideoShare &Use<'Actor', MActorDefault>-export type MVideoShareFull = MVideoShare &+export type MVideoShareFull =+ MVideoShare &Use<'Actor', MActorDefault> &Use<'Video', MVideo>diff --git a/server/typings/models/video/video-streaming-playlist.ts b/server/typings/models/video/video-streaming-playlist.tsindex 6fd4899452..3f54aa560b 100644--- a/server/typings/models/video/video-streaming-playlist.ts+++ b/server/typings/models/video/video-streaming-playlist.ts@@ -10,25 +10,31 @@ type Use<K extends keyof VideoStreamingPlaylistModel, M> = PickWith<VideoStreamiexport type MStreamingPlaylist = Omit<VideoStreamingPlaylistModel, 'Video' | 'RedundancyVideos' | 'VideoFiles'>-export type MStreamingPlaylistFiles = MStreamingPlaylist &+export type MStreamingPlaylistFiles =+ MStreamingPlaylist &Use<'VideoFiles', MVideoFile[]>-export type MStreamingPlaylistVideo = MStreamingPlaylist &+export type MStreamingPlaylistVideo =+ MStreamingPlaylist &Use<'Video', MVideo>-export type MStreamingPlaylistFilesVideo = MStreamingPlaylist &+export type MStreamingPlaylistFilesVideo =+ MStreamingPlaylist &Use<'VideoFiles', MVideoFile[]> &Use<'Video', MVideo>-export type MStreamingPlaylistRedundanciesAll = MStreamingPlaylist &+export type MStreamingPlaylistRedundanciesAll =+ MStreamingPlaylist &Use<'VideoFiles', MVideoFile[]> &Use<'RedundancyVideos', MVideoRedundancy[]>-export type MStreamingPlaylistRedundancies = MStreamingPlaylist &+export type MStreamingPlaylistRedundancies =+ MStreamingPlaylist &Use<'VideoFiles', MVideoFile[]> &Use<'RedundancyVideos', MVideoRedundancyFileUrl[]>-export type MStreamingPlaylistRedundanciesOpt = MStreamingPlaylist &+export type MStreamingPlaylistRedundanciesOpt =+ MStreamingPlaylist &Use<'VideoFiles', MVideoFile[]> &PickWithOpt<VideoStreamingPlaylistModel, 'RedundancyVideos', MVideoRedundancyFileUrl[]>diff --git a/server/typings/models/video/video.ts b/server/typings/models/video/video.tsindex 82d76f40ca..7eff0a9132 100644--- a/server/typings/models/video/video.ts+++ b/server/typings/models/video/video.ts@@ -26,7 +26,8 @@ type Use<K extends keyof VideoModel, M> = PickWith<VideoModel, K, M>// ############################################################################-export type MVideo = Omit<VideoModel, 'VideoChannel' | 'Tags' | 'Thumbnails' | 'VideoPlaylistElements' | 'VideoAbuses' |+export type MVideo =+ Omit<VideoModel, 'VideoChannel' | 'Tags' | 'Thumbnails' | 'VideoPlaylistElements' | 'VideoAbuses' |'VideoFiles' | 'VideoStreamingPlaylists' | 'VideoShares' | 'AccountVideoRates' | 'VideoComments' | 'VideoViews' | 'UserVideoHistories' |'ScheduleVideoUpdate' | 'VideoBlacklist' | 'VideoImport' | 'VideoCaptions'>@@ -44,50 +45,63 @@ export type MVideoFeed = Pick<MVideo, 'name' | 'uuid'>// Video raw associations: schedules, video files, tags, thumbnails, captions, streaming playlists// "With" to not confuse with the VideoFile model-export type MVideoWithFile = MVideo &+export type MVideoWithFile =+ MVideo &Use<'VideoFiles', MVideoFile[]> &Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]>-export type MVideoThumbnail = MVideo &+export type MVideoThumbnail =+ MVideo &Use<'Thumbnails', MThumbnail[]>-export type MVideoIdThumbnail = MVideoId &+export type MVideoIdThumbnail =+ MVideoId &Use<'Thumbnails', MThumbnail[]>-export type MVideoWithFileThumbnail = MVideo &+export type MVideoWithFileThumbnail =+ MVideo &Use<'VideoFiles', MVideoFile[]> &Use<'Thumbnails', MThumbnail[]>-export type MVideoThumbnailBlacklist = MVideo &+export type MVideoThumbnailBlacklist =+ MVideo &Use<'Thumbnails', MThumbnail[]> &Use<'VideoBlacklist', MVideoBlacklistLight>-export type MVideoTag = MVideo &+export type MVideoTag =+ MVideo &Use<'Tags', MTag[]>-export type MVideoWithSchedule = MVideo &+export type MVideoWithSchedule =+ MVideo &PickWithOpt<VideoModel, 'ScheduleVideoUpdate', MScheduleVideoUpdate>-export type MVideoWithCaptions = MVideo &+export type MVideoWithCaptions =+ MVideo &Use<'VideoCaptions', MVideoCaptionLanguage[]>-export type MVideoWithStreamingPlaylist = MVideo &+export type MVideoWithStreamingPlaylist =+ MVideo &Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]>// ############################################################################// Associations with not all their attributes-export type MVideoUserHistory = MVideo &+export type MVideoUserHistory =+ MVideo &Use<'UserVideoHistories', MUserVideoHistoryTime[]>-export type MVideoWithBlacklistLight = MVideo &+export type MVideoWithBlacklistLight =+ MVideo &Use<'VideoBlacklist', MVideoBlacklistLight>-export type MVideoAccountLight = MVideo &+export type MVideoAccountLight =+ MVideo &Use<'VideoChannel', MChannelAccountLight>-export type MVideoWithRights = MVideo &+export type MVideoWithRights =+ MVideo &Use<'VideoBlacklist', MVideoBlacklistLight> &Use<'Thumbnails', MThumbnail[]> &Use<'VideoChannel', MChannelUserId>@@ -96,12 +110,14 @@ export type MVideoWithRights = MVideo &// All files with some additional associations-export type MVideoWithAllFiles = MVideo &+export type MVideoWithAllFiles =+ MVideo &Use<'VideoFiles', MVideoFile[]> &Use<'Thumbnails', MThumbnail[]> &Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]>-export type MVideoAccountLightBlacklistAllFiles = MVideo &+export type MVideoAccountLightBlacklistAllFiles =+ MVideo &Use<'VideoFiles', MVideoFile[]> &Use<'Thumbnails', MThumbnail[]> &Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> &@@ -112,17 +128,21 @@ export type MVideoAccountLightBlacklistAllFiles = MVideo &// With account-export type MVideoAccountDefault = MVideo &+export type MVideoAccountDefault =+ MVideo &Use<'VideoChannel', MChannelAccountDefault>-export type MVideoThumbnailAccountDefault = MVideo &+export type MVideoThumbnailAccountDefault =+ MVideo &Use<'Thumbnails', MThumbnail[]> &Use<'VideoChannel', MChannelAccountDefault>-export type MVideoWithChannelActor = MVideo &+export type MVideoWithChannelActor =+ MVideo &Use<'VideoChannel', MChannelActor>-export type MVideoFullLight = MVideo &+export type MVideoFullLight =+ MVideo &Use<'Thumbnails', MThumbnail[]> &Use<'VideoBlacklist', MVideoBlacklistLight> &Use<'Tags', MTag[]> &@@ -136,7 +156,8 @@ export type MVideoFullLight = MVideo &// API-export type MVideoAP = MVideo &+export type MVideoAP =+ MVideo &Use<'Tags', MTag[]> &Use<'VideoChannel', MChannelAccountLight> &Use<'VideoStreamingPlaylists', MStreamingPlaylistFiles[]> &@@ -147,7 +168,8 @@ export type MVideoAP = MVideo &export type MVideoAPWithoutCaption = Omit<MVideoAP, 'VideoCaptions'>-export type MVideoDetails = MVideo &+export type MVideoDetails =+ MVideo &Use<'VideoBlacklist', MVideoBlacklistLight> &Use<'Tags', MTag[]> &Use<'VideoChannel', MChannelAccountLight> &@@ -157,13 +179,15 @@ export type MVideoDetails = MVideo &Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundancies[]> &Use<'VideoFiles', MVideoFileRedundanciesOpt[]>-export type MVideoForUser = MVideo &+export type MVideoForUser =+ MVideo &Use<'VideoChannel', MChannelAccountDefault> &Use<'ScheduleVideoUpdate', MScheduleVideoUpdate> &Use<'VideoBlacklist', MVideoBlacklistLight> &Use<'Thumbnails', MThumbnail[]>-export type MVideoForRedundancyAPI = MVideo &+export type MVideoForRedundancyAPI =+ MVideo &Use<'VideoFiles', MVideoFileRedundanciesAll[]> &Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundanciesAll[]>@@ -171,13 +195,15 @@ export type MVideoForRedundancyAPI = MVideo &// Format for API or AP object-export type MVideoFormattable = MVideo &+export type MVideoFormattable =+ MVideo &PickWithOpt<VideoModel, 'UserVideoHistories', MUserVideoHistoryTime[]> &Use<'VideoChannel', MChannelAccountSummaryFormattable> &PickWithOpt<VideoModel, 'ScheduleVideoUpdate', Pick<MScheduleVideoUpdate, 'updateAt' | 'privacy'>> &PickWithOpt<VideoModel, 'VideoBlacklist', Pick<MVideoBlacklist, 'reason'>>-export type MVideoFormattableDetails = MVideoFormattable &+export type MVideoFormattableDetails =+ MVideoFormattable &Use<'VideoChannel', MChannelFormattable> &Use<'Tags', MTag[]> &Use<'VideoStreamingPlaylists', MStreamingPlaylistRedundanciesOpt[]> &diff --git a/server/typings/utils.ts b/server/typings/utils.tsindex 24d43b2587..55500d8c45 100644--- a/server/typings/utils.ts+++ b/server/typings/utils.ts@@ -1,3 +1,5 @@+/* eslint-disable @typescript-eslint/array-type */+export type FunctionPropertyNames<T> = {[K in keyof T]: T[K] extends Function ? K : never}[keyof T]diff --git a/shared/core-utils/miscs/miscs.ts b/shared/core-utils/miscs/miscs.tsindex 5de024c089..1eee22d82f 100644--- a/shared/core-utils/miscs/miscs.ts+++ b/shared/core-utils/miscs/miscs.ts@@ -11,7 +11,7 @@ function compareSemVer (a: string, b: string) {const l = Math.min(segmentsA.length, segmentsB.length)for (let i = 0; i < l; i++) {- const diff = parseInt(segmentsA[ i ], 10) - parseInt(segmentsB[ i ], 10)+ const diff = parseInt(segmentsA[i], 10) - parseInt(segmentsB[i], 10)if (diff) return diff}diff --git a/shared/extra-utils/instances-index/mock-instances-index.ts b/shared/extra-utils/instances-index/mock-instances-index.tsindex cfa4523c1f..c58e8bcf82 100644--- a/shared/extra-utils/instances-index/mock-instances-index.ts+++ b/shared/extra-utils/instances-index/mock-instances-index.ts@@ -1,7 +1,7 @@import * as express from 'express'export class MockInstancesIndex {- private indexInstances: { host: string, createdAt: string }[] = []+ private readonly indexInstances: { host: string, createdAt: string }[] = []initialize () {return new Promise(res => {diff --git a/shared/extra-utils/miscs/miscs.ts b/shared/extra-utils/miscs/miscs.tsindex d04003988b..f4e86b85a1 100644--- a/shared/extra-utils/miscs/miscs.ts+++ b/shared/extra-utils/miscs/miscs.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as chai from 'chai'import { basename, dirname, isAbsolute, join, resolve } from 'path'@@ -10,11 +10,11 @@ import * as ffmpeg from 'fluent-ffmpeg'const expect = chai.expectlet webtorrent: WebTorrent.Instance-function immutableAssign <T, U> (target: T, source: U) {+function immutableAssign<T, U> (target: T, source: U) {return Object.assign<{}, T, U>({}, target, source)}- // Default interval -> 5 minutes+// Default interval -> 5 minutesfunction dateIsValid (dateString: string, interval = 300000) {const dateToCheck = new Date(dateString)const now = new Date()@@ -89,7 +89,7 @@ async function generateHighBitrateVideo () {// a large file in the repo. The video needs to have a certain minimum length so// that FFmpeg properly applies bitrate limits.// https://stackoverflow.com/a/15795112- return new Promise<string>(async (res, rej) => {+ return new Promise<string>((res, rej) => {ffmpeg().outputOptions([ '-f rawvideo', '-video_size 1920x1080', '-i /dev/urandom' ]).outputOptions([ '-ac 2', '-f s16le', '-i /dev/urandom', '-t 10' ])@@ -111,7 +111,7 @@ async function generateVideoWithFramerate (fps = 60) {const exists = await pathExists(tempFixturePath)if (!exists) {- return new Promise<string>(async (res, rej) => {+ return new Promise<string>((res, rej) => {ffmpeg().outputOptions([ '-f rawvideo', '-video_size 1280x720', '-i /dev/urandom' ]).outputOptions([ '-ac 2', '-f s16le', '-i /dev/urandom', '-t 10' ])diff --git a/shared/extra-utils/miscs/sql.ts b/shared/extra-utils/miscs/sql.tsindex 42599c20e8..5bd5d5d8a9 100644--- a/shared/extra-utils/miscs/sql.ts+++ b/shared/extra-utils/miscs/sql.ts@@ -1,7 +1,7 @@import { QueryTypes, Sequelize } from 'sequelize'import { ServerInfo } from '../server/servers'-let sequelizes: { [ id: number ]: Sequelize } = {}+const sequelizes: { [ id: number ]: Sequelize } = {}function getSequelize (internalServerNumber: number) {if (sequelizes[internalServerNumber]) return sequelizes[internalServerNumber]@@ -52,7 +52,8 @@ async function countVideoViewsOf (internalServerNumber: number, uuid: string) {const seq = getSequelize(internalServerNumber)// tslint:disable- const query = `SELECT SUM("videoView"."views") AS "total" FROM "videoView" INNER JOIN "video" ON "video"."id" = "videoView"."videoId" WHERE "video"."uuid" = '${uuid}'`+ const query = 'SELECT SUM("videoView"."views") AS "total" FROM "videoView" ' ++ `INNER JOIN "video" ON "video"."id" = "videoView"."videoId" WHERE "video"."uuid" = '${uuid}'`const options = { type: QueryTypes.SELECT as QueryTypes.SELECT }const [ { total } ] = await seq.query<{ total: number }>(query, options)@@ -64,9 +65,10 @@ async function countVideoViewsOf (internalServerNumber: number, uuid: string) {async function closeAllSequelize (servers: ServerInfo[]) {for (const server of servers) {- if (sequelizes[ server.internalServerNumber ]) {- await sequelizes[ server.internalServerNumber ].close()- delete sequelizes[ server.internalServerNumber ]+ if (sequelizes[server.internalServerNumber]) {+ await sequelizes[server.internalServerNumber].close()+ // eslint-disable-next-line+ delete sequelizes[server.internalServerNumber]}}}diff --git a/shared/extra-utils/requests/requests.ts b/shared/extra-utils/requests/requests.tsindex 3532fb429e..61167f212d 100644--- a/shared/extra-utils/requests/requests.ts+++ b/shared/extra-utils/requests/requests.ts@@ -1,25 +1,27 @@+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/no-floating-promises */+import * as request from 'supertest'import { buildAbsoluteFixturePath, root } from '../miscs/miscs'import { isAbsolute, join } from 'path'-import { parse } from 'url'+import { URL } from 'url'function get4KFileUrl () {return 'https://download.cpy.re/peertube/4k_file.txt'}function makeRawRequest (url: string, statusCodeExpected?: number, range?: string) {- const { host, protocol, pathname } = parse(url)+ const { host, protocol, pathname } = new URL(url)return makeGetRequest({ url: `${protocol}//${host}`, path: pathname, statusCodeExpected, range })}function makeGetRequest (options: {- url: string,- path?: string,- query?: any,- token?: string,- statusCodeExpected?: number,- contentType?: string,+ url: string+ path?: string+ query?: any+ token?: string+ statusCodeExpected?: number+ contentType?: stringrange?: string}) {if (!options.statusCodeExpected) options.statusCodeExpected = 400@@ -36,9 +38,9 @@ function makeGetRequest (options: {}function makeDeleteRequest (options: {- url: string,- path: string,- token?: string,+ url: string+ path: string+ token?: stringstatusCodeExpected?: number}) {if (!options.statusCodeExpected) options.statusCodeExpected = 400@@ -53,12 +55,12 @@ function makeDeleteRequest (options: {}function makeUploadRequest (options: {- url: string,- method?: 'POST' | 'PUT',- path: string,- token?: string,- fields: { [ fieldName: string ]: any },- attaches: { [ attachName: string ]: any | any[] },+ url: string+ method?: 'POST' | 'PUT'+ path: string+ token?: string+ fields: { [ fieldName: string ]: any }+ attaches: { [ attachName: string ]: any | any[] }statusCodeExpected?: number}) {if (!options.statusCodeExpected) options.statusCodeExpected = 400@@ -101,10 +103,10 @@ function makeUploadRequest (options: {}function makePostBodyRequest (options: {- url: string,- path: string,- token?: string,- fields?: { [ fieldName: string ]: any },+ url: string+ path: string+ token?: string+ fields?: { [ fieldName: string ]: any }statusCodeExpected?: number}) {if (!options.fields) options.fields = {}@@ -121,10 +123,10 @@ function makePostBodyRequest (options: {}function makePutBodyRequest (options: {- url: string,- path: string,- token?: string,- fields: { [ fieldName: string ]: any },+ url: string+ path: string+ token?: string+ fields: { [ fieldName: string ]: any }statusCodeExpected?: number}) {if (!options.statusCodeExpected) options.statusCodeExpected = 400@@ -147,9 +149,9 @@ function makeHTMLRequest (url: string, path: string) {}function updateAvatarRequest (options: {- url: string,- path: string,- accessToken: string,+ url: string+ path: string+ accessToken: stringfixture: string}) {let filePath = ''diff --git a/shared/extra-utils/search/videos.ts b/shared/extra-utils/search/videos.tsindex da806e6920..4c52ea11c4 100644--- a/shared/extra-utils/search/videos.ts+++ b/shared/extra-utils/search/videos.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as request from 'supertest'import { VideosSearchQuery } from '../../models/search'diff --git a/shared/extra-utils/server/clients.ts b/shared/extra-utils/server/clients.tsindex 273aac7472..dc631e8231 100644--- a/shared/extra-utils/server/clients.ts+++ b/shared/extra-utils/server/clients.ts@@ -1,12 +1,12 @@import * as request from 'supertest'-import * as urlUtil from 'url'+import { URL } from 'url'function getClient (url: string) {const path = '/api/v1/oauth-clients/local'return request(url).get(path)- .set('Host', urlUtil.parse(url).host)+ .set('Host', new URL(url).host).set('Accept', 'application/json').expect(200).expect('Content-Type', /json/)diff --git a/shared/extra-utils/server/contact-form.ts b/shared/extra-utils/server/contact-form.tsindex e002e03dd7..d50f832413 100644--- a/shared/extra-utils/server/contact-form.ts+++ b/shared/extra-utils/server/contact-form.ts@@ -2,11 +2,11 @@ import * as request from 'supertest'import { ContactForm } from '../../models/server'function sendContactForm (options: {- url: string,- fromEmail: string,- fromName: string,- subject: string,- body: string,+ url: string+ fromEmail: string+ fromName: string+ subject: string+ body: stringexpectedStatus?: number}) {const path = '/api/v1/server/contact'diff --git a/shared/extra-utils/server/follows.ts b/shared/extra-utils/server/follows.tsindex 3f7729c20a..006d591995 100644--- a/shared/extra-utils/server/follows.ts+++ b/shared/extra-utils/server/follows.ts@@ -5,12 +5,12 @@ import { makePostBodyRequest } from '../requests/requests'import { ActivityPubActorType, FollowState } from '@shared/models'function getFollowersListPaginationAndSort (options: {- url: string,- start: number,- count: number,- sort: string,- search?: string,- actorType?: ActivityPubActorType,+ url: string+ start: number+ count: number+ sort: string+ search?: string+ actorType?: ActivityPubActorTypestate?: FollowState}) {const { url, start, count, sort, search, state, actorType } = options@@ -56,12 +56,12 @@ function rejectFollower (url: string, token: string, follower: string, statusCod}function getFollowingListPaginationAndSort (options: {- url: string,- start: number,- count: number,- sort: string,- search?: string,- actorType?: ActivityPubActorType,+ url: string+ start: number+ count: number+ sort: string+ search?: string+ actorType?: ActivityPubActorTypestate?: FollowState}) {const { url, start, count, sort, search, state, actorType } = options@@ -92,7 +92,7 @@ function follow (follower: string, following: string[], accessToken: string, exp.post(path).set('Accept', 'application/json').set('Authorization', 'Bearer ' + accessToken)- .send({ 'hosts': followingHosts })+ .send({ hosts: followingHosts }).expect(expectedStatus)}diff --git a/shared/extra-utils/server/jobs.ts b/shared/extra-utils/server/jobs.tsindex 56fe5fa2ad..d984b3d1ef 100644--- a/shared/extra-utils/server/jobs.ts+++ b/shared/extra-utils/server/jobs.ts@@ -8,20 +8,20 @@ function getJobsList (url: string, accessToken: string, state: JobState) {const path = '/api/v1/jobs/' + statereturn request(url)- .get(path)- .set('Accept', 'application/json')- .set('Authorization', 'Bearer ' + accessToken)- .expect(200)- .expect('Content-Type', /json/)+ .get(path)+ .set('Accept', 'application/json')+ .set('Authorization', 'Bearer ' + accessToken)+ .expect(200)+ .expect('Content-Type', /json/)}function getJobsListPaginationAndSort (options: {- url: string,- accessToken: string,- state: JobState,- start: number,- count: number,- sort: string,+ url: string+ accessToken: string+ state: JobState+ start: number+ count: number+ sort: stringjobType?: JobType}) {const { url, accessToken, state, start, count, sort, jobType } = optionsdiff --git a/shared/extra-utils/server/plugins.ts b/shared/extra-utils/server/plugins.tsindex 5c0d1e511c..2d02d823d5 100644--- a/shared/extra-utils/server/plugins.ts+++ b/shared/extra-utils/server/plugins.ts@@ -7,13 +7,13 @@ import { root } from '../miscs/miscs'import { join } from 'path'function listPlugins (parameters: {- url: string,- accessToken: string,- start?: number,- count?: number,- sort?: string,- pluginType?: PluginType,- uninstalled?: boolean,+ url: string+ accessToken: string+ start?: number+ count?: number+ sort?: string+ pluginType?: PluginType+ uninstalled?: booleanexpectedStatus?: number}) {const { url, accessToken, start, count, sort, pluginType, uninstalled, expectedStatus = 200 } = parameters@@ -35,13 +35,13 @@ function listPlugins (parameters: {}function listAvailablePlugins (parameters: {- url: string,- accessToken: string,- start?: number,- count?: number,- sort?: string,- pluginType?: PluginType,- currentPeerTubeEngine?: string,+ url: string+ accessToken: string+ start?: number+ count?: number+ sort?: string+ pluginType?: PluginType+ currentPeerTubeEngine?: stringsearch?: stringexpectedStatus?: number}) {@@ -67,9 +67,9 @@ function listAvailablePlugins (parameters: {}function getPlugin (parameters: {- url: string,- accessToken: string,- npmName: string,+ url: string+ accessToken: string+ npmName: stringexpectedStatus?: number}) {const { url, accessToken, npmName, expectedStatus = 200 } = parameters@@ -84,10 +84,10 @@ function getPlugin (parameters: {}function updatePluginSettings (parameters: {- url: string,- accessToken: string,- npmName: string,- settings: any,+ url: string+ accessToken: string+ npmName: string+ settings: anyexpectedStatus?: number}) {const { url, accessToken, npmName, settings, expectedStatus = 204 } = parameters@@ -103,9 +103,9 @@ function updatePluginSettings (parameters: {}function getPluginRegisteredSettings (parameters: {- url: string,- accessToken: string,- npmName: string,+ url: string+ accessToken: string+ npmName: stringexpectedStatus?: number}) {const { url, accessToken, npmName, expectedStatus = 200 } = parameters@@ -120,8 +120,8 @@ function getPluginRegisteredSettings (parameters: {}function getPublicSettings (parameters: {- url: string,- npmName: string,+ url: string+ npmName: stringexpectedStatus?: number}) {const { url, npmName, expectedStatus = 200 } = parameters@@ -135,8 +135,8 @@ function getPublicSettings (parameters: {}function getPluginTranslations (parameters: {- url: string,- locale: string,+ url: string+ locale: stringexpectedStatus?: number}) {const { url, locale, expectedStatus = 200 } = parameters@@ -150,9 +150,9 @@ function getPluginTranslations (parameters: {}function installPlugin (parameters: {- url: string,- accessToken: string,- path?: string,+ url: string+ accessToken: string+ path?: stringnpmName?: stringexpectedStatus?: number}) {@@ -169,9 +169,9 @@ function installPlugin (parameters: {}function updatePlugin (parameters: {- url: string,- accessToken: string,- path?: string,+ url: string+ accessToken: string+ path?: stringnpmName?: stringexpectedStatus?: number}) {@@ -188,8 +188,8 @@ function updatePlugin (parameters: {}function uninstallPlugin (parameters: {- url: string,- accessToken: string,+ url: string+ accessToken: stringnpmName: stringexpectedStatus?: number}) {diff --git a/shared/extra-utils/server/redundancy.ts b/shared/extra-utils/server/redundancy.tsindex 7b488e23e1..08467e4c0a 100644--- a/shared/extra-utils/server/redundancy.ts+++ b/shared/extra-utils/server/redundancy.ts@@ -15,11 +15,11 @@ function updateRedundancy (url: string, accessToken: string, host: string, redunfunction listVideoRedundancies (options: {url: string- accessToken: string,- target: VideoRedundanciesTarget,- start?: number,- count?: number,- sort?: string,+ accessToken: string+ target: VideoRedundanciesTarget+ start?: number+ count?: number+ sort?: stringstatusCodeExpected?: number}) {const path = '/api/v1/server/redundancy/videos'@@ -41,8 +41,8 @@ function listVideoRedundancies (options: {}function addVideoRedundancy (options: {- url: string,- accessToken: string,+ url: string+ accessToken: stringvideoId: number}) {const path = '/api/v1/server/redundancy/videos'@@ -58,8 +58,8 @@ function addVideoRedundancy (options: {}function removeVideoRedundancy (options: {- url: string,- accessToken: string,+ url: string+ accessToken: stringredundancyId: number}) {const { url, accessToken, redundancyId } = optionsdiff --git a/shared/extra-utils/server/servers.ts b/shared/extra-utils/server/servers.tsindex a0720d778e..a0f0ce9c97 100644--- a/shared/extra-utils/server/servers.ts+++ b/shared/extra-utils/server/servers.ts@@ -1,16 +1,15 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/no-floating-promises */import { ChildProcess, exec, fork } from 'child_process'import { join } from 'path'import { root, wait } from '../miscs/miscs'import { copy, pathExists, readdir, readFile, remove } from 'fs-extra'-import { existsSync } from 'fs'import { expect } from 'chai'import { VideoChannel } from '../../models/videos'import { randomInt } from '../../core-utils/miscs/miscs'interface ServerInfo {- app: ChildProcess,+ app: ChildProcessurl: stringhost: string@@ -20,13 +19,13 @@ interface ServerInfo {serverNumber: numberclient: {- id: string,+ id: stringsecret: string}user: {- username: string,- password: string,+ username: string+ password: stringemail?: string}@@ -57,7 +56,7 @@ function parallelTests () {}function flushAndRunMultipleServers (totalServers: number, configOverride?: Object) {- let apps = []+ const apps = []let i = 0return new Promise<ServerInfo[]>(res => {@@ -203,20 +202,20 @@ async function runServer (server: ServerInfo, configOverrideArg?: any, args = []// Capture things if we want tofor (const key of Object.keys(regexps)) {- const regexp = regexps[ key ]+ const regexp = regexps[key]const matches = data.toString().match(regexp)if (matches !== null) {- if (key === 'client_id') server.client.id = matches[ 1 ]- else if (key === 'client_secret') server.client.secret = matches[ 1 ]- else if (key === 'user_username') server.user.username = matches[ 1 ]- else if (key === 'user_password') server.user.password = matches[ 1 ]+ if (key === 'client_id') server.client.id = matches[1]+ else if (key === 'client_secret') server.client.secret = matches[1]+ else if (key === 'user_username') server.user.username = matches[1]+ else if (key === 'user_password') server.user.password = matches[1]}}// Check if all required sentences are herefor (const key of Object.keys(serverRunString)) {- if (data.toString().indexOf(key) !== -1) serverRunString[ key ] = true- if (serverRunString[ key ] === false) dontContinue = true+ if (data.toString().indexOf(key) !== -1) serverRunString[key] = true+ if (serverRunString[key] === false) dontContinue = true}// If no, there is maybe one thing not already initialized (client/user credentials generation...)diff --git a/shared/extra-utils/users/accounts.ts b/shared/extra-utils/users/accounts.tsindex 627e17cc3a..f87706f6a8 100644--- a/shared/extra-utils/users/accounts.ts+++ b/shared/extra-utils/users/accounts.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import * as request from 'supertest'import { expect } from 'chai'diff --git a/shared/extra-utils/users/blocklist.ts b/shared/extra-utils/users/blocklist.tsindex 5feb841793..39e720b426 100644--- a/shared/extra-utils/users/blocklist.ts+++ b/shared/extra-utils/users/blocklist.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { makeGetRequest, makeDeleteRequest, makePostBodyRequest } from '../requests/requests'diff --git a/shared/extra-utils/users/login.ts b/shared/extra-utils/users/login.tsindex f9bfb3cb3d..4fe54a74a5 100644--- a/shared/extra-utils/users/login.ts+++ b/shared/extra-utils/users/login.ts@@ -60,7 +60,7 @@ function setAccessTokensToServers (servers: ServerInfo[]) {const tasks: Promise<any>[] = []for (const server of servers) {- const p = serverLogin(server).then(t => server.accessToken = t)+ const p = serverLogin(server).then(t => { server.accessToken = t })tasks.push(p)}diff --git a/shared/extra-utils/users/user-notifications.ts b/shared/extra-utils/users/user-notifications.tsindex 9a5fd7e868..f949878e48 100644--- a/shared/extra-utils/users/user-notifications.ts+++ b/shared/extra-utils/users/user-notifications.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { makeGetRequest, makePostBodyRequest, makePutBodyRequest } from '../requests/requests'import { UserNotification, UserNotificationSetting, UserNotificationType } from '../../models/users'@@ -54,6 +54,7 @@ function markAsReadNotifications (url: string, token: string, ids: number[], stastatusCodeExpected})}+function markAsReadAllNotifications (url: string, token: string, statusCodeExpected = 204) {const path = '/api/v1/users/me/notifications/read-all'@@ -77,7 +78,7 @@ type CheckerBaseParams = {server: ServerInfoemails: object[]socketNotifications: UserNotification[]- token: string,+ token: stringcheck?: { web: boolean, mail: boolean }}@@ -172,7 +173,7 @@ async function checkNewVideoFromSubscription (base: CheckerBaseParams, videoName}function emailFinder (email: object) {- const text = email[ 'text' ]+ const text = email['text']return text.indexOf(videoUUID) !== -1 && text.indexOf('Your subscription') !== -1}@@ -195,7 +196,7 @@ async function checkVideoIsPublished (base: CheckerBaseParams, videoName: string}function emailFinder (email: object) {- const text: string = email[ 'text' ]+ const text: string = email['text']return text.includes(videoUUID) && text.includes('Your video')}@@ -226,7 +227,7 @@ async function checkMyVideoImportIsFinished (}function emailFinder (email: object) {- const text: string = email[ 'text' ]+ const text: string = email['text']const toFind = success ? ' finished' : ' error'return text.includes(url) && text.includes(toFind)@@ -251,7 +252,7 @@ async function checkUserRegistered (base: CheckerBaseParams, username: string, t}function emailFinder (email: object) {- const text: string = email[ 'text' ]+ const text: string = email['text']return text.includes(' registered ') && text.includes(username)}@@ -291,7 +292,7 @@ async function checkNewActorFollow (}function emailFinder (email: object) {- const text: string = email[ 'text' ]+ const text: string = email['text']return text.includes('Your ' + followType) && text.includes(followingDisplayName) && text.includes(followerDisplayName)}@@ -320,7 +321,7 @@ async function checkNewInstanceFollower (base: CheckerBaseParams, followerHost:}function emailFinder (email: object) {- const text: string = email[ 'text' ]+ const text: string = email['text']return text.includes('instance has a new follower') && text.includes(followerHost)}@@ -351,7 +352,7 @@ async function checkAutoInstanceFollowing (base: CheckerBaseParams, followerHost}function emailFinder (email: object) {- const text: string = email[ 'text' ]+ const text: string = email['text']return text.includes(' automatically followed a new instance') && text.includes(followingHost)}@@ -385,7 +386,7 @@ async function checkCommentMention (}function emailFinder (email: object) {- const text: string = email[ 'text' ]+ const text: string = email['text']return text.includes(' mentioned ') && text.includes(uuid) && text.includes(byAccountDisplayName)}@@ -394,6 +395,7 @@ async function checkCommentMention (}let lastEmailCount = 0+async function checkNewCommentOnMyVideo (base: CheckerBaseParams, uuid: string, commentId: number, threadId: number, type: CheckerType) {const notificationType = UserNotificationType.NEW_COMMENT_ON_MY_VIDEO@@ -413,8 +415,9 @@ async function checkNewCommentOnMyVideo (base: CheckerBaseParams, uuid: string,}const commentUrl = `http://localhost:${base.server.port}/videos/watch/${uuid};threadId=${threadId}`+function emailFinder (email: object) {- return email[ 'text' ].indexOf(commentUrl) !== -1+ return email['text'].indexOf(commentUrl) !== -1}await checkNotification(base, notificationChecker, emailFinder, type)@@ -444,7 +447,7 @@ async function checkNewVideoAbuseForModerators (base: CheckerBaseParams, videoUU}function emailFinder (email: object) {- const text = email[ 'text' ]+ const text = email['text']return text.indexOf(videoUUID) !== -1 && text.indexOf('abuse') !== -1}@@ -469,8 +472,8 @@ async function checkVideoAutoBlacklistForModerators (base: CheckerBaseParams, vi}function emailFinder (email: object) {- const text = email[ 'text' ]- return text.indexOf(videoUUID) !== -1 && email[ 'text' ].indexOf('video-auto-blacklist/list') !== -1+ const text = email['text']+ return text.indexOf(videoUUID) !== -1 && email['text'].indexOf('video-auto-blacklist/list') !== -1}await checkNotification(base, notificationChecker, emailFinder, type)@@ -496,7 +499,7 @@ async function checkNewBlacklistOnMyVideo (}function emailFinder (email: object) {- const text = email[ 'text' ]+ const text = email['text']return text.indexOf(videoUUID) !== -1 && text.indexOf(' ' + blacklistType) !== -1}diff --git a/shared/extra-utils/users/users.ts b/shared/extra-utils/users/users.tsindex 2fe0e55c21..248af2d6e3 100644--- a/shared/extra-utils/users/users.ts+++ b/shared/extra-utils/users/users.ts@@ -9,14 +9,14 @@ import { UserUpdateMe } from '../../models/users'import { omit } from 'lodash'type CreateUserArgs = {- url: string,- accessToken: string,- username: string,- password: string,- videoQuota?: number,- videoQuotaDaily?: number,- role?: UserRole,- adminFlags?: UserAdminFlag,+ url: string+ accessToken: string+ username: string+ password: string+ videoQuota?: number+ videoQuotaDaily?: number+ role?: UserRole+ adminFlags?: UserAdminFlagspecialStatus?: number}function createUser (parameters: CreateUserArgs) {@@ -74,8 +74,8 @@ function registerUser (url: string, username: string, password: string, specialS}function registerUserWithChannel (options: {- url: string,- user: { username: string, password: string, displayName?: string },+ url: string+ user: { username: string, password: string, displayName?: string }channel: { name: string, displayName: string }}) {const path = '/api/v1/users/register'@@ -230,8 +230,8 @@ function updateMyUser (options: { url: string, accessToken: string } & UserUpdat}function updateMyAvatar (options: {- url: string,- accessToken: string,+ url: string+ accessToken: stringfixture: string}) {const path = '/api/v1/users/me/avatar/pick'@@ -241,14 +241,14 @@ function updateMyAvatar (options: {function updateUser (options: {url: string- userId: number,- accessToken: string,- email?: string,- emailVerified?: boolean,- videoQuota?: number,- videoQuotaDaily?: number,- password?: string,- adminFlags?: UserAdminFlag,+ userId: number+ accessToken: string+ email?: string+ emailVerified?: boolean+ videoQuota?: number+ videoQuotaDaily?: number+ password?: string+ adminFlags?: UserAdminFlagrole?: UserRole}) {const path = '/api/v1/users/' + options.userIddiff --git a/shared/extra-utils/videos/video-blacklist.ts b/shared/extra-utils/videos/video-blacklist.tsindex e25a292fc7..ba139ef952 100644--- a/shared/extra-utils/videos/video-blacklist.ts+++ b/shared/extra-utils/videos/video-blacklist.ts@@ -13,11 +13,11 @@ function addVideoToBlacklist (const path = '/api/v1/videos/' + videoId + '/blacklist'return request(url)- .post(path)- .send({ reason, unfederate })- .set('Accept', 'application/json')- .set('Authorization', 'Bearer ' + token)- .expect(specialStatus)+ .post(path)+ .send({ reason, unfederate })+ .set('Accept', 'application/json')+ .set('Authorization', 'Bearer ' + token)+ .expect(specialStatus)}function updateVideoBlacklist (url: string, token: string, videoId: number, reason?: string, specialStatus = 204) {@@ -35,20 +35,20 @@ function removeVideoFromBlacklist (url: string, token: string, videoId: number |const path = '/api/v1/videos/' + videoId + '/blacklist'return request(url)- .delete(path)- .set('Accept', 'application/json')- .set('Authorization', 'Bearer ' + token)- .expect(specialStatus)+ .delete(path)+ .set('Accept', 'application/json')+ .set('Authorization', 'Bearer ' + token)+ .expect(specialStatus)}function getBlacklistedVideosList (parameters: {- url: string,- token: string,- sort?: string,- type?: VideoBlacklistType,+ url: string+ token: string+ sort?: string+ type?: VideoBlacklistTypespecialStatus?: number}) {- let { url, token, sort, type, specialStatus = 200 } = parameters+ const { url, token, sort, type, specialStatus = 200 } = parametersconst path = '/api/v1/videos/blacklist/'const query = { sort, type }diff --git a/shared/extra-utils/videos/video-captions.ts b/shared/extra-utils/videos/video-captions.tsindex 8d67f617b2..5bd533bba1 100644--- a/shared/extra-utils/videos/video-captions.ts+++ b/shared/extra-utils/videos/video-captions.ts@@ -6,12 +6,12 @@ import { buildAbsoluteFixturePath } from '../miscs/miscs'const expect = chai.expectfunction createVideoCaption (args: {- url: string,+ url: stringaccessToken: stringvideoId: string | numberlanguage: string- fixture: string,- mimeType?: string,+ fixture: string+ mimeType?: stringstatusCodeExpected?: number}) {const path = '/api/v1/videos/' + args.videoId + '/captions/' + args.languagediff --git a/shared/extra-utils/videos/video-channels.ts b/shared/extra-utils/videos/video-channels.tsindex 0538423312..51d433940d 100644--- a/shared/extra-utils/videos/video-channels.ts+++ b/shared/extra-utils/videos/video-channels.ts@@ -1,3 +1,5 @@+/* eslint-disable @typescript-eslint/no-floating-promises */+import * as request from 'supertest'import { VideoChannelUpdate } from '../../models/videos/channel/video-channel-update.model'import { VideoChannelCreate } from '../../models/videos/channel/video-channel-create.model'@@ -22,11 +24,11 @@ function getVideoChannelsList (url: string, start: number, count: number, sort?:}function getAccountVideoChannelsList (parameters: {- url: string,- accountName: string,- start?: number,- count?: number,- sort?: string,+ url: string+ accountName: string+ start?: number+ count?: number+ sort?: stringspecialStatus?: number}) {const { url, accountName, start, count, sort = 'createdAt', specialStatus = 200 } = parameters@@ -113,9 +115,9 @@ function getVideoChannel (url: string, channelName: string) {}function updateVideoChannelAvatar (options: {- url: string,- accessToken: string,- fixture: string,+ url: string+ accessToken: string+ fixture: stringvideoChannelName: string | number}) {@@ -129,7 +131,7 @@ function setDefaultVideoChannel (servers: ServerInfo[]) {for (const server of servers) {const p = getMyUserInformation(server.url, server.accessToken)- .then(res => server.videoChannel = (res.body as User).videoChannels[0])+ .then(res => { server.videoChannel = (res.body as User).videoChannels[0] })tasks.push(p)}diff --git a/shared/extra-utils/videos/video-comments.ts b/shared/extra-utils/videos/video-comments.tsindex 0ebf69ced7..81c48412df 100644--- a/shared/extra-utils/videos/video-comments.ts+++ b/shared/extra-utils/videos/video-comments.ts@@ -1,3 +1,5 @@+/* eslint-disable @typescript-eslint/no-floating-promises */+import * as request from 'supertest'import { makeDeleteRequest } from '../requests/requests'diff --git a/shared/extra-utils/videos/video-imports.ts b/shared/extra-utils/videos/video-imports.tsindex 150cc94edc..8e5abd2f54 100644--- a/shared/extra-utils/videos/video-imports.ts+++ b/shared/extra-utils/videos/video-imports.ts@@ -7,7 +7,7 @@ function getYoutubeVideoUrl () {}function getMagnetURI () {- // tslint:disable:max-line-length+ // eslint-disable-next-line max-lenreturn 'magnet:?xs=https%3A%2F%2Fpeertube2.cpy.re%2Fstatic%2Ftorrents%2Fb209ca00-c8bb-4b2b-b421-1ede169f3dbc-720.torrent&xt=urn:btih:0f498834733e8057ed5c6f2ee2b4efd8d84a76ee&dn=super+peertube2+video&tr=wss%3A%2F%2Fpeertube2.cpy.re%3A443%2Ftracker%2Fsocket&tr=https%3A%2F%2Fpeertube2.cpy.re%2Ftracker%2Fannounce&ws=https%3A%2F%2Fpeertube2.cpy.re%2Fstatic%2Fwebseed%2Fb209ca00-c8bb-4b2b-b421-1ede169f3dbc-720.mp4'}diff --git a/shared/extra-utils/videos/video-playlists.ts b/shared/extra-utils/videos/video-playlists.tsindex 6762c59736..5bcc025709 100644--- a/shared/extra-utils/videos/video-playlists.ts+++ b/shared/extra-utils/videos/video-playlists.ts@@ -123,9 +123,9 @@ function deleteVideoPlaylist (url: string, token: string, playlistId: number | s}function createVideoPlaylist (options: {- url: string,- token: string,- playlistAttrs: VideoPlaylistCreate,+ url: string+ token: string+ playlistAttrs: VideoPlaylistCreateexpectedStatus?: number}) {const path = '/api/v1/video-playlists'@@ -148,10 +148,10 @@ function createVideoPlaylist (options: {}function updateVideoPlaylist (options: {- url: string,- token: string,- playlistAttrs: VideoPlaylistUpdate,- playlistId: number | string,+ url: string+ token: string+ playlistAttrs: VideoPlaylistUpdate+ playlistId: number | stringexpectedStatus?: number}) {const path = '/api/v1/video-playlists/' + options.playlistId@@ -174,9 +174,9 @@ function updateVideoPlaylist (options: {}async function addVideoInPlaylist (options: {- url: string,- token: string,- playlistId: number | string,+ url: string+ token: string+ playlistId: number | stringelementAttrs: VideoPlaylistElementCreate | { videoId: string }expectedStatus?: number}) {@@ -194,11 +194,11 @@ async function addVideoInPlaylist (options: {}function updateVideoPlaylistElement (options: {- url: string,- token: string,- playlistId: number | string,- playlistElementId: number | string,- elementAttrs: VideoPlaylistElementUpdate,+ url: string+ token: string+ playlistId: number | string+ playlistElementId: number | string+ elementAttrs: VideoPlaylistElementUpdateexpectedStatus?: number}) {const path = '/api/v1/video-playlists/' + options.playlistId + '/videos/' + options.playlistElementId@@ -213,10 +213,10 @@ function updateVideoPlaylistElement (options: {}function removeVideoFromPlaylist (options: {- url: string,- token: string,- playlistId: number | string,- playlistElementId: number,+ url: string+ token: string+ playlistId: number | string+ playlistElementId: numberexpectedStatus?: number}) {const path = '/api/v1/video-playlists/' + options.playlistId + '/videos/' + options.playlistElementId@@ -230,14 +230,14 @@ function removeVideoFromPlaylist (options: {}function reorderVideosPlaylist (options: {- url: string,- token: string,- playlistId: number | string,+ url: string+ token: string+ playlistId: number | stringelementAttrs: {- startPosition: number,- insertAfterPosition: number,+ startPosition: number+ insertAfterPosition: numberreorderLength?: number- },+ }expectedStatus?: number}) {const path = '/api/v1/video-playlists/' + options.playlistId + '/videos/reorder'diff --git a/shared/extra-utils/videos/video-streaming-playlists.ts b/shared/extra-utils/videos/video-streaming-playlists.tsindex eb25011cbc..e54da84aad 100644--- a/shared/extra-utils/videos/video-streaming-playlists.ts+++ b/shared/extra-utils/videos/video-streaming-playlists.ts@@ -37,7 +37,7 @@ async function checkSegmentHash (const resSha = await getSegmentSha256(hlsPlaylist.segmentsSha256Url)- const sha256Server = resSha.body[ videoName ][range]+ const sha256Server = resSha.body[videoName][range]expect(sha256(res2.body)).to.equal(sha256Server)}diff --git a/shared/extra-utils/videos/videos.ts b/shared/extra-utils/videos/videos.tsindex aa13273aef..39a06b0d7b 100644--- a/shared/extra-utils/videos/videos.ts+++ b/shared/extra-utils/videos/videos.ts@@ -1,4 +1,4 @@-/* tslint:disable:no-unused-expression */+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/no-floating-promises */import { expect } from 'chai'import { pathExists, readdir, readFile } from 'fs-extra'@@ -488,7 +488,7 @@ async function completeVideoCheck (description: stringpublishedAt?: stringsupport: string- originallyPublishedAt?: string,+ originallyPublishedAt?: stringaccount: {name: stringhost: string@@ -509,7 +509,7 @@ async function completeVideoCheck (files: {resolution: numbersize: number- }[],+ }[]thumbnailfile?: stringpreviewfile?: string}@@ -583,9 +583,10 @@ async function completeVideoCheck (const minSize = attributeFile.size - ((10 * attributeFile.size) / 100)const maxSize = attributeFile.size + ((10 * attributeFile.size) / 100)- expect(file.size,- 'File size for resolution ' + file.resolution.label + ' outside confidence interval (' + minSize + '> size <' + maxSize + ')')- .to.be.above(minSize).and.below(maxSize)+ expect(+ file.size,+ 'File size for resolution ' + file.resolution.label + ' outside confidence interval (' + minSize + '> size <' + maxSize + ')'+ ).to.be.above(minSize).and.below(maxSize)const torrent = await webtorrentAdd(file.magnetUri, true)expect(torrent.files).to.be.an('array')@@ -608,10 +609,10 @@ async function videoUUIDToId (url: string, id: number | string) {}async function uploadVideoAndGetId (options: {- server: ServerInfo,- videoName: string,- nsfw?: boolean,- privacy?: VideoPrivacy,+ server: ServerInfo+ videoName: string+ nsfw?: boolean+ privacy?: VideoPrivacytoken?: string}) {const videoAttrs: any = { name: options.videoName }diff --git a/shared/models/activitypub/activity.ts b/shared/models/activitypub/activity.tsindex 492b672c7b..20ecf176c6 100644--- a/shared/models/activitypub/activity.ts+++ b/shared/models/activitypub/activity.ts@@ -8,12 +8,33 @@ import { ViewObject } from './objects/view-object'import { APObject } from './objects/object.model'import { PlaylistObject } from './objects/playlist-object'-export type Activity = ActivityCreate | ActivityUpdate |- ActivityDelete | ActivityFollow | ActivityAccept | ActivityAnnounce |- ActivityUndo | ActivityLike | ActivityReject | ActivityView | ActivityDislike | ActivityFlag--export type ActivityType = 'Create' | 'Update' | 'Delete' | 'Follow' | 'Accept' | 'Announce' | 'Undo' | 'Like' | 'Reject' |- 'View' | 'Dislike' | 'Flag'+export type Activity =+ ActivityCreate |+ ActivityUpdate |+ ActivityDelete |+ ActivityFollow |+ ActivityAccept |+ ActivityAnnounce |+ ActivityUndo |+ ActivityLike |+ ActivityReject |+ ActivityView |+ ActivityDislike |+ ActivityFlag++export type ActivityType =+ 'Create' |+ 'Update' |+ 'Delete' |+ 'Follow' |+ 'Accept' |+ 'Announce' |+ 'Undo' |+ 'Like' |+ 'Reject' |+ 'View' |+ 'Dislike' |+ 'Flag'export interface ActivityAudience {to: string[]@@ -66,17 +87,17 @@ export interface ActivityAnnounce extends BaseActivity {}export interface ActivityUndo extends BaseActivity {- type: 'Undo',+ type: 'Undo'object: ActivityFollow | ActivityLike | ActivityDislike | ActivityCreate | ActivityAnnounce}export interface ActivityLike extends BaseActivity {- type: 'Like',+ type: 'Like'object: APObject}export interface ActivityView extends BaseActivity {- type: 'View',+ type: 'View'actor: stringobject: APObject}@@ -89,7 +110,7 @@ export interface ActivityDislike extends BaseActivity {}export interface ActivityFlag extends BaseActivity {- type: 'Flag',- content: string,+ type: 'Flag'+ content: stringobject: APObject | APObject[]}diff --git a/shared/models/activitypub/activitypub-actor.ts b/shared/models/activitypub/activitypub-actor.tsindex b8a2dc9251..f022f3d02b 100644--- a/shared/models/activitypub/activitypub-actor.ts+++ b/shared/models/activitypub/activitypub-actor.ts@@ -1,4 +1,4 @@-import { ActivityPubAttributedTo } from './objects/common-objects'+import { ActivityIconObject, ActivityPubAttributedTo } from './objects/common-objects'export type ActivityPubActorType = 'Person' | 'Application' | 'Group' | 'Service' | 'Organization'@@ -27,9 +27,5 @@ export interface ActivityPubActor {publicKeyPem: string}- icon: {- type: 'Image'- mediaType: 'image/png'- url: string- }+ icon: ActivityIconObject}diff --git a/shared/models/activitypub/activitypub-signature.ts b/shared/models/activitypub/activitypub-signature.tsindex 1d9f4b3b3c..fafdc246de 100644--- a/shared/models/activitypub/activitypub-signature.ts+++ b/shared/models/activitypub/activitypub-signature.ts@@ -1,6 +1,6 @@export interface ActivityPubSignature {- type: 'GraphSignature2012'- created: Date,+ type: string+ created: Datecreator: stringsignatureValue: string}diff --git a/shared/models/activitypub/objects/cache-file-object.ts b/shared/models/activitypub/objects/cache-file-object.tsindex 4b0a3a724d..19a8175824 100644--- a/shared/models/activitypub/objects/cache-file-object.ts+++ b/shared/models/activitypub/objects/cache-file-object.ts@@ -2,7 +2,7 @@ import { ActivityVideoUrlObject, ActivityPlaylistUrlObject } from './common-objeexport interface CacheFileObject {id: string- type: 'CacheFile',+ type: 'CacheFile'object: stringexpires: stringurl: ActivityVideoUrlObject | ActivityPlaylistUrlObjectdiff --git a/shared/models/activitypub/objects/common-objects.ts b/shared/models/activitypub/objects/common-objects.tsindex bab3ce366c..e94d054295 100644--- a/shared/models/activitypub/objects/common-objects.ts+++ b/shared/models/activitypub/objects/common-objects.ts@@ -7,9 +7,9 @@ export interface ActivityIdentifierObject {export interface ActivityIconObject {type: 'Image'url: string- mediaType: 'image/jpeg'- width: number- height: number+ mediaType: 'image/jpeg' | 'image/png'+ width?: number+ height?: number}export type ActivityVideoUrlObject = {@@ -72,19 +72,21 @@ export interface ActivityMentionObject {name: string}-export type ActivityTagObject = ActivityPlaylistSegmentHashesObject |- ActivityPlaylistInfohashesObject |- ActivityVideoUrlObject |- ActivityHashTagObject |- ActivityMentionObject |- ActivityBitTorrentUrlObject |- ActivityMagnetUrlObject+export type ActivityTagObject =+ ActivityPlaylistSegmentHashesObject+ | ActivityPlaylistInfohashesObject+ | ActivityVideoUrlObject+ | ActivityHashTagObject+ | ActivityMentionObject+ | ActivityBitTorrentUrlObject+ | ActivityMagnetUrlObject-export type ActivityUrlObject = ActivityVideoUrlObject |- ActivityPlaylistUrlObject |- ActivityBitTorrentUrlObject |- ActivityMagnetUrlObject |- ActivityHtmlUrlObject+export type ActivityUrlObject =+ ActivityVideoUrlObject+ | ActivityPlaylistUrlObject+ | ActivityBitTorrentUrlObject+ | ActivityMagnetUrlObject+ | ActivityHtmlUrlObjectexport interface ActivityPubAttributedTo {type: 'Group' | 'Person'diff --git a/shared/models/activitypub/objects/video-abuse-object.ts b/shared/models/activitypub/objects/video-abuse-object.tsindex 5f1264a76b..d9622b4148 100644--- a/shared/models/activitypub/objects/video-abuse-object.ts+++ b/shared/models/activitypub/objects/video-abuse-object.ts@@ -1,5 +1,5 @@export interface VideoAbuseObject {- type: 'Flag',+ type: 'Flag'content: stringobject: string | string[]}diff --git a/shared/models/activitypub/objects/video-torrent-object.ts b/shared/models/activitypub/objects/video-torrent-object.tsindex cadd0ea491..11de8fc56b 100644--- a/shared/models/activitypub/objects/video-torrent-object.ts+++ b/shared/models/activitypub/objects/video-torrent-object.ts@@ -20,8 +20,8 @@ export interface VideoTorrentObject {subtitleLanguage: ActivityIdentifierObject[]views: numbersensitive: boolean- commentsEnabled: boolean,- downloadEnabled: boolean,+ commentsEnabled: boolean+ downloadEnabled: booleanwaitTranscoding: booleanstate: VideoStatepublished: stringdiff --git a/shared/models/activitypub/objects/view-object.ts b/shared/models/activitypub/objects/view-object.tsindex 00348116a7..4dd21ce8e6 100644--- a/shared/models/activitypub/objects/view-object.ts+++ b/shared/models/activitypub/objects/view-object.ts@@ -1,5 +1,5 @@export interface ViewObject {- type: 'View',+ type: 'View'actor: stringobject: string}diff --git a/shared/models/i18n/i18n.ts b/shared/models/i18n/i18n.tsindex 0329442818..9ae175df9e 100644--- a/shared/models/i18n/i18n.ts+++ b/shared/models/i18n/i18n.ts@@ -56,6 +56,8 @@ export function isDefaultLocale (locale: string) {}export function peertubeTranslate (str: string, translations?: { [ id: string ]: string }) {+ // FIXME: remove disable rule when the client is upgraded to typescript 3.7+ // eslint-disable-next-linereturn translations && translations[str] ? translations[str] : str}diff --git a/shared/models/nodeinfo/index.d.ts b/shared/models/nodeinfo/index.d.tsindex 0a2d0492ec..336cb66d29 100644--- a/shared/models/nodeinfo/index.d.ts+++ b/shared/models/nodeinfo/index.d.ts@@ -98,7 +98,7 @@ export interface HttpNodeinfoDiasporaSoftwareNsSchema20 {* The amount of users that signed in at least once in the last 30 days.*/activeMonth?: number- };+ }/*** The amount of posts that were made by users that are registered on this server.*/diff --git a/shared/models/plugins/peertube-plugin-latest-version.model.ts b/shared/models/plugins/peertube-plugin-latest-version.model.tsindex dec4618fa2..811a64429c 100644--- a/shared/models/plugins/peertube-plugin-latest-version.model.ts+++ b/shared/models/plugins/peertube-plugin-latest-version.model.ts@@ -1,5 +1,5 @@export interface PeertubePluginLatestVersionRequest {- currentPeerTubeEngine?: string,+ currentPeerTubeEngine?: stringnpmNames: string[]}diff --git a/shared/models/plugins/plugin-package-json.model.ts b/shared/models/plugins/plugin-package-json.model.tsindex 3f30776713..c26e9ae5b5 100644--- a/shared/models/plugins/plugin-package-json.model.ts+++ b/shared/models/plugins/plugin-package-json.model.ts@@ -5,7 +5,7 @@ export type PluginTranslationPaths = {}export type ClientScript = {- script: string,+ script: stringscopes: PluginClientScope[]}@@ -13,12 +13,12 @@ export type PluginPackageJson = {name: stringversion: stringdescription: string- engine: { peertube: string },+ engine: { peertube: string }- homepage: string,- author: string,- bugs: string,- library: string,+ homepage: string+ author: string+ bugs: string+ library: stringstaticDirs: { [ name: string ]: string }css: string[]diff --git a/shared/models/plugins/server-hook.model.ts b/shared/models/plugins/server-hook.model.tsindex 80ecd9e24d..20f89b86d9 100644--- a/shared/models/plugins/server-hook.model.ts+++ b/shared/models/plugins/server-hook.model.ts@@ -70,7 +70,7 @@ export const serverActionHookObject = {// Fired when a user is updated by an admin/moderator'action:api.user.updated': true,- // Fired when a user got a new oauth2 token+ // Fired when a user got a new oauth2 token'action:api.user.oauth2-got-token': true}diff --git a/shared/models/redundancy/video-redundancy.model.ts b/shared/models/redundancy/video-redundancy.model.tsindex 014f69634e..fa6e058324 100644--- a/shared/models/redundancy/video-redundancy.model.ts+++ b/shared/models/redundancy/video-redundancy.model.ts@@ -24,10 +24,12 @@ interface RedundancyInformation {size: number}+// eslint-disable-next-line @typescript-eslint/no-empty-interfaceexport interface FileRedundancyInformation extends RedundancyInformation {}+// eslint-disable-next-line @typescript-eslint/no-empty-interfaceexport interface StreamingPlaylistRedundancyInformation extends RedundancyInformation {}diff --git a/shared/models/server/custom-config.model.ts b/shared/models/server/custom-config.model.tsindex 032b91a29a..07e17bda2b 100644--- a/shared/models/server/custom-config.model.ts+++ b/shared/models/server/custom-config.model.ts@@ -97,7 +97,7 @@ export interface CustomConfig {videos: {http: {enabled: boolean- },+ }torrent: {enabled: boolean}@@ -114,7 +114,7 @@ export interface CustomConfig {followers: {instance: {- enabled: boolean,+ enabled: booleanmanualApproval: boolean}}diff --git a/shared/models/server/job.model.ts b/shared/models/server/job.model.tsindex 19fd4c6592..cf29d20d40 100644--- a/shared/models/server/job.model.ts+++ b/shared/models/server/job.model.ts@@ -1,23 +1,24 @@export type JobState = 'active' | 'completed' | 'failed' | 'waiting' | 'delayed'-export type JobType = 'activitypub-http-unicast' |- 'activitypub-http-broadcast' |- 'activitypub-http-fetcher' |- 'activitypub-follow' |- 'video-file-import' |- 'video-transcoding' |- 'email' |- 'video-import' |- 'videos-views' |- 'activitypub-refresher' |- 'video-redundancy'+export type JobType =+ | 'activitypub-http-unicast'+ | 'activitypub-http-broadcast'+ | 'activitypub-http-fetcher'+ | 'activitypub-follow'+ | 'video-file-import'+ | 'video-transcoding'+ | 'email'+ | 'video-import'+ | 'videos-views'+ | 'activitypub-refresher'+ | 'video-redundancy'export interface Job {id: numberstate: JobStatetype: JobType- data: any,- error: any,+ data: any+ error: anycreatedAt: Date | stringfinishedOn: Date | stringprocessedOn: Date | stringdiff --git a/shared/models/server/server-config.model.ts b/shared/models/server/server-config.model.tsindex f1bb2153cd..76e0d6f2dd 100644--- a/shared/models/server/server-config.model.ts+++ b/shared/models/server/server-config.model.ts@@ -46,7 +46,7 @@ export interface ServerConfig {}signup: {- allowed: boolean,+ allowed: booleanallowedForCurrentIP: booleanrequiresEmailVerification: boolean}@@ -97,7 +97,7 @@ export interface ServerConfig {max: number}extensions: string[]- },+ }file: {extensions: string[]}@@ -107,7 +107,7 @@ export interface ServerConfig {file: {size: {max: number- },+ }extensions: string[]}}diff --git a/shared/models/users/user.model.ts b/shared/models/users/user.model.tsindex 1688511967..efb4510148 100644--- a/shared/models/users/user.model.ts+++ b/shared/models/users/user.model.ts@@ -1,6 +1,5 @@import { Account } from '../actors'import { VideoChannel } from '../videos/channel/video-channel.model'-import { VideoPlaylist } from '../videos/playlist/video-playlist.model'import { UserRole } from './user-role'import { NSFWPolicyType } from '../videos/nsfw-policy.type'import { UserNotificationSetting } from './user-notification-setting.model'diff --git a/tslint.json b/tslint.jsondeleted file mode 100644index cfe2ac7129..0000000000--- a/tslint.json+++ /dev/null@@ -1,19 +0,0 @@-{- "extends": "tslint-config-standard",- "rules": {- "await-promise": [true, "Bluebird"],- "no-inferrable-types": true,- "eofline": true,- "indent": [true, "spaces"],- "ter-indent": [- true,- 2,- {- "SwitchCase": 1- }- ],- "max-line-length": [true, 140],- "no-unused-variable": false, // Memory issues- "no-floating-promises": false- }-}diff --git a/yarn.lock b/yarn.lockindex 0a1ad1d611..6e75dab9a5 100644--- a/yarn.lock+++ b/yarn.lock@@ -118,6 +118,11 @@resolved "https://registry.yarnpkg.com/@types/cookiejar/-/cookiejar-2.1.1.tgz#90b68446364baf9efd8e8349bb36bd3852b75b80"integrity sha512-aRnpPa7ysx3aNW60hTiCtLHlQaIFsXFCgQlpakNgDNVFzbtusSY8PwjAQgRWfSk0ekNoBjO51eQRB6upA9uuyw==+"@types/eslint-visitor-keys@^1.0.0":+ version "1.0.0"+ resolved "https://registry.yarnpkg.com/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d"+ integrity sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag==+"@types/express-rate-limit@^3.3.0":version "3.3.3"resolved "https://registry.yarnpkg.com/@types/express-rate-limit/-/express-rate-limit-3.3.3.tgz#1be5c551be1615d243e3eec14dca091009c61113"@@ -163,6 +168,11 @@dependencies:"@types/node" "*"+"@types/json-schema@^7.0.3":+ version "7.0.4"+ resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.4.tgz#38fd73ddfd9b55abb1e1b2ed578cb55bd7b7d339"+ integrity sha512-8+KAKzEvSUdeo+kmqnKrqgeE+LcA0tjYWFY7RPProVYwnqDjukzO+3b6dLD56rYX5TdWejnEOLJYOIeh4CXKuA==+"@types/json5@^0.0.29":version "0.0.29"resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"@@ -392,6 +402,49 @@dependencies:"@types/node" "*"+"@typescript-eslint/eslint-plugin@^2.18.0":+ version "2.18.0"+ resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.18.0.tgz#f8cf272dfb057ecf1ea000fea1e0b3f06a32f9cb"+ integrity sha512-kuO8WQjV+RCZvAXVRJfXWiJ8iYEtfHlKgcqqqXg9uUkIolEHuUaMmm8/lcO4xwCOtaw6mY0gStn2Lg4/eUXXYQ==+ dependencies:+ "@typescript-eslint/experimental-utils" "2.18.0"+ eslint-utils "^1.4.3"+ functional-red-black-tree "^1.0.1"+ regexpp "^3.0.0"+ tsutils "^3.17.1"++"@typescript-eslint/[email protected]":+ version "2.18.0"+ resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.18.0.tgz#e4eab839082030282496c1439bbf9fdf2a4f3da8"+ integrity sha512-J6MopKPHuJYmQUkANLip7g9I82ZLe1naCbxZZW3O2sIxTiq/9YYoOELEKY7oPg0hJ0V/AQ225h2z0Yp+RRMXhw==+ dependencies:+ "@types/json-schema" "^7.0.3"+ "@typescript-eslint/typescript-estree" "2.18.0"+ eslint-scope "^5.0.0"++"@typescript-eslint/parser@^2.10.0":+ version "2.18.0"+ resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.18.0.tgz#d5f7fc1839abd4a985394e40e9d2454bd56aeb1f"+ integrity sha512-SJJPxFMEYEWkM6pGfcnjLU+NJIPo+Ko1QrCBL+i0+zV30ggLD90huEmMMhKLHBpESWy9lVEeWlQibweNQzyc+A==+ dependencies:+ "@types/eslint-visitor-keys" "^1.0.0"+ "@typescript-eslint/experimental-utils" "2.18.0"+ "@typescript-eslint/typescript-estree" "2.18.0"+ eslint-visitor-keys "^1.1.0"++"@typescript-eslint/[email protected]":+ version "2.18.0"+ resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.18.0.tgz#cfbd16ed1b111166617d718619c19b62764c8460"+ integrity sha512-gVHylf7FDb8VSi2ypFuEL3hOtoC4HkZZ5dOjXvVjoyKdRrvXAOPSzpNRnKMfaUUEiSLP8UF9j9X9EDLxC0lfZg==+ dependencies:+ debug "^4.1.1"+ eslint-visitor-keys "^1.1.0"+ glob "^7.1.6"+ is-glob "^4.0.1"+ lodash "^4.17.15"+ semver "^6.3.0"+ tsutils "^3.17.1"+abbrev@1:version "1.1.1"resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8"@@ -405,6 +458,16 @@ accepts@~1.3.4, accepts@~1.3.7:mime-types "~2.1.24"negotiator "0.6.2"+acorn-jsx@^5.1.0:+ version "5.1.0"+ resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.1.0.tgz#294adb71b57398b0680015f0a38c563ee1db5384"+ integrity sha512-tMUqwBWfLFbJbizRmEcWSLw6HnFzfdJs2sOJEOwwtVPMoH/0Ay+E703oZz78VSXZiiDcZrQ5XKjPIUQixhmgVw==++acorn@^7.1.0:+ version "7.1.0"+ resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.0.tgz#949d36f2c292535da602283586c2477c57eb2d6c"+ integrity sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==+addr-to-ip-port@^1.0.1, addr-to-ip-port@^1.4.2:version "1.5.1"resolved "https://registry.yarnpkg.com/addr-to-ip-port/-/addr-to-ip-port-1.5.1.tgz#bfada13fd6aeeeac19f1e9f7d84b4bbab45e5208"@@ -420,7 +483,7 @@ [email protected]:resolved "https://registry.yarnpkg.com/after/-/after-0.8.2.tgz#fedb394f9f0e02aa9768e702bda23b505fae7e1f"integrity sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=-ajv@^6.5.5:+ajv@^6.10.0, ajv@^6.10.2, ajv@^6.5.5:version "6.11.0"resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.11.0.tgz#c3607cbc8ae392d8a5a536f25b21f8e5f3f87fe9"integrity sha512-nCprB/0syFYy9fVYU1ox1l2KN8S9I+tziH8D4zdZuLT3N6RMlGSGt5FSTpAiHB/Whv8Qs1cWHma1aMKZyaHRKA==@@ -442,6 +505,13 @@ [email protected]:resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-3.2.3.tgz#57d35b8686e851e2cc04c403f1c00203976a1813"integrity sha512-LEHHyuhlPY3TmuUYMh2oz89lTShfvgbmzaBcxve9t/9Wuy7Dwf4yoAKcND7KFT1HAQfqZ12qtc+DUrBMeKF9nw==+ansi-escapes@^4.2.1:+ version "4.3.0"+ resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.0.tgz#a4ce2b33d6b214b7950d8595c212f12ac9cc569d"+ integrity sha512-EiYhwo0v255HUL6eDyuLrXEkTi7WwVCLAw+SeOQ7M7qdun1z1pum4DEm/nuqIVbPvi9RPPc9k9LbyBv6H0DwVg==+ dependencies:+ type-fest "^0.8.1"+ansi-regex@^2.0.0:version "2.1.1"resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"@@ -530,6 +600,23 @@ [email protected]:resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2"integrity sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=+array-includes@^3.0.3:+ version "3.1.1"+ resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.1.tgz#cdd67e6852bdf9c1215460786732255ed2459348"+ integrity sha512-c2VXaCHl7zPsvpkFsw4nxvFie4fh1ur9bpcgsVkIjqn0H/Xwdg+7fv3n2r/isyS8EBj5b06M9kHyZuIr4El6WQ==+ dependencies:+ define-properties "^1.1.3"+ es-abstract "^1.17.0"+ is-string "^1.0.5"++array.prototype.flat@^1.2.1:+ version "1.2.3"+ resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.2.3.tgz#0de82b426b0318dbfdb940089e38b043d37f6c7b"+ integrity sha512-gBlRZV0VSmfPIeWfuuy56XZMvbVfbEUnOXUvt3F/eUUUSyzlgLxhEX4YAEpxNAogRGehPSnfXyPtYyKAhkzQhQ==+ dependencies:+ define-properties "^1.1.3"+ es-abstract "^1.17.0-next.1"+arraybuffer.slice@~0.0.7:version "0.0.7"resolved "https://registry.yarnpkg.com/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz#3bbc4275dd584cc1b10809b89d4e8b63a69e7675"@@ -557,6 +644,11 @@ assertion-error@^1.1.0:resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b"integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==+astral-regex@^1.0.0:+ version "1.0.0"+ resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9"+ integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==+async-limiter@~1.0.0:version "1.0.1"resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd"@@ -899,11 +991,6 @@ bufferutil@^4.0.0:dependencies:node-gyp-build "~3.7.0"-builtin-modules@^1.1.1:- version "1.1.1"- resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f"- integrity sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=-bull@^3.4.2:version "3.12.1"resolved "https://registry.yarnpkg.com/bull/-/bull-3.12.1.tgz#ced62d0afca81c9264b44f1b6f39243df5d2e73f"@@ -943,6 +1030,11 @@ [email protected]:resolved "https://registry.yarnpkg.com/callsite/-/callsite-1.0.0.tgz#280398e5d664bd74038b6f0905153e6e8af1bc20"integrity sha1-KAOY5dZkvXQDi28JBRU+borxvCA=+callsites@^3.0.0:+ version "3.1.0"+ resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73"+ integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==+camelcase@^4.0.0:version "4.1.0"resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd"@@ -1009,7 +1101,7 @@ chai@^4.1.1:pathval "^1.1.0"type-detect "^4.0.5"-chalk@^2.0.0, chalk@^2.0.1, chalk@^2.3.0, chalk@^2.4.2:+chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.4.2:version "2.4.2"resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==@@ -1026,6 +1118,11 @@ chalk@^3.0.0:ansi-styles "^4.1.0"supports-color "^7.1.0"+chardet@^0.7.0:+ version "0.7.0"+ resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e"+ integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==+charenc@~0.0.1:version "0.0.2"resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667"@@ -1128,6 +1225,18 @@ cli-boxes@^1.0.0:resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-1.0.0.tgz#4fa917c3e59c94a004cd61f8ee509da651687143"integrity sha1-T6kXw+WclKAEzWH47lCdplFocUM=+cli-cursor@^3.1.0:+ version "3.1.0"+ resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-3.1.0.tgz#264305a7ae490d1d03bf0c9ba7c925d1753af307"+ integrity sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==+ dependencies:+ restore-cursor "^3.1.0"++cli-width@^2.0.0:+ version "2.2.0"+ resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639"+ integrity sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=+cliui@^5.0.0:version "5.0.0"resolved "https://registry.yarnpkg.com/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5"@@ -1255,7 +1364,7 @@ combined-stream@^1.0.6, combined-stream@~1.0.6:dependencies:delayed-stream "~1.0.0"-commander@^2.12.1, commander@^2.20.0, commander@^2.7.1:+commander@^2.20.0, commander@^2.7.1:version "2.20.3"resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==@@ -1346,6 +1455,11 @@ console-control-strings@^1.0.0, console-control-strings@~1.1.0:resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e"integrity sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=+contains-path@^0.1.0:+ version "0.1.0"+ resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a"+ integrity sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=+version "0.5.3"resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.3.tgz#e130caf7e7279087c5616c2007d0485698984fbd"@@ -1446,6 +1560,17 @@ cross-spawn@^5.0.1:shebang-command "^1.2.0"which "^1.2.9"+cross-spawn@^6.0.5:+ version "6.0.5"+ resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4"+ integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==+ dependencies:+ nice-try "^1.0.4"+ path-key "^2.0.1"+ semver "^5.5.0"+ shebang-command "^1.2.0"+ which "^1.2.9"+cross-spawn@^7.0.0:version "7.0.1"resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.1.tgz#0ab56286e0f7c24e153d04cc2aa027e43a9a5d14"@@ -1495,7 +1620,7 @@ date-fns@^2.0.1:resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.9.0.tgz#d0b175a5c37ed5f17b97e2272bbc1fa5aec677d2"integrity sha512-khbFLu/MlzLjEzy9Gh8oY1hNt/Dvxw3J6Rbc28cVoYWQaC1S3YI4xwkF9ZWcjDLscbZlY9hISMr66RFzZagLsA==[email protected], debug@^2.2.0:[email protected], debug@^2.2.0, debug@^2.6.9:version "2.6.9"resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==@@ -1564,6 +1689,11 @@ deep-extend@^0.6.0:resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac"integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==+deep-is@~0.1.3:+ version "0.1.3"+ resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34"+ integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=+deep-object-diff@^1.1.0:version "1.1.0"resolved "https://registry.yarnpkg.com/deep-object-diff/-/deep-object-diff-1.1.0.tgz#d6fabf476c2ed1751fc94d5ca693d2ed8c18bc5a"@@ -1643,13 +1773,20 @@ [email protected]:resolved "https://registry.yarnpkg.com/dns-prefetch-control/-/dns-prefetch-control-0.2.0.tgz#73988161841f3dcc81f47686d539a2c702c88624"integrity sha512-hvSnros73+qyZXhHFjx2CMLwoj3Fe7eR9EJsFsqmcI1bB2OBWL/+0YzaEaKssCHnj/6crawNnUyw74Gm2EKe+Q==- version "0.7.2"- resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-0.7.2.tgz#7cb860359ba3be90e040b26b729ce4bfa654c523"- integrity sha1-fLhgNZujvpDgQLJrcpzkv6ZUxSM=+ version "1.5.0"+ resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa"+ integrity sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=dependencies:- esutils "^1.1.6"- isarray "0.0.1"+ esutils "^2.0.2"+ isarray "^1.0.0"++doctrine@^3.0.0:+ version "3.0.0"+ resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961"+ integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==+ dependencies:+ esutils "^2.0.2"version "1.1.0"@@ -1815,14 +1952,14 @@ [email protected]:resolved "https://registry.yarnpkg.com/env-variable/-/env-variable-0.0.6.tgz#74ab20b3786c545b62b4a4813ab8cf22726c9808"integrity sha512-bHz59NlBbtS0NhftmR8+ExBEekE7br0e01jw+kk0NDro7TtZzBYZ5ScGPs3OmwnpyfHTHOtr1Y6uedCdrIldtg==-error-ex@^1.3.1:+error-ex@^1.2.0, error-ex@^1.3.1:version "1.3.2"resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf"integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==dependencies:is-arrayish "^0.2.1"-es-abstract@^1.17.0-next.0, es-abstract@^1.17.0-next.1, es-abstract@^1.17.2:+es-abstract@^1.17.0, es-abstract@^1.17.0-next.0, es-abstract@^1.17.0-next.1, es-abstract@^1.17.2:version "1.17.4"resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.17.4.tgz#e3aedf19706b20e7c2594c35fc0d57605a79e184"integrity sha512-Ae3um/gb8F0mui/jPL+QiqmglkUsaQf7FwBEHYIFkztkneosu9imhqHpBzQ3h1vit8t5iQ74t6PEVvphBZiuiQ==@@ -1899,15 +2036,185 @@ [email protected], escape-string-regexp@^1.0.5, escape-string-regexp@~1resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=+eslint-config-standard-with-typescript@^12.0.1:+ version "12.0.1"+ resolved "https://registry.yarnpkg.com/eslint-config-standard-with-typescript/-/eslint-config-standard-with-typescript-12.0.1.tgz#60f941a3a942b50393715ca336e1c7ba76e3ab04"+ integrity sha512-v0DDNzsb36Oun3N04Y27Ca9DfF+S9Orrdtqa5anUUpwIu/MMqCRxYAcKdD0Uao+Gzqz9EjaFYjBKZCPFyXH5jw==+ dependencies:+ "@typescript-eslint/parser" "^2.10.0"+ eslint-config-standard "^14.1.0"++eslint-config-standard@^14.1.0:+ version "14.1.0"+ resolved "https://registry.yarnpkg.com/eslint-config-standard/-/eslint-config-standard-14.1.0.tgz#b23da2b76fe5a2eba668374f246454e7058f15d4"+ integrity sha512-EF6XkrrGVbvv8hL/kYa/m6vnvmUT+K82pJJc4JJVMM6+Qgqh0pnwprSxdduDLB9p/7bIxD+YV5O0wfb8lmcPbA==++eslint-import-resolver-node@^0.3.2:+ version "0.3.3"+ resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.3.tgz#dbaa52b6b2816b50bc6711af75422de808e98404"+ integrity sha512-b8crLDo0M5RSe5YG8Pu2DYBj71tSB6OvXkfzwbJU2w7y8P4/yo0MyF8jU26IEuEuHF2K5/gcAJE3LhQGqBBbVg==+ dependencies:+ debug "^2.6.9"+ resolve "^1.13.1"++eslint-module-utils@^2.4.1:+ version "2.5.2"+ resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.5.2.tgz#7878f7504824e1b857dd2505b59a8e5eda26a708"+ integrity sha512-LGScZ/JSlqGKiT8OC+cYRxseMjyqt6QO54nl281CK93unD89ijSeRV6An8Ci/2nvWVKe8K/Tqdm75RQoIOCr+Q==+ dependencies:+ debug "^2.6.9"+ pkg-dir "^2.0.0"++eslint-plugin-es@^3.0.0:+ version "3.0.0"+ resolved "https://registry.yarnpkg.com/eslint-plugin-es/-/eslint-plugin-es-3.0.0.tgz#98cb1bc8ab0aa807977855e11ad9d1c9422d014b"+ integrity sha512-6/Jb/J/ZvSebydwbBJO1R9E5ky7YeElfK56Veh7e4QGFHCXoIXGH9HhVz+ibJLM3XJ1XjP+T7rKBLUa/Y7eIng==+ dependencies:+ eslint-utils "^2.0.0"+ regexpp "^3.0.0"++eslint-plugin-import@^2.20.1:+ version "2.20.1"+ resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.20.1.tgz#802423196dcb11d9ce8435a5fc02a6d3b46939b3"+ integrity sha512-qQHgFOTjguR+LnYRoToeZWT62XM55MBVXObHM6SKFd1VzDcX/vqT1kAz8ssqigh5eMj8qXcRoXXGZpPP6RfdCw==+ dependencies:+ array-includes "^3.0.3"+ array.prototype.flat "^1.2.1"+ contains-path "^0.1.0"+ debug "^2.6.9"+ doctrine "1.5.0"+ eslint-import-resolver-node "^0.3.2"+ eslint-module-utils "^2.4.1"+ has "^1.0.3"+ minimatch "^3.0.4"+ object.values "^1.1.0"+ read-pkg-up "^2.0.0"+ resolve "^1.12.0"++eslint-plugin-node@^11.0.0:+ version "11.0.0"+ resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-11.0.0.tgz#365944bb0804c5d1d501182a9bc41a0ffefed726"+ integrity sha512-chUs/NVID+sknFiJzxoN9lM7uKSOEta8GC8365hw1nDfwIPIjjpRSwwPvQanWv8dt/pDe9EV4anmVSwdiSndNg==+ dependencies:+ eslint-plugin-es "^3.0.0"+ eslint-utils "^2.0.0"+ ignore "^5.1.1"+ minimatch "^3.0.4"+ resolve "^1.10.1"+ semver "^6.1.0"++eslint-plugin-promise@^4.2.1:+ version "4.2.1"+ resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-4.2.1.tgz#845fd8b2260ad8f82564c1222fce44ad71d9418a"+ integrity sha512-VoM09vT7bfA7D+upt+FjeBO5eHIJQBUWki1aPvB+vbNiHS3+oGIJGIeyBtKQTME6UPXXy3vV07OL1tHd3ANuDw==++eslint-plugin-standard@^4.0.1:+ version "4.0.1"+ resolved "https://registry.yarnpkg.com/eslint-plugin-standard/-/eslint-plugin-standard-4.0.1.tgz#ff0519f7ffaff114f76d1bd7c3996eef0f6e20b4"+ integrity sha512-v/KBnfyaOMPmZc/dmc6ozOdWqekGp7bBGq4jLAecEfPGmfKiWS4sA8sC0LqiV9w5qmXAtXVn4M3p1jSyhY85SQ==++eslint-scope@^5.0.0:+ version "5.0.0"+ resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.0.0.tgz#e87c8887c73e8d1ec84f1ca591645c358bfc8fb9"+ integrity sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw==+ dependencies:+ esrecurse "^4.1.0"+ estraverse "^4.1.1"++eslint-utils@^1.4.3:+ version "1.4.3"+ resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.3.tgz#74fec7c54d0776b6f67e0251040b5806564e981f"+ integrity sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q==+ dependencies:+ eslint-visitor-keys "^1.1.0"++eslint-utils@^2.0.0:+ version "2.0.0"+ resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-2.0.0.tgz#7be1cc70f27a72a76cd14aa698bcabed6890e1cd"+ integrity sha512-0HCPuJv+7Wv1bACm8y5/ECVfYdfsAm9xmVb7saeFlxjPYALefjhbYoCkBjPdPzGH8wWyTpAez82Fh3VKYEZ8OA==+ dependencies:+ eslint-visitor-keys "^1.1.0"++eslint-visitor-keys@^1.1.0:+ version "1.1.0"+ resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2"+ integrity sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A==++eslint@^6.8.0:+ version "6.8.0"+ resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.8.0.tgz#62262d6729739f9275723824302fb227c8c93ffb"+ integrity sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig==+ dependencies:+ "@babel/code-frame" "^7.0.0"+ ajv "^6.10.0"+ chalk "^2.1.0"+ cross-spawn "^6.0.5"+ debug "^4.0.1"+ doctrine "^3.0.0"+ eslint-scope "^5.0.0"+ eslint-utils "^1.4.3"+ eslint-visitor-keys "^1.1.0"+ espree "^6.1.2"+ esquery "^1.0.1"+ esutils "^2.0.2"+ file-entry-cache "^5.0.1"+ functional-red-black-tree "^1.0.1"+ glob-parent "^5.0.0"+ globals "^12.1.0"+ ignore "^4.0.6"+ import-fresh "^3.0.0"+ imurmurhash "^0.1.4"+ inquirer "^7.0.0"+ is-glob "^4.0.0"+ js-yaml "^3.13.1"+ json-stable-stringify-without-jsonify "^1.0.1"+ levn "^0.3.0"+ lodash "^4.17.14"+ minimatch "^3.0.4"+ mkdirp "^0.5.1"+ natural-compare "^1.4.0"+ optionator "^0.8.3"+ progress "^2.0.0"+ regexpp "^2.0.1"+ semver "^6.1.2"+ strip-ansi "^5.2.0"+ strip-json-comments "^3.0.1"+ table "^5.2.3"+ text-table "^0.2.0"+ v8-compile-cache "^2.0.3"++espree@^6.1.2:+ version "6.1.2"+ resolved "https://registry.yarnpkg.com/espree/-/espree-6.1.2.tgz#6c272650932b4f91c3714e5e7b5f5e2ecf47262d"+ integrity sha512-2iUPuuPP+yW1PZaMSDM9eyVf8D5P0Hi8h83YtZ5bPc/zHYjII5khoixIUTMO794NOY8F/ThF1Bo8ncZILarUTA==+ dependencies:+ acorn "^7.1.0"+ acorn-jsx "^5.1.0"+ eslint-visitor-keys "^1.1.0"+esprima@^4.0.0:version "4.0.1"resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==-esutils@^1.1.6:- version "1.1.6"- resolved "https://registry.yarnpkg.com/esutils/-/esutils-1.1.6.tgz#c01ccaa9ae4b897c6d0c3e210ae52f3c7a844375"- integrity sha1-wBzKqa5LiXxtDD4hCuUvPHqEQ3U=+esquery@^1.0.1:+ version "1.0.1"+ resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.1.tgz#406c51658b1f5991a5f9b62b1dc25b00e3e5c708"+ integrity sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA==+ dependencies:+ estraverse "^4.0.0"++esrecurse@^4.1.0:+ version "4.2.1"+ resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf"+ integrity sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==+ dependencies:+ estraverse "^4.1.0"++estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1:+ version "4.3.0"+ resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d"+ integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==esutils@^2.0.2:version "2.0.3"@@ -1980,13 +2287,13 @@ express-rate-limit@^4.0.4:resolved "https://registry.yarnpkg.com/express-rate-limit/-/express-rate-limit-4.0.4.tgz#a495338ae9e58c856b66d1346ec0d86f43ba2e43"integrity sha512-DLRj2vMO7Xgai8qWKU9O6ZztF2bdDmfFNFi9k3G9BPzJ+7MG7eWaaBikbe0eBpNGSxU8JziwW0PQKG78aNWa6g==-express-validator@^6.1.1:- version "6.3.1"- resolved "https://registry.yarnpkg.com/express-validator/-/express-validator-6.3.1.tgz#5ad6ca3ce6141f33638608d006d26c217500f375"- integrity sha512-YQHQKP/zlUTN6d38uWwXgK3At5phK6R24pOB/ImWisMUz/U/1AC3ZXMgiZYhtH4ViYJ6UAiV0/nj8s1Qs3kmvw==+express-validator@^6.4.0:+ version "6.4.0"+ resolved "https://registry.yarnpkg.com/express-validator/-/express-validator-6.4.0.tgz#634f96b60d53112409e270c038ab818a36f56e47"+ integrity sha512-Fs+x0yDOSiUV+o5jIRloMyBxqpSzJiMM8KQW1IRVv2l49F6ATU0F9uPa+3K6vXNlLlhUjauv2FCGLFPMaNr24w==dependencies:lodash "^4.17.15"- validator "^11.1.0"+ validator "^12.1.0"express@^4.12.4, express@^4.13.3, express@^4.17.1:version "4.17.1"@@ -2036,6 +2343,15 @@ extend@^3.0.0, extend@~3.0.0, extend@~3.0.2:resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa"integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==+external-editor@^3.0.3:+ version "3.1.0"+ resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.1.0.tgz#cb03f740befae03ea4d283caed2741a83f335495"+ integrity sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==+ dependencies:+ chardet "^0.7.0"+ iconv-lite "^0.4.24"+ tmp "^0.0.33"+version "1.3.0"resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05"@@ -2061,6 +2377,11 @@ fast-json-stable-stringify@^2.0.0:resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633"integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==+fast-levenshtein@~2.0.6:+ version "2.0.6"+ resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917"+ integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=+fast-safe-stringify@^2.0.4:version "2.0.7"resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz#124aa885899261f68aedb42a7c080de9da608743"@@ -2076,6 +2397,20 @@ fecha@^2.3.3:resolved "https://registry.yarnpkg.com/fecha/-/fecha-2.3.3.tgz#948e74157df1a32fd1b12c3a3c3cdcb6ec9d96cd"integrity sha512-lUGBnIamTAwk4znq5BcqsDaxSmZ9nDVJaij6NvRt/Tg4R69gERA+otPKbS86ROw9nxVMw2/mp1fnaiWqbs6Sdg==+figures@^3.0.0:+ version "3.1.0"+ resolved "https://registry.yarnpkg.com/figures/-/figures-3.1.0.tgz#4b198dd07d8d71530642864af2d45dd9e459c4ec"+ integrity sha512-ravh8VRXqHuMvZt/d8GblBeqDMkdJMBdv/2KntFH+ra5MXkO7nxNKpzQ3n6QD/2da1kH0aWmNISdvhM7gl2gVg==+ dependencies:+ escape-string-regexp "^1.0.5"++file-entry-cache@^5.0.1:+ version "5.0.1"+ resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-5.0.1.tgz#ca0f6efa6dd3d561333fb14515065c2fafdf439c"+ integrity sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==+ dependencies:+ flat-cache "^2.0.1"+filestream@^5.0.0:version "5.0.0"resolved "https://registry.yarnpkg.com/filestream/-/filestream-5.0.0.tgz#79015f3bae95ad0f47ef818694846f085087b92e"@@ -2111,6 +2446,13 @@ [email protected], find-up@^3.0.0:dependencies:locate-path "^3.0.0"+find-up@^2.0.0, find-up@^2.1.0:+ version "2.1.0"+ resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7"+ integrity sha1-RdG35QbHF93UgndaK3eSCjwMV6c=+ dependencies:+ locate-path "^2.0.0"+find-up@^4.1.0:version "4.1.0"resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19"@@ -2119,6 +2461,15 @@ find-up@^4.1.0:locate-path "^5.0.0"path-exists "^4.0.0"+flat-cache@^2.0.1:+ version "2.0.1"+ resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0"+ integrity sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==+ dependencies:+ flatted "^2.0.0"+ rimraf "2.6.3"+ write "1.0.3"+flat@^4.1.0:version "4.1.0"resolved "https://registry.yarnpkg.com/flat/-/flat-4.1.0.tgz#090bec8b05e39cba309747f1d588f04dbaf98db2"@@ -2133,6 +2484,11 @@ flat@^5.0.0:dependencies:is-buffer "~2.0.4"+flatted@^2.0.0:+ version "2.0.1"+ resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.1.tgz#69e57caa8f0eacbc281d2e2cb458d46fdb449e08"+ integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==+fluent-ffmpeg@^2.1.0:version "2.1.2"resolved "https://registry.yarnpkg.com/fluent-ffmpeg/-/fluent-ffmpeg-2.1.2.tgz#c952de2240f812ebda0aa8006d7776ee2acf7d74"@@ -2243,6 +2599,11 @@ function-bind@^1.1.1:resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==+functional-red-black-tree@^1.0.1:+ version "1.0.1"+ resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327"+ integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=+gauge@~2.7.3:version "2.7.4"resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7"@@ -2306,7 +2667,7 @@ [email protected]:resolved "https://registry.yarnpkg.com/github-from-package/-/github-from-package-0.0.0.tgz#97fb5d96bfde8973313f20e8288ef9a167fa64ce"integrity sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4=-glob-parent@~5.1.0:+glob-parent@^5.0.0, glob-parent@~5.1.0:version "5.1.0"resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.0.tgz#5f4c1d1e748d30cd73ad2944b3577a81b081e8c2"integrity sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw==@@ -2337,7 +2698,7 @@ [email protected]:once "^1.3.0"path-is-absolute "^1.0.0"-glob@^7.0.3, glob@^7.1.1, glob@^7.1.3:+glob@^7.0.3, glob@^7.1.3, glob@^7.1.6:version "7.1.6"resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==@@ -2356,6 +2717,13 @@ global-dirs@^0.1.0:dependencies:ini "^1.3.4"+globals@^12.1.0:+ version "12.3.0"+ resolved "https://registry.yarnpkg.com/globals/-/globals-12.3.0.tgz#1e564ee5c4dded2ab098b0f88f24702a3c56be13"+ integrity sha512-wAfjdLgFsPZsklLJvOBUBmzYE8/CwhEqSBEMRXA3qxIiNtyqvjYurAtIfDh6chlEPUfmTY3MnZh5Hfh4q0UlIw==+ dependencies:+ type-fest "^0.8.1"+got@^6.7.1:version "6.7.1"resolved "https://registry.yarnpkg.com/got/-/got-6.7.1.tgz#240cd05785a9a18e561dc1b44b41c763ef1e8db0"@@ -2575,7 +2943,7 @@ [email protected]:resolved "https://registry.yarnpkg.com/i/-/i-0.3.6.tgz#d96c92732076f072711b6b10fd7d4f65ad8ee23d"integrity sha1-2WyScyB28HJxG2sQ/X1PZa2O4j0=[email protected], iconv-lite@^0.4.4, iconv-lite@~0.4.24:[email protected], iconv-lite@^0.4.24, iconv-lite@^0.4.4, iconv-lite@~0.4.24:version "0.4.24"resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==@@ -2599,6 +2967,16 @@ ignore-walk@^3.0.1:dependencies:minimatch "^3.0.4"+ignore@^4.0.6:+ version "4.0.6"+ resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc"+ integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==++ignore@^5.1.1:+ version "5.1.4"+ resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.4.tgz#84b7b3dbe64552b6ef0eca99f6743dbec6d97adf"+ integrity sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A==+immediate-chunk-store@^2.0.0:version "2.1.0"resolved "https://registry.yarnpkg.com/immediate-chunk-store/-/immediate-chunk-store-2.1.0.tgz#3dbd3b5cc77182526188a8da47e38488a6627336"@@ -2606,6 +2984,14 @@ immediate-chunk-store@^2.0.0:dependencies:queue-microtask "^1.1.2"+import-fresh@^3.0.0:+ version "3.2.1"+ resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.2.1.tgz#633ff618506e793af5ac91bf48b72677e15cbe66"+ integrity sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==+ dependencies:+ parent-module "^1.0.0"+ resolve-from "^4.0.0"+import-lazy@^2.1.0:version "2.1.0"resolved "https://registry.yarnpkg.com/import-lazy/-/import-lazy-2.1.0.tgz#05698e3d45c88e8d7e9d92cb0584e77f096f3e43"@@ -2649,6 +3035,25 @@ ini@^1.3.4, ini@~1.3.0:resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927"integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==+inquirer@^7.0.0:+ version "7.0.4"+ resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-7.0.4.tgz#99af5bde47153abca23f5c7fc30db247f39da703"+ integrity sha512-Bu5Td5+j11sCkqfqmUTiwv+tWisMtP0L7Q8WrqA2C/BbBhy1YTdFrvjjlrKq8oagA/tLQBski2Gcx/Sqyi2qSQ==+ dependencies:+ ansi-escapes "^4.2.1"+ chalk "^2.4.2"+ cli-cursor "^3.1.0"+ cli-width "^2.0.0"+ external-editor "^3.0.3"+ figures "^3.0.0"+ lodash "^4.17.15"+ mute-stream "0.0.8"+ run-async "^2.2.0"+ rxjs "^6.5.3"+ string-width "^4.1.0"+ strip-ansi "^5.1.0"+ through "^2.3.6"+ioredis@^4.14.1:version "4.14.1"resolved "https://registry.yarnpkg.com/ioredis/-/ioredis-4.14.1.tgz#b73ded95fcf220f106d33125a92ef6213aa31318"@@ -2794,7 +3199,7 @@ is-generator@^1.0.2:resolved "https://registry.yarnpkg.com/is-generator/-/is-generator-1.0.3.tgz#c14c21057ed36e328db80347966c693f886389f3"integrity sha1-wUwhBX7TbjKNuANHlmxpP4hjifM=-is-glob@^4.0.1, is-glob@~4.0.1:+is-glob@^4.0.0, is-glob@^4.0.1, is-glob@~4.0.1:version "4.0.1"resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc"integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==@@ -2838,7 +3243,7 @@ is-path-inside@^1.0.0:dependencies:path-is-inside "^1.0.1"-is-promise@^2.1:+is-promise@^2.1, is-promise@^2.1.0:version "2.1.0"resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa"integrity sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=@@ -2870,6 +3275,11 @@ is-stream@^2.0.0:resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.0.tgz#bde9c32680d6fae04129d6ac9d921ce7815f78e3"integrity sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==+is-string@^1.0.5:+ version "1.0.5"+ resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.5.tgz#40493ed198ef3ff477b8c7f92f644ec82a5cd3a6"+ integrity sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==+is-symbol@^1.0.2:version "1.0.3"resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.3.tgz#38e1014b9e6329be0de9d24a414fd7441ec61937"@@ -2897,7 +3307,7 @@ [email protected]:resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.1.tgz#a37d94ed9cda2d59865c9f76fe596ee1f338741e"integrity sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=-isarray@~1.0.0:+isarray@^1.0.0, isarray@~1.0.0:version "1.0.0"resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=@@ -2959,6 +3369,11 @@ [email protected]:resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13"integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=+json-stable-stringify-without-jsonify@^1.0.1:+ version "1.0.1"+ resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651"+ integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=+json-stringify-safe@~5.0.1:version "5.0.1"resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb"@@ -3055,6 +3470,14 @@ latest-version@^3.0.0:dependencies:package-json "^4.0.0"+levn@^0.3.0, levn@~0.3.0:+ version "0.3.0"+ resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee"+ integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=+ dependencies:+ prelude-ls "~1.1.2"+ type-check "~0.3.2"+version "0.19.7"resolved "https://registry.yarnpkg.com/libxmljs/-/libxmljs-0.19.7.tgz#96c2151b0b73f33dd29917edec82902587004e5a"@@ -3075,6 +3498,24 @@ load-ip-set@^2.1.0:simple-get "^3.0.0"split "^1.0.0"+load-json-file@^2.0.0:+ version "2.0.0"+ resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-2.0.0.tgz#7947e42149af80d696cbf797bcaabcfe1fe29ca8"+ integrity sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=+ dependencies:+ graceful-fs "^4.1.2"+ parse-json "^2.2.0"+ pify "^2.0.0"+ strip-bom "^3.0.0"++locate-path@^2.0.0:+ version "2.0.0"+ resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e"+ integrity sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=+ dependencies:+ p-locate "^2.0.0"+ path-exists "^3.0.0"+locate-path@^3.0.0:version "3.0.0"resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e"@@ -3487,7 +3928,7 @@ multistream@^4.0.0:dependencies:readable-stream "^3.4.0"-mute-stream@~0.0.4:[email protected], mute-stream@~0.0.4:version "0.0.8"resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d"integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==@@ -3502,6 +3943,11 @@ napi-build-utils@^1.0.1:resolved "https://registry.yarnpkg.com/napi-build-utils/-/napi-build-utils-1.0.1.tgz#1381a0f92c39d66bf19852e7873432fc2123e508"integrity sha512-boQj1WFgQH3v4clhu3mTNfP+vOBxorDlE8EKiMjUlLG3C4qAESnn9AxIOkFgTR2c9LtzNjPrjS60cT27ZKBhaA==+natural-compare@^1.4.0:+ version "1.4.0"+ resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"+ integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=+version "1.0.1"resolved "https://registry.yarnpkg.com/ncp/-/ncp-1.0.1.tgz#d15367e5cb87432ba117d2bf80fdf45aecfb4246"@@ -3536,6 +3982,11 @@ next-tick@1, next-tick@~1.0.0:resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c"integrity sha1-yobR/ogoFpsBICCOPchCS524NCw=+nice-try@^1.0.4:+ version "1.0.5"+ resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366"+ integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==+version "2.1.0"resolved "https://registry.yarnpkg.com/nocache/-/nocache-2.1.0.tgz#120c9ffec43b5729b1d5de88cd71aa75a0ba491f"@@ -3769,6 +4220,16 @@ object.getownpropertydescriptors@^2.0.3, object.getownpropertydescriptors@^2.1.0define-properties "^1.1.3"es-abstract "^1.17.0-next.1"+object.values@^1.1.0:+ version "1.1.1"+ resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.1.tgz#68a99ecde356b7e9295a3c5e0ce31dc8c953de5e"+ integrity sha512-WTa54g2K8iu0kmS/us18jEmdv1a4Wi//BZ/DTVYEcH0XhLM5NYdpDHja3gt57VrZLcNAO2WGA+KpWsDBaHt6eA==+ dependencies:+ define-properties "^1.1.3"+ es-abstract "^1.17.0-next.1"+ function-bind "^1.1.1"+ has "^1.0.3"+on-finished@^2.3.0, on-finished@~2.3.0:version "2.3.0"resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947"@@ -3822,6 +4283,18 @@ opn@^6.0.0:dependencies:is-wsl "^1.1.0"+optionator@^0.8.3:+ version "0.8.3"+ resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495"+ integrity sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==+ dependencies:+ deep-is "~0.1.3"+ fast-levenshtein "~2.0.6"+ levn "~0.3.0"+ prelude-ls "~1.1.2"+ type-check "~0.3.2"+ word-wrap "~1.2.3"+os-homedir@^1.0.0:version "1.0.2"resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3"@@ -3850,6 +4323,13 @@ p-finally@^2.0.0:resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-2.0.1.tgz#bd6fcaa9c559a096b680806f4d657b3f0f240561"integrity sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw==+p-limit@^1.1.0:+ version "1.3.0"+ resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8"+ integrity sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==+ dependencies:+ p-try "^1.0.0"+p-limit@^2.0.0, p-limit@^2.2.0:version "2.2.2"resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.2.tgz#61279b67721f5287aa1c13a9a7fbbc48c9291b1e"@@ -3857,6 +4337,13 @@ p-limit@^2.0.0, p-limit@^2.2.0:dependencies:p-try "^2.0.0"+p-locate@^2.0.0:+ version "2.0.0"+ resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43"+ integrity sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=+ dependencies:+ p-limit "^1.1.0"+p-locate@^3.0.0:version "3.0.0"resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4"@@ -3878,6 +4365,11 @@ p-timeout@^3.1.0:dependencies:p-finally "^1.0.0"+p-try@^1.0.0:+ version "1.0.0"+ resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3"+ integrity sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=+p-try@^2.0.0:version "2.2.0"resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6"@@ -3905,6 +4397,20 @@ [email protected]:resolved "https://registry.yarnpkg.com/packet-reader/-/packet-reader-1.0.0.tgz#9238e5480dedabacfe1fe3f2771063f164157d74"integrity sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ==+parent-module@^1.0.0:+ version "1.0.1"+ resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2"+ integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==+ dependencies:+ callsites "^3.0.0"++parse-json@^2.2.0:+ version "2.2.0"+ resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9"+ integrity sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=+ dependencies:+ error-ex "^1.2.0"+parse-json@^4.0.0:version "4.0.0"resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0"@@ -3977,7 +4483,7 @@ path-is-inside@^1.0.1:resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53"integrity sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=-path-key@^2.0.0:+path-key@^2.0.0, path-key@^2.0.1:version "2.0.1"resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40"integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=@@ -3997,6 +4503,13 @@ [email protected]:resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c"integrity sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=+path-type@^2.0.0:+ version "2.0.0"+ resolved "https://registry.yarnpkg.com/path-type/-/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73"+ integrity sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=+ dependencies:+ pify "^2.0.0"+pathval@^1.1.0:version "1.1.0"resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.0.tgz#b942e6d4bde653005ef6b71361def8727d0645e0"@@ -4096,11 +4609,23 @@ piece-length@^2.0.1:resolved "https://registry.yarnpkg.com/piece-length/-/piece-length-2.0.1.tgz#dbed4e78976955f34466d0a65304d0cb21914ac9"integrity sha512-dBILiDmm43y0JPISWEmVGKBETQjwJe6mSU9GND+P9KW0SJGUwoU/odyH1nbalOP9i8WSYuqf1lQnaj92Bhw+Ug==+pify@^2.0.0:+ version "2.3.0"+ resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c"+ integrity sha1-7RQaasBDqEnqWISY59yosVMw6Qw=+pify@^3.0.0:version "3.0.0"resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176"integrity sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=+pkg-dir@^2.0.0:+ version "2.0.0"+ resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-2.0.0.tgz#f6d5d1109e19d63edf428e0bd57e12777615334b"+ integrity sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=+ dependencies:+ find-up "^2.1.0"+version "0.3.1"resolved "https://registry.yarnpkg.com/pkginfo/-/pkginfo-0.3.1.tgz#5b29f6a81f70717142e09e765bbeab97b4f81e21"@@ -4154,6 +4679,11 @@ prebuild-install@^5.3.3:tunnel-agent "^0.6.0"which-pm-runs "^1.0.0"+prelude-ls@~1.1.2:+ version "1.1.2"+ resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"+ integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=+prepend-http@^1.0.1:version "1.0.4"resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc"@@ -4164,6 +4694,11 @@ process-nextick-args@~2.0.0:resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2"integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==+progress@^2.0.0:+ version "2.0.3"+ resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8"+ integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==+promise.prototype.finally@^3.1.1:version "3.1.2"resolved "https://registry.yarnpkg.com/promise.prototype.finally/-/promise.prototype.finally-3.1.2.tgz#b8af89160c9c673cefe3b4c4435b53cfd0287067"@@ -4339,6 +4874,23 @@ rdf-canonize@^1.0.2:node-forge "^0.9.1"semver "^6.3.0"+read-pkg-up@^2.0.0:+ version "2.0.0"+ resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be"+ integrity sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=+ dependencies:+ find-up "^2.0.0"+ read-pkg "^2.0.0"++read-pkg@^2.0.0:+ version "2.0.0"+ resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-2.0.0.tgz#8ef1c0623c6a6db0dc6713c4bfac46332b2368f8"+ integrity sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=+ dependencies:+ load-json-file "^2.0.0"+ normalize-package-data "^2.3.2"+ path-type "^2.0.0"+read-pkg@^4.0.1:version "4.0.1"resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-4.0.1.tgz#963625378f3e1c4d48c85872b5a6ec7d5d093237"@@ -4464,6 +5016,16 @@ reflect-metadata@^0.1.12:resolved "https://registry.yarnpkg.com/reflect-metadata/-/reflect-metadata-0.1.13.tgz#67ae3ca57c972a2aa1642b10fe363fe32d49dc08"integrity sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==+regexpp@^2.0.1:+ version "2.0.1"+ resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f"+ integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==++regexpp@^3.0.0:+ version "3.0.0"+ resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.0.0.tgz#dd63982ee3300e67b41c1956f850aa680d9d330e"+ integrity sha512-Z+hNr7RAVWxznLPuA7DIh8UNX1j9CDrUQxskw9IrBE1Dxue2lyXT+shqEIeLUjrokxIP8CMy1WkjgG3rTsd5/g==+registry-auth-token@^3.0.1:version "3.4.0"resolved "https://registry.yarnpkg.com/registry-auth-token/-/registry-auth-token-3.4.0.tgz#d7446815433f5d5ed6431cd5dca21048f66b397e"@@ -4531,6 +5093,11 @@ resolve-from@^2.0.0:resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-2.0.0.tgz#9480ab20e94ffa1d9e80a804c7ea147611966b57"integrity sha1-lICrIOlP+h2egKgEx+oUdhGWa1c=+resolve-from@^4.0.0:+ version "4.0.0"+ resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6"+ integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==+resolve-pkg@^1.0.0:version "1.0.0"resolved "https://registry.yarnpkg.com/resolve-pkg/-/resolve-pkg-1.0.0.tgz#e19a15e78aca2e124461dc92b2e3943ef93494d9"@@ -4538,13 +5105,21 @@ resolve-pkg@^1.0.0:dependencies:resolve-from "^2.0.0"-resolve@^1.10.0, resolve@^1.3.2:+resolve@^1.10.0, resolve@^1.10.1, resolve@^1.12.0, resolve@^1.13.1:version "1.15.0"resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.15.0.tgz#1b7ca96073ebb52e741ffd799f6b39ea462c67f5"integrity sha512-+hTmAldEGE80U2wJJDC1lebb5jWqvTYAfm3YZ1ckk1gBr0MnCqUKlwK1e+anaFljIl+F5tR5IoZcm4ZDA1zMQw==dependencies:path-parse "^1.0.6"+restore-cursor@^3.1.0:+ version "3.1.0"+ resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-3.1.0.tgz#39f67c54b3a7a58cea5236d95cf0034239631f7e"+ integrity sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==+ dependencies:+ onetime "^5.1.0"+ signal-exit "^3.0.2"+retry-as-promised@^3.2.0:version "3.2.0"resolved "https://registry.yarnpkg.com/retry-as-promised/-/retry-as-promised-3.2.0.tgz#769f63d536bec4783549db0777cb56dadd9d8543"@@ -4557,6 +5132,13 @@ [email protected]:resolved "https://registry.yarnpkg.com/revalidator/-/revalidator-0.1.8.tgz#fece61bfa0c1b52a206bd6b18198184bdd523a3b"integrity sha1-/s5hv6DBtSoga9axgZgYS91SOjs=+ version "2.6.3"+ resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab"+ integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==+ dependencies:+ glob "^7.1.3"+[email protected], rimraf@^2.6.1, rimraf@^2.6.3:version "2.7.1"resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec"@@ -4571,6 +5153,13 @@ rimraf@^3.0.0:dependencies:glob "^7.1.3"+run-async@^2.2.0:+ version "2.3.0"+ resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0"+ integrity sha1-A3GrSuC91yDUFm19/aZP96RFpsA=+ dependencies:+ is-promise "^2.1.0"+run-parallel-limit@^1.0.3:version "1.0.5"resolved "https://registry.yarnpkg.com/run-parallel-limit/-/run-parallel-limit-1.0.5.tgz#c29a4fd17b4df358cb52a8a697811a63c984f1b7"@@ -4591,7 +5180,7 @@ rusha@^0.8.1:resolved "https://registry.yarnpkg.com/rusha/-/rusha-0.8.13.tgz#9a084e7b860b17bff3015b92c67a6a336191513a"integrity sha1-mghOe4YLF7/zAVuSxnpqM2GRUTo=-rxjs@^6.5.2:+rxjs@^6.5.2, rxjs@^6.5.3:version "6.5.4"resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.4.tgz#e0777fe0d184cec7872df147f303572d414e211c"integrity sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==@@ -4635,7 +5224,7 @@ semver-diff@^2.0.0:dependencies:semver "^5.0.3"-"semver@2 || 3 || 4 || 5", semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.7.0, semver@^5.7.1:+"semver@2 || 3 || 4 || 5", semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.7.0, semver@^5.7.1:version "5.7.1"resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==@@ -4645,7 +5234,7 @@ [email protected]:resolved "https://registry.yarnpkg.com/semver/-/semver-4.3.2.tgz#c7a07158a80bedd052355b770d82d6640f803be7"integrity sha1-x6BxWKgL7dBSNVt3DYLWZA+AO+c=-semver@^6.3.0:+semver@^6.1.0, semver@^6.1.2, semver@^6.3.0:version "6.3.0"resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==@@ -4838,6 +5427,15 @@ sitemap@^5.0.0:sax "^1.2.4"xmlbuilder "^13.0.2"+slice-ansi@^2.1.0:+ version "2.1.0"+ resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-2.1.0.tgz#cacd7693461a637a5788d92a7dd4fba068e81636"+ integrity sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==+ dependencies:+ ansi-styles "^3.2.0"+ astral-regex "^1.0.0"+ is-fullwidth-code-point "^2.0.0"+version "4.0.2"resolved "https://registry.yarnpkg.com/smtp-connection/-/smtp-connection-4.0.2.tgz#d9dd68d38569f3ad9265473670d09d8f3ea518db"@@ -5230,6 +5828,11 @@ [email protected], strip-json-comments@~2.0.1:resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo=+strip-json-comments@^3.0.1:+ version "3.0.1"+ resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.0.1.tgz#85713975a91fb87bf1b305cca77395e40d2a64a7"+ integrity sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==+superagent@^3.8.3:version "3.8.3"resolved "https://registry.yarnpkg.com/superagent/-/superagent-3.8.3.tgz#460ea0dbdb7d5b11bc4f78deba565f86a178e128"@@ -5310,6 +5913,16 @@ swagger-parser@^8.0.4:swagger-methods "^2.0.1"z-schema "^4.2.2"+table@^5.2.3:+ version "5.4.6"+ resolved "https://registry.yarnpkg.com/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e"+ integrity sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==+ dependencies:+ ajv "^6.10.2"+ lodash "^4.17.14"+ slice-ansi "^2.1.0"+ string-width "^3.0.0"+tar-fs@^2.0.0:version "2.0.0"resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-2.0.0.tgz#677700fc0c8b337a78bee3623fdc235f21d7afad"@@ -5368,6 +5981,11 @@ [email protected]:resolved "https://registry.yarnpkg.com/text-hex/-/text-hex-1.0.0.tgz#69dc9c1b17446ee79a92bf5b884bb4b9127506f5"integrity sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==+text-table@^0.2.0:+ version "0.2.0"+ resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"+ integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=+thirty-two@^1.0.1:version "1.0.2"resolved "https://registry.yarnpkg.com/thirty-two/-/thirty-two-1.0.2.tgz#4ca2fffc02a51290d2744b9e3f557693ca6b627a"@@ -5397,7 +6015,7 @@ through2@^2.0.3:readable-stream "~2.3.6"xtend "~4.0.1"-through@2:+through@2, through@^2.3.6:version "2.3.8"resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=@@ -5420,7 +6038,7 @@ timers-ext@^0.1.5:es5-ext "~0.10.46"next-tick "1"[email protected], tmp@^0.0.33:version "0.0.33"resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9"integrity sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==@@ -5531,59 +6149,12 @@ tsconfig-paths@^3.9.0:minimist "^1.2.0"strip-bom "^3.0.0"- version "1.9.0"- resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8"- integrity sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ==--tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0:+tslib@^1.8.1, tslib@^1.9.0:version "1.10.0"resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a"integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==-tslint-config-standard@^9.0.0:- version "9.0.0"- resolved "https://registry.yarnpkg.com/tslint-config-standard/-/tslint-config-standard-9.0.0.tgz#349a94819d93d5f8d803e3c71cb58ef38eff88e0"- integrity sha512-CAw9J743RnPMemQV/XQ4YyNreC+A1NItACfkm+cBedrOkz6CQfwlnbKn8anUXBfoa4Zo4tjAhblRbsMNcSLfSw==- dependencies:- tslint-eslint-rules "^5.3.1"--tslint-eslint-rules@^5.3.1:- version "5.4.0"- resolved "https://registry.yarnpkg.com/tslint-eslint-rules/-/tslint-eslint-rules-5.4.0.tgz#e488cc9181bf193fe5cd7bfca213a7695f1737b5"- integrity sha512-WlSXE+J2vY/VPgIcqQuijMQiel+UtmXS+4nvK4ZzlDiqBfXse8FAvkNnTcYhnQyOTW5KFM+uRRGXxYhFpuBc6w==- dependencies:- doctrine "0.7.2"- tslib "1.9.0"- tsutils "^3.0.0"--tslint@^6.0.0:- version "6.0.0"- resolved "https://registry.yarnpkg.com/tslint/-/tslint-6.0.0.tgz#1c0148beac4779924216302f192cdaa153618310"- integrity sha512-9nLya8GBtlFmmFMW7oXXwoXS1NkrccqTqAtwXzdPV9e2mqSEvCki6iHL/Fbzi5oqbugshzgGPk7KBb2qNP1DSA==- dependencies:- "@babel/code-frame" "^7.0.0"- builtin-modules "^1.1.1"- chalk "^2.3.0"- commander "^2.12.1"- diff "^4.0.1"- glob "^7.1.1"- js-yaml "^3.13.1"- minimatch "^3.0.4"- mkdirp "^0.5.1"- resolve "^1.3.2"- semver "^5.3.0"- tslib "^1.10.0"- tsutils "^2.29.0"--tsutils@^2.29.0:- version "2.29.0"- resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.29.0.tgz#32b488501467acbedd4b85498673a0812aca0b99"- integrity sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==- dependencies:- tslib "^1.8.1"--tsutils@^3.0.0:+tsutils@^3.17.1:version "3.17.1"resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759"integrity sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==@@ -5607,6 +6178,13 @@ tweetnacl@^0.14.3, tweetnacl@~0.14.0:resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64"integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=+type-check@~0.3.2:+ version "0.3.2"+ resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72"+ integrity sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=+ dependencies:+ prelude-ls "~1.1.2"+version "0.1.1"resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-0.1.1.tgz#0ba5ec2a885640e470ea4e8505971900dac58822"@@ -5617,6 +6195,11 @@ type-detect@^4.0.0, type-detect@^4.0.5:resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c"integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==+type-fest@^0.8.1:+ version "0.8.1"+ resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d"+ integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==+version "1.6.15"resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.15.tgz#cab10fb4909e441c82842eafe1ad646c81804410"@@ -5815,6 +6398,11 @@ uuid@^3.1.0, uuid@^3.3.2, uuid@^3.3.3:resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==+v8-compile-cache@^2.0.3:+ version "2.1.0"+ resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz#e14de37b31a6d194f5690d67efc4e7f6fc6ab30e"+ integrity sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g==+validate-npm-package-license@^3.0.1:version "3.0.4"resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a"@@ -5828,7 +6416,7 @@ validator@^10.11.0:resolved "https://registry.yarnpkg.com/validator/-/validator-10.11.0.tgz#003108ea6e9a9874d31ccc9e5006856ccd76b228"integrity sha512-X/p3UZerAIsbBfN/IwahhYaBbY68EN/UQBWHtsbXGT5bfrH/p4NQzUCG1kF/rtKaNpnJ7jAu6NGTdSNtyNIXMw==-validator@^11.0.0, validator@^11.1.0:+validator@^11.0.0:version "11.1.0"resolved "https://registry.yarnpkg.com/validator/-/validator-11.1.0.tgz#ac18cac42e0aa5902b603d7a5d9b7827e2346ac4"integrity sha512-qiQ5ktdO7CD6C/5/mYV4jku/7qnqzjrxb3C/Q5wR3vGGinHTgJZN/TdFT3ZX4vXhX2R1PXx42fB1cn5W+uJ4lg==@@ -6005,6 +6593,11 @@ wkx@^0.4.8:dependencies:"@types/node" "*"+word-wrap@~1.2.3:+ version "1.2.3"+ resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c"+ integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==+wrap-ansi@^5.1.0:version "5.1.0"resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-5.1.0.tgz#1fd1f67235d5b6d0fee781056001bfb694c03b09"@@ -6037,6 +6630,13 @@ write-file-atomic@^2.0.0:imurmurhash "^0.1.4"signal-exit "^3.0.2"+ version "1.0.3"+ resolved "https://registry.yarnpkg.com/write/-/write-1.0.3.tgz#0800e14523b923a387e415123c865616aae0f5c3"+ integrity sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==+ dependencies:+ mkdirp "^0.5.1"+ws@^7.0.0, ws@^7.1.2:version "7.2.1"resolved "https://registry.yarnpkg.com/ws/-/ws-7.2.1.tgz#03ed52423cd744084b2cf42ed197c8b65a936b8e"@@ -6190,10 +6790,10 @@ [email protected]:resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50"integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==-youtube-dl@^3.0.1:- version "3.0.1"- resolved "https://registry.yarnpkg.com/youtube-dl/-/youtube-dl-3.0.1.tgz#c9a159824ba61c67adcb2e1b3f7b7756ae4042b1"- integrity sha512-QsCf3CnzVPbSoXQPs78L8TIYTk6nCtcm6on3ZkhY02D+OJ3Kcup5cuZepB/TLN6TxAQuhoVK6p0tG2bmTItNVA==+youtube-dl@^3.0.2:+ version "3.0.2"+ resolved "https://registry.yarnpkg.com/youtube-dl/-/youtube-dl-3.0.2.tgz#66236bfbdc93127efe3a7f02894ec544b23e8aa7"+ integrity sha512-LFFfpsYbRLpqKsnb4gzbnyN7fm190tJw3gJVSvfoEfnb/xYIPNT6i9G3jdzPDp/U5cwB3OSq63nUa7rUwxXAGA==dependencies:debug "~4.1.1"execa "~3.2.0"