]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Move to eslint contain
authorChocobozzz <me@florianbigard.com>
Fri, 31 Jan 2020 15:56:52 +0000 (16:56 +0100)
committerChocobozzz <me@florianbigard.com>
Mon, 3 Feb 2020 07:31:02 +0000 (08:31 +0100)
390 files changed:
.eslintrc.json [new file with mode: 0644]
package.json
scripts/ci.sh
scripts/create-import-video-file-job.ts
scripts/create-transcoding-job.ts
server/controllers/activitypub/client.ts
server/controllers/activitypub/inbox.ts
server/controllers/api/accounts.ts
server/controllers/api/config.ts
server/controllers/api/jobs.ts
server/controllers/api/overviews.ts
server/controllers/api/server/debug.ts
server/controllers/api/server/follows.ts
server/controllers/api/server/logs.ts
server/controllers/api/server/redundancy.ts
server/controllers/api/users/me.ts
server/controllers/api/users/my-subscriptions.ts
server/controllers/api/video-channel.ts
server/controllers/api/video-playlist.ts
server/controllers/api/videos/import.ts
server/controllers/api/videos/index.ts
server/controllers/client.ts
server/controllers/static.ts
server/controllers/tracker.ts
server/helpers/activitypub.ts
server/helpers/audit-logger.ts
server/helpers/core-utils.ts
server/helpers/custom-jsonld-signature.ts
server/helpers/custom-validators/activitypub/actor.ts
server/helpers/custom-validators/activitypub/video-comments.ts
server/helpers/custom-validators/misc.ts
server/helpers/custom-validators/plugins.ts
server/helpers/custom-validators/user-notifications.ts
server/helpers/custom-validators/video-abuses.ts
server/helpers/custom-validators/video-captions.ts
server/helpers/custom-validators/video-imports.ts
server/helpers/custom-validators/video-playlists.ts
server/helpers/custom-validators/videos.ts
server/helpers/express-utils.ts
server/helpers/ffmpeg-utils.ts
server/helpers/logger.ts
server/helpers/regexp.ts
server/helpers/register-ts-paths.ts
server/helpers/signup.ts
server/helpers/utils.ts
server/helpers/webtorrent.ts
server/helpers/youtube-dl.ts
server/initializers/checker-after-init.ts
server/initializers/checker-before-init.ts
server/initializers/config.ts
server/initializers/constants.ts
server/initializers/database.ts
server/initializers/migrations/0005-email-pod.ts
server/initializers/migrations/0010-email-user.ts
server/initializers/migrations/0015-video-views.ts
server/initializers/migrations/0020-video-likes.ts
server/initializers/migrations/0025-video-dislikes.ts
server/initializers/migrations/0030-video-category.ts
server/initializers/migrations/0035-video-licence.ts
server/initializers/migrations/0040-video-nsfw.ts
server/initializers/migrations/0045-user-display-nsfw.ts
server/initializers/migrations/0050-video-language.ts
server/initializers/migrations/0055-video-uuid.ts
server/initializers/migrations/0060-video-file.ts
server/initializers/migrations/0065-video-file-size.ts
server/initializers/migrations/0070-user-video-quota.ts
server/initializers/migrations/0075-video-resolutions.ts
server/initializers/migrations/0080-video-channels.ts
server/initializers/migrations/0085-user-role.ts
server/initializers/migrations/0090-videos-description.ts
server/initializers/migrations/0095-videos-privacy.ts
server/initializers/migrations/0100-activitypub.ts
server/initializers/migrations/0105-server-mail.ts
server/initializers/migrations/0110-server-key.ts
server/initializers/migrations/0115-account-avatar.ts
server/initializers/migrations/0120-video-null.ts
server/initializers/migrations/0125-table-lowercase.ts
server/initializers/migrations/0130-user-autoplay-video.ts
server/initializers/migrations/0135-video-channel-actor.ts
server/initializers/migrations/0140-actor-url.ts
server/initializers/migrations/0145-delete-author.ts
server/initializers/migrations/0150-avatar-cascade.ts
server/initializers/migrations/0155-video-comments-enabled.ts
server/initializers/migrations/0160-account-route.ts
server/initializers/migrations/0165-video-route.ts
server/initializers/migrations/0170-actor-follow-score.ts
server/initializers/migrations/0175-actor-follow-counts.ts
server/initializers/migrations/0180-job-table-delete.ts
server/initializers/migrations/0185-video-share-url.ts
server/initializers/migrations/0190-video-comment-unique-url.ts
server/initializers/migrations/0195-support.ts
server/initializers/migrations/0200-video-published-at.ts
server/initializers/migrations/0205-user-nsfw-policy.ts
server/initializers/migrations/0210-video-language.ts
server/initializers/migrations/0215-video-support-length.ts
server/initializers/migrations/0255-video-blacklist-reason.ts
server/initializers/migrations/0285-description-support.ts
server/initializers/migrations/0290-account-video-rate-url.ts
server/initializers/migrations/0295-video-file-extname.ts
server/initializers/migrations/0300-user-videos-history-enabled.ts
server/initializers/migrations/0305-fix-unfederated-videos.ts
server/initializers/migrations/0310-drop-unused-video-indexes.ts
server/initializers/migrations/0315-user-notifications.ts
server/initializers/migrations/0320-blacklist-unfederate.ts
server/initializers/migrations/0325-video-abuse-fields.ts
server/initializers/migrations/0330-video-streaming-playlist.ts
server/initializers/migrations/0335-video-downloading-enabled.ts
server/initializers/migrations/0340-add-originally-published-at.ts
server/initializers/migrations/0345-video-playlists.ts
server/initializers/migrations/0350-video-blacklist-type.ts
server/initializers/migrations/0355-p2p-peer-version.ts
server/initializers/migrations/0360-notification-instance-follower.ts
server/initializers/migrations/0365-user-admin-flags.ts
server/initializers/migrations/0370-thumbnail.ts
server/initializers/migrations/0375-account-description.ts
server/initializers/migrations/0380-cleanup-timestamps.ts
server/initializers/migrations/0385-remove-actor-uuid.ts
server/initializers/migrations/0390-user-pending-email.ts
server/initializers/migrations/0395-user-video-languages.ts
server/initializers/migrations/0400-user-theme.ts
server/initializers/migrations/0405-plugin.ts
server/initializers/migrations/0410-video-playlist-element.ts
server/initializers/migrations/0415-thumbnail-auto-generated.ts
server/initializers/migrations/0420-avatar-lazy.ts
server/initializers/migrations/0425-nullable-actor-fields.ts
server/initializers/migrations/0430-auto-follow-notification-setting.ts
server/initializers/migrations/0435-user-modals.ts
server/initializers/migrations/0440-user-auto-play-next-video.ts
server/initializers/migrations/0445-shared-inbox-optional.ts
server/initializers/migrations/0450-streaming-playlist-files.ts
server/initializers/migrations/0455-soft-delete-video-comments.ts
server/initializers/migrations/0460-user-playlist-autoplay.ts
server/initializers/migrations/0465-thumbnail-file-url-length.ts
server/initializers/migrations/0470-cleaup-indexes.ts
server/initializers/migrations/0475-redundancy-expires-on.ts
server/initializers/migrations/0480-caption-file-url.ts
server/initializers/migrator.ts
server/lib/activitypub/actor.ts
server/lib/activitypub/crawl.ts
server/lib/activitypub/follow.ts
server/lib/activitypub/send/send-accept.ts
server/lib/activitypub/send/send-create.ts
server/lib/activitypub/send/send-dislike.ts
server/lib/activitypub/send/send-flag.ts
server/lib/activitypub/send/send-like.ts
server/lib/activitypub/send/send-reject.ts
server/lib/activitypub/send/send-undo.ts
server/lib/activitypub/send/send-update.ts
server/lib/activitypub/send/utils.ts
server/lib/activitypub/video-comments.ts
server/lib/activitypub/video-rates.ts
server/lib/activitypub/videos.ts
server/lib/client-html.ts
server/lib/emailer.ts
server/lib/files-cache/videos-preview-cache.ts
server/lib/job-queue/handlers/utils/activitypub-http-utils.ts
server/lib/job-queue/handlers/video-file-import.ts
server/lib/job-queue/handlers/video-import.ts
server/lib/job-queue/handlers/video-transcoding.ts
server/lib/job-queue/job-queue.ts
server/lib/moderation.ts
server/lib/notifier.ts
server/lib/plugins/plugin-index.ts
server/lib/plugins/plugin-manager.ts
server/lib/redis.ts
server/lib/schedulers/auto-follow-index-instances.ts
server/lib/schedulers/plugins-check-scheduler.ts
server/lib/schedulers/remove-old-views-scheduler.ts
server/lib/schedulers/videos-redundancy-scheduler.ts
server/lib/thumbnail.ts
server/lib/user.ts
server/lib/video-blacklist.ts
server/lib/video-channel.ts
server/lib/video-comment.ts
server/middlewares/activitypub.ts
server/middlewares/csp.ts
server/middlewares/dnt.ts
server/middlewares/oauth.ts
server/middlewares/sort.ts
server/middlewares/validators/avatar.ts
server/middlewares/validators/config.ts
server/middlewares/validators/feeds.ts
server/middlewares/validators/redundancy.ts
server/middlewares/validators/users.ts
server/middlewares/validators/videos/video-captions.ts
server/middlewares/validators/videos/video-comments.ts
server/middlewares/validators/videos/video-imports.ts
server/middlewares/validators/videos/video-playlists.ts
server/middlewares/validators/videos/video-rates.ts
server/middlewares/validators/videos/videos.ts
server/models/account/account-video-rate.ts
server/models/account/account.ts
server/models/account/user-notification.ts
server/models/account/user.ts
server/models/activitypub/actor-follow.ts
server/models/activitypub/actor.ts
server/models/oauth/oauth-token.ts
server/models/redundancy/video-redundancy.ts
server/models/server/plugin.ts
server/models/utils.ts
server/models/video/thumbnail.ts
server/models/video/video-abuse.ts
server/models/video/video-caption.ts
server/models/video/video-channel.ts
server/models/video/video-comment.ts
server/models/video/video-format-utils.ts
server/models/video/video-playlist-element.ts
server/models/video/video-playlist.ts
server/models/video/video.ts
server/tests/api/activitypub/client.ts
server/tests/api/activitypub/fetch.ts
server/tests/api/activitypub/helpers.ts
server/tests/api/activitypub/refresher.ts
server/tests/api/activitypub/security.ts
server/tests/api/check-params/accounts.ts
server/tests/api/check-params/blocklist.ts
server/tests/api/check-params/config.ts
server/tests/api/check-params/contact-form.ts
server/tests/api/check-params/debug.ts
server/tests/api/check-params/follows.ts
server/tests/api/check-params/jobs.ts
server/tests/api/check-params/logs.ts
server/tests/api/check-params/plugins.ts
server/tests/api/check-params/redundancy.ts
server/tests/api/check-params/search.ts
server/tests/api/check-params/services.ts
server/tests/api/check-params/user-notifications.ts
server/tests/api/check-params/user-subscriptions.ts
server/tests/api/check-params/users.ts
server/tests/api/check-params/video-abuses.ts
server/tests/api/check-params/video-blacklist.ts
server/tests/api/check-params/video-captions.ts
server/tests/api/check-params/video-channels.ts
server/tests/api/check-params/video-comments.ts
server/tests/api/check-params/video-imports.ts
server/tests/api/check-params/video-playlists.ts
server/tests/api/check-params/videos-filter.ts
server/tests/api/check-params/videos-history.ts
server/tests/api/check-params/videos.ts
server/tests/api/notifications/user-notifications.ts
server/tests/api/redundancy/manage-redundancy.ts
server/tests/api/redundancy/redundancy.ts
server/tests/api/search/search-activitypub-video-channels.ts
server/tests/api/search/search-activitypub-videos.ts
server/tests/api/search/search-videos.ts
server/tests/api/server/auto-follows.ts
server/tests/api/server/config.ts
server/tests/api/server/contact-form.ts
server/tests/api/server/email.ts
server/tests/api/server/follow-constraints.ts
server/tests/api/server/follows-moderation.ts
server/tests/api/server/follows.ts
server/tests/api/server/handle-down.ts
server/tests/api/server/jobs.ts
server/tests/api/server/logs.ts
server/tests/api/server/no-client.ts
server/tests/api/server/plugins.ts
server/tests/api/server/reverse-proxy.ts
server/tests/api/server/stats.ts
server/tests/api/server/tracker.ts
server/tests/api/users/blocklist.ts
server/tests/api/users/user-subscriptions.ts
server/tests/api/users/users-multiple-servers.ts
server/tests/api/users/users-verification.ts
server/tests/api/users/users.ts
server/tests/api/videos/audio-only.ts
server/tests/api/videos/multiple-servers.ts
server/tests/api/videos/services.ts
server/tests/api/videos/single-server.ts
server/tests/api/videos/video-abuse.ts
server/tests/api/videos/video-blacklist.ts
server/tests/api/videos/video-captions.ts
server/tests/api/videos/video-change-ownership.ts
server/tests/api/videos/video-channels.ts
server/tests/api/videos/video-comments.ts
server/tests/api/videos/video-description.ts
server/tests/api/videos/video-hls.ts
server/tests/api/videos/video-imports.ts
server/tests/api/videos/video-nsfw.ts
server/tests/api/videos/video-playlist-thumbnails.ts
server/tests/api/videos/video-playlists.ts
server/tests/api/videos/video-privacy.ts
server/tests/api/videos/video-schedule-update.ts
server/tests/api/videos/video-transcoder.ts
server/tests/api/videos/videos-filter.ts
server/tests/api/videos/videos-history.ts
server/tests/api/videos/videos-overview.ts
server/tests/api/videos/videos-views-cleaner.ts
server/tests/cli/create-import-video-file-job.ts
server/tests/cli/create-transcoding-job.ts
server/tests/cli/optimize-old-videos.ts
server/tests/cli/peertube.ts
server/tests/cli/plugins.ts
server/tests/cli/prune-storage.ts
server/tests/cli/update-host.ts
server/tests/client.ts
server/tests/feeds/feeds.ts
server/tests/helpers/comment-model.ts
server/tests/helpers/core-utils.ts
server/tests/helpers/request.ts
server/tests/misc-endpoints.ts
server/tests/plugins/action-hooks.ts
server/tests/plugins/filter-hooks.ts
server/tests/plugins/translations.ts
server/tests/plugins/video-constants.ts
server/tests/real-world/populate-database.ts [deleted file]
server/tests/real-world/real-world.ts [deleted file]
server/tools/cli.ts
server/tools/peertube-auth.ts
server/tools/peertube-import-videos.ts
server/tools/peertube-plugins.ts
server/tools/peertube-redundancy.ts
server/tools/peertube-repl.ts
server/tools/peertube-upload.ts
server/tools/peertube-watch.ts
server/tools/peertube.ts
server/typings/models/account/account-blocklist.ts
server/typings/models/account/account.ts
server/typings/models/account/actor-follow.ts
server/typings/models/account/actor.ts
server/typings/models/account/avatar.ts
server/typings/models/oauth/oauth-token.ts
server/typings/models/server/plugin.ts
server/typings/models/server/server-blocklist.ts
server/typings/models/server/server.ts
server/typings/models/user/user-notification.ts
server/typings/models/user/user.ts
server/typings/models/video/schedule-video-update.ts
server/typings/models/video/video-abuse.ts
server/typings/models/video/video-blacklist.ts
server/typings/models/video/video-caption.ts
server/typings/models/video/video-change-ownership.ts
server/typings/models/video/video-channels.ts
server/typings/models/video/video-comment.ts
server/typings/models/video/video-file.ts
server/typings/models/video/video-import.ts
server/typings/models/video/video-playlist-element.ts
server/typings/models/video/video-playlist.ts
server/typings/models/video/video-rate.ts
server/typings/models/video/video-redundancy.ts
server/typings/models/video/video-share.ts
server/typings/models/video/video-streaming-playlist.ts
server/typings/models/video/video.ts
server/typings/utils.ts
shared/core-utils/miscs/miscs.ts
shared/extra-utils/instances-index/mock-instances-index.ts
shared/extra-utils/miscs/miscs.ts
shared/extra-utils/miscs/sql.ts
shared/extra-utils/requests/requests.ts
shared/extra-utils/search/videos.ts
shared/extra-utils/server/clients.ts
shared/extra-utils/server/contact-form.ts
shared/extra-utils/server/follows.ts
shared/extra-utils/server/jobs.ts
shared/extra-utils/server/plugins.ts
shared/extra-utils/server/redundancy.ts
shared/extra-utils/server/servers.ts
shared/extra-utils/users/accounts.ts
shared/extra-utils/users/blocklist.ts
shared/extra-utils/users/login.ts
shared/extra-utils/users/user-notifications.ts
shared/extra-utils/users/users.ts
shared/extra-utils/videos/video-blacklist.ts
shared/extra-utils/videos/video-captions.ts
shared/extra-utils/videos/video-channels.ts
shared/extra-utils/videos/video-comments.ts
shared/extra-utils/videos/video-imports.ts
shared/extra-utils/videos/video-playlists.ts
shared/extra-utils/videos/video-streaming-playlists.ts
shared/extra-utils/videos/videos.ts
shared/models/activitypub/activity.ts
shared/models/activitypub/activitypub-actor.ts
shared/models/activitypub/activitypub-signature.ts
shared/models/activitypub/objects/cache-file-object.ts
shared/models/activitypub/objects/common-objects.ts
shared/models/activitypub/objects/video-abuse-object.ts
shared/models/activitypub/objects/video-torrent-object.ts
shared/models/activitypub/objects/view-object.ts
shared/models/i18n/i18n.ts
shared/models/nodeinfo/index.d.ts
shared/models/plugins/peertube-plugin-latest-version.model.ts
shared/models/plugins/plugin-package-json.model.ts
shared/models/plugins/server-hook.model.ts
shared/models/redundancy/video-redundancy.model.ts
shared/models/server/custom-config.model.ts
shared/models/server/job.model.ts
shared/models/server/server-config.model.ts
shared/models/users/user.model.ts
tslint.json [deleted file]
yarn.lock

diff --git a/.eslintrc.json b/.eslintrc.json
new file mode 100644 (file)
index 0000000..a86c5bb
--- /dev/null
@@ -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"
+    ]
+  }
+}
index a766f8d81d8a2f6335354976309434830d59f010..0a5484d2a6c4aa74e3a7c83e993a229e72d08c11 100644 (file)
@@ -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",
     "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",
     "@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",
     "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": {
index 4063a62418b63be5db1702b71a3bd70b7ef82613..aea009d9f48a795905006159b31d50326cee60da 100755 (executable)
@@ -35,7 +35,7 @@ elif [ "$1" = "api-4" ]; then
     npm run build:server
     sh ./server/tests/api/ci-4.sh 2
 elif [ "$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 client
index 204337d551fccf1c14325c56b5382415093aea3d..37738ca40c896b08448ab30417304c72ede0213e 100644 (file)
@@ -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)
 }
index 27170299d657e76a94d9254d6dd9ec1b81c98498..fec58da2ee667007c2388af7d275a293011c8911 100755 (executable)
@@ -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)
   }
 }
index 95c2a26a68ef61ee8f79810a3858fd5fa7fa5b73..39f6d7231a90f89151026da46a3b24e28db1e10b 100644 (file)
@@ -122,7 +122,7 @@ activityPubClientRouter.get('/videos/watch/:videoId/comments/:commentId/activity
 activityPubClientRouter.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.Respo
   return 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.videoChannel
 
   return activityPubResponse(activityPubContextify(videoChannel.toActivityPubObject()), res)
@@ -353,7 +353,7 @@ async function videoPlaylistController (req: express.Request, res: express.Respo
   return 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.videoPlaylistElementAP
 
   const json = videoPlaylistElement.toActivityPubObject()
index 4fb180003a890e280c6ae16740d02817108b776a..3b8fb34a844aaf1ae443d71924e7fe8499c3c488 100644 (file)
@@ -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) {
index 05740318efe046d40f26f0bda41dca059b747cf7..f354ccf24e6540b28383015dda1a9c0148a3d81d 100644 (file)
@@ -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())
index ae4e0024896292f6e8c33c1810e2abdb83ff4810..69940f3952f6c3eb1f47e5bb8f63b4682f23e759 100644 (file)
@@ -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.ENABLED
index 05320311e98e00e21ebd4e52689496c31bf7db06..13fc04d187a2a20fa1d8d11f4dc63f4123fcb5ea 100644 (file)
@@ -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))
   }
index 46e76ac6b87e5b1f55dbe64dffecde87a5623eb9..75f3baedbd0f4c83ba71027c28c6267b16ce23bc 100644 (file)
@@ -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_THRESHOLDOVERVIEWS.VIDEOS.SAMPLES_COUNT),
     TagModel.getRandomSamples(OVERVIEWS.VIDEOS.SAMPLE_THRESHOLD, OVERVIEWS.VIDEOS.SAMPLES_COUNT)
   ])
 
index 4450038f6a71467615a041a1ecc9f2541957cff4..e12fc1dd43e5eba1162a1ce33dc4a4bbf6228d4a 100644 (file)
@@ -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()
index c69de21fbfd3b33dbfe238180aca6a258668847a..0bc20bd605fecd774a50641393e5ef317348f1d6 100644 (file)
@@ -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()
index cd1e0f5bf0eb7ca51560697ffec30310bae6d893..4b543d686e45512bf2fdec2ceff03ccd1d594795 100644 (file)
@@ -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: LogLevel
   nameFilter: 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: any
 
     try {
@@ -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.length
index a11c1a74fc58ed22652c0e8ea0806725d042b3ee..1ced0759e9d0a2d4558f415b5ae22621a07a3993 100644 (file)
@@ -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
   })
index ac7c62aab772ef1b63c9a8e130152d89f29c5467..23890e20ce72c5e5e3c8ce664433ecf1704ec326 100644 (file)
@@ -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.user
 
   const userAccount = await AccountModel.load(user.Account.id)
index 43c4c37d84b1ae08f8bdc6da21928268dd6809e2..888392b8b3bde4a9b6bcd9faf8f8efea17967bb4 100644 (file)
@@ -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.Respons
   return 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.User
   const [ 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()
 }
index e1f37a8fb7a3213290e6a5c72b210c9a407d7c33..a808896ffd0053a1eef373a4e19f95b6eede129a 100644 (file)
@@ -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.videoChannel
   const 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())
index d9f0ff9257bac20327269d5cad5e68c1982ef35f..b51490bf914f599c301c1796dfc89f3e25938158 100644 (file)
@@ -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())
index 28ced58368b2939f0957d09cb0f69f0723793646..ed223cbc906edf7e5705770db3ea692f0f1377d9 100644 (file)
@@ -88,12 +88,12 @@ async function addTorrentImport (req: express.Request, res: express.Response, to
     const 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.magnetUri
 
     const 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, to
     videoImportId: 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: You
 async function processThumbnail (req: express.Request, video: VideoModel) {
   const thumbnailField = req.files ? req.files['thumbnailfile'] : undefined
   if (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 } = parameters
index a593f707663675bb14fe50cbd70dc0d50ca5f7d1..1d61f84278e794f7de67164db5d6d2f23ee558d0 100644 (file)
@@ -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())
index dc3ff18fc7e6f1cd8b7a721eff48776f696977c5..e4643e1711dc68a92b9b2c9158e2ca74536ebf00 100644 (file)
@@ -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.locale
   const file = req.params.file
 
index a4bb3a4d96b38a281dc29ee18f2ec91977e09f5e..4c6cf9597174b22558f3940faaa998790c3dc06b 100644 (file)
@@ -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.videoAll
 
   const 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.videoAll
 
   const playlist = getHLSPlaylist(video)
@@ -346,7 +346,7 @@ async function downloadHLSVideoFileTorrent (req: express.Request, res: express.R
   return 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.videoAll
 
   const 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.videoAll
   const playlist = getHLSPlaylist(video)
   if (!playlist) return res.status(404).end
index 2ae1cf86c5d979225929685b5a65c81c980413af..e9c8a13da22dc1848b3b34b5a4d854bd961bbf05 100644 (file)
@@ -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))
     }
 
index 9f9e8fba79fe2b31d9e64af34c865e454d6df99b..22f8550caf37a4a343d736e0eada920e82d3c611 100644 (file)
@@ -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).host
 
   return idHost && actorHost && idHost.toLowerCase() === actorHost.toLowerCase()
 }
index 9b258dc3ae86bca21c848953e27566ceeb5452a9..a4cfeef76c11cb0e0a50e48c29056f6ece7746a4 100644 (file)
@@ -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 = customConfig
     const resolutionsDict = infos.transcoding.resolutions
     const 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)
   }
index 7e8252aa40f3db496d367303335ad9ab39b94f63..2cecea4500bc1d64c41693a72064f89c5a920ded 100644 (file)
@@ -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, va
   const 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 duration
 
   if (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) {
     '=': '&#x3D;'
   }
 
-  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-errors
       if (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,
index a407a9fec1f0eb41771a20e430dc0ba1edf2f9ef..749c50cb3d5c6f5de154964948d56596f493246d 100644 (file)
@@ -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
       })
     }
index fa58e163f7b7d19880dfc37fbeba4775e4c90705..fec67823d721b273c9d814f4e4a8d87d293bcac1 100644 (file)
@@ -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) {
index aa3c246b5f69ccbcdb24f094873b3e15f06010e7..ea852c4910a3ab43e9a0dce75ae9425bcb1eef97 100644 (file)
@@ -48,8 +48,6 @@ function normalizeComment (comment: any) {
     if (typeof comment.url === 'object') comment.url = comment.url.href || comment.url.url
     else comment.url = comment.id
   }
-
-  return
 }
 
 function isCommentTypeValid (comment: any): boolean {
index 89149b3e0a0cf91af9d589e0350aec2ddd7436d3..cf32201c411a6532e6c002c88282b699657ddee7 100644 (file)
@@ -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 size
index 3af72547b349630eaa7ecc72aba836344dcc61bc..5a4531f72ebdea684bdddcb105276d2c0497639f 100644 (file)
@@ -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 {
index 5a4d10504e6c0812c2f33e0ac00953fbbf0d4f07..8a33b895bc0508ea3cb7953d38360e50f8981516 100644 (file)
@@ -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 ||
index a9478c76acf24fa6e6bcf75a24eaebc7bcaf2a06..5c7bc6fd93d771b2b4d0fad191f4cb2fae8ef1dd 100644 (file)
@@ -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
 }
 
 // ---------------------------------------------------------------------------
index d06eb3695216295d3239d49a53d2070b4c7c2059..9abbce04a110b3e7fae1b1fb5429ae6303b808df 100644 (file)
@@ -2,7 +2,7 @@ import { CONSTRAINTS_FIELDS, MIMETYPES, VIDEO_LANGUAGES } from '../../initialize
 import { 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)
index ffad482b47fb5236e3627b7881971b1382c018ae..c571f5dddccfb701dddd78ae899a8bc4e0873033 100644 (file)
@@ -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})`)
index 4bb8384ab1903a2bc2516ace6020dd90587a2f99..180018fc54d68a9849f7e6caf080654204afd6e6 100644 (file)
@@ -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
 }
 
 // ---------------------------------------------------------------------------
index a9e859e54a000a3304533b0c2492fd4b529bb92b..cfb430c638485034a23dd0bdf1a2a4989a65ebac 100644 (file)
@@ -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) {
index 9bf6d85a87a21f76338090a551cabb425e4dd463..f4681297742f2cd36aee3a34c6420bc17596451d 100644 (file)
@@ -12,7 +12,7 @@ function buildNSFWFilter (res?: express.Response, paramNSFW?: string) {
   if (paramNSFW === 'false') return false
   if (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.files
 
   if (!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: string
       const 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,
index 7022d3e037d23e274ab6b025cc1aab3df7d158f8..084516e553fd1a0395f24ced3ae8340e3fdcd622 100644 (file)
@@ -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_string
 
   const 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 0
 
   for (const key of [ 'avg_frame_rate', 'r_frame_rate' ]) {
-    const valuesText: string = videoStream[ key ]
+    const valuesText: string = videoStream[key]
     if (!valuesText) continue
 
     const [ 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 params
   if (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 false
   if (fps < VIDEO_TRANSCODING_FPS.MIN || fps > VIDEO_TRANSCODING_FPS.MAX) return false
   if (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: M
   return 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 end
     localCommand = 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, resolut
   return 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')
index fd2988ad0badd08a7695b1011b58d27c2377ce39..b8ae28b3f12235d69b2d8c26430fcfb0f09bb6ca 100644 (file)
@@ -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'),
index 2336654b0d3ee73421593ad9a9d5083e60df7c35..cfc2be4882523e7c5dbd20c56903801a059b0df6 100644 (file)
@@ -1,8 +1,8 @@
 // Thanks to https://regex101.com
 function regexpCapture (str: string, regex: RegExp, maxIterations = 100) {
+  const result: RegExpExecArray[] = []
   let m: RegExpExecArray
   let i = 0
-  let result: RegExpExecArray[] = []
 
   // tslint:disable:no-conditional-assignment
   while ((m = regex.exec(str)) !== null && i < maxIterations) {
index e8db369e331b037d3941051954a364d3d9986f66..eec7fed3ef10ec844827dbf6affe09e38a5c2929 100644 (file)
@@ -1,5 +1,5 @@
 import { resolve } from 'path'
-const tsConfigPaths = require('tsconfig-paths')
+import tsConfigPaths = require('tsconfig-paths')
 
 const tsConfig = require('../../tsconfig.json')
 
index 7c73f7c5c02efcd8358a13bcef70a670e6c80baa..d34ff2db5e30287889804dd224e0be5f32343de1 100644 (file)
@@ -21,7 +21,7 @@ async function isSignupAllowed (): Promise<{ allowed: boolean, errorMessage?: st
 
 function 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 too
index 4c6f200f86f91f07a2f18b9e37a3b2a1ab67a137..7a4c781ccb8780f4ab6d51b693b945e620348721 100644 (file)
@@ -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')
 }
index 8a5d030dfde8b8ccabd032e225eb6524fb07f951..b25e44fcd512bf8cc4aec3191bf8eedff20ceb62 100644 (file)
@@ -39,7 +39,7 @@ async function downloadWebTorrentVideo (target: { magnetUri: string, torrentName
       if (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 fixed
       const 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, torrentName
 
     torrent.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)
   })
 }
index 577a59dbf4f69e69c86dea675e1c1a2453f18893..fc9d416a179cd9f9ba92bab7523ac2a062f4bf59 100644 (file)
@@ -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.location
       const 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) {
index 44efd346ccb9187efd4dceb82b676a167f023adc..97802312933e804a0894a7b903ed2bfe2bba03b4 100644 (file)
@@ -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')
index 9731a0af9da11762eb7da5e25e1962d65deeb9e0..a75f2cec2a82e43666d818f53cba3557db5d3b3c 100644 (file)
@@ -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[] = []
index fd8bf09fc489b5d15fd8cec5d705b9a5cf6be614..75372fa4eaa7f4208957fcbec510b443ad4cd708 100644 (file)
@@ -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
       }
 
index 3a9946bbad3f8ab23348d326e2fe5eb11758b323..fb8ae7cd66cdfe1aa18c083bf7fe12a56bb71312 100644 (file)
@@ -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 hour
 
 const 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 = 5000
   SCHEDULER_INTERVALS_MS.updateVideos = 5000
   SCHEDULER_INTERVALS_MS.autoFollowIndexInstances = 5000
-  REPEAT_JOBS[ 'videos-views' ] = { every: 5000 }
+  REPEAT_JOBS['videos-views'] = { every: 5000 }
 
   REDUNDANCY.VIDEOS.RANDOMIZED_FACTOR = 1
 
   VIDEO_VIEW_LIFETIME = 1000 // 1 second
   CONTACT_FORM_LIFETIME = 1000 // 1 second
 
-  JOB_ATTEMPTS[ 'email' ] = 1
+  JOB_ATTEMPTS['email'] = 1
 
   FILES_CACHE.VIDEO_CAPTIONS.MAX_AGE = 3000
   MEMOIZE_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
 }
index 9ec146ab18c7c0d543ec7e43c69880caf2a38dda..eedaf3c4eef1fa4123c3bc0c0ea9b34c68c0e623 100644 (file)
@@ -119,8 +119,6 @@ async function initDatabaseModels (silent: boolean) {
   await createFunctions()
 
   if (!silent) logger.info('Database %s is ready.', dbname)
-
-  return
 }
 
 // ---------------------------------------------------------------------------
index c34a122559898c25f8da2b3cd5f1b6322f2d822a..417c33b1f762eacc5e804b2885efc2b77c1f126a 100644 (file)
@@ -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.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
   const q = utils.queryInterface
index 37a7b0bb34750880a0645d3298ff36839883e5e9..f7d01f6d67905c76b5f31a6097ff84a6cbebccbf 100644 (file)
@@ -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.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
   const q = utils.queryInterface
index 25164ff4d55c5827eb475ff56634741d54b60ad9..47dd4069bfef3356961b677811aec050d8328754 100644 (file)
@@ -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.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
   const q = utils.queryInterface
index 945be5a98d1ff1f1259c24976104eab9fcb0b28f..44333f3b04ac3d720269801dd63e3a5dcbe97ffa 100644 (file)
@@ -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.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
   const q = utils.queryInterface
index 27144c4373b21c800a42f10638cb4c7547de3841..2aa22e2d7d7c62edd68effee1da7c96ae770c897 100644 (file)
@@ -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.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
   const q = utils.queryInterface
index f784f820da8e09362da2e87f699e8687483f4264..00cd2d8cf0cc100cb3c2bfeb2f9e3c38cc864a03 100644 (file)
@@ -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.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
   const q = utils.queryInterface
index 3d0b0bac98318fc3c3911484491237d4259e09ce..61d666c5eb8da676ce860ef6d6a10a778e3bd0ef 100644 (file)
@@ -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.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
   const q = utils.queryInterface
index f7f70d3c4b4bea26b4d5fd8a54d84f3dd2c77acd..44aec8a6c3f0b10fa70eab7d4a81041cfbfcfde8 100644 (file)
@@ -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.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
   const q = utils.queryInterface
index aef420f0e40a9d79d1e53ef6a5a4cac5add6f514..07795bd75e5ef07b7c00b76915eb9e7b3a62eb9a 100644 (file)
@@ -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.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
   const q = utils.queryInterface
index 796fa5f9597d8738eedaedfb3438217077bcd016..6f90abb44f64cadfed87170d2b2fac2bf5587add 100644 (file)
@@ -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.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
   const q = utils.queryInterface
index e0f90408076ff964b5ea760f962ff0659fbc6a9f..8a58aebb838db4f607182811dc92a58f298e49e8 100644 (file)
@@ -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.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
   const q = utils.queryInterface
index c362cf71aa2582721637bf69cb0872ad1ec4b3c7..00647e60e458abb5e5fcb79e37368344cf061ccf 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   const q = utils.queryInterface
index e9ce77e5072101b33bfc61b933f8461ea2ead428..0bdc675c21e5cb5b940e19d474a998a7fb1d970b 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   return utils.db.Video.listOwnedAndPopulateAuthorAndTags()
index 37683432f8f5ef673e7c1b1b32ba165e3da88c6f..1d073f244c43d82a4f8d65e59f66806922e9d84f 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   const q = utils.queryInterface
index e4f26cb779748db0fe6dc42738e895f2614af2d8..f56c1b2c30c1d8775d69b4c780c9313bd17313f6 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   const torrentDir = CONFIG.STORAGE.TORRENTS_DIR
index 5512bdcf1593a739ddd4d6b9e1e994fba337aecb..b8e9bd6d06c803e955932a65bcafae265c09e1a6 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   const q = utils.queryInterface
index de75faec2933fd3b3b0d63ffc653943fee0b82c7..ec7428fd5127cb02b030a49e47f8f438831240cb 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   const q = utils.queryInterface
index 6f98dcade483295681baedffaf237a30ec315685..32e518d75d2bd0d68512e7acc5456bfcd429e2ac 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   const q = utils.queryInterface
index 4c2bf91d0e3ec188007a35bf12889f45f5dfdb5b..c732d6f6a01023a13ebf67d6071d72924b95be0e 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   const q = utils.queryInterface
index 96d44a7cee1aca65e9972180dd507575aa0461bd..05fd37406874a4c2eb0d85969631ee53d2810e95 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   const q = utils.queryInterface
index 4b9600e916eb10a92f848b5f9dd71ce6ffbb13e8..5ee37c418a5df8aed334b3cfc2300b2293a0425c 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   await utils.queryInterface.removeColumn('Servers', 'email')
index 5ff6daf694adb125853aa07dc41da44412ebb096..354cd7e765416572a04c82e37f9d1fc7d3bbcd6c 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   await utils.queryInterface.removeColumn('Servers', 'publicKey')
index b318e8163cce895eeb57ee73d4c49241adbb7e4d..604b6394af864be405ea09271cf2a73a1be2971d 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   await utils.db.Avatar.sync()
index 6d253f04f7c177f0f3e5937f37caa538934020a3..1b407b270a70b86cad80d361dab7acf9c0258abe 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
 
index 78041ccb0c7bb45491d01171bfc68bbe3f262e41..f75a5679198bba24ff94a4b6cfcfbbc497dc8787 100644 (file)
@@ -1,8 +1,8 @@
 import * as Sequelize from 'sequelize'
 
 async function up (utils: {
-  transaction: Sequelize.Transaction,
-  queryInterface: Sequelize.QueryInterface,
+  transaction: Sequelize.Transaction
+  queryInterface: Sequelize.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
   await utils.queryInterface.renameTable('Applications', 'application')
index 9f6878e391baa2cc2ab5e8285bab3cf325b4d9f9..d57934588c8814675902687767b5389fe0dfa465 100644 (file)
@@ -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.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
   const q = utils.queryInterface
index 5ace0f4d27dcdc3e8126ad122005abe333759bab..c0c343384b61b384d1af6b902cbe51b487a7e514 100644 (file)
@@ -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.QueryInterface
   sequelize: 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 account
         WHERE "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 account
         WHERE "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)
 
index 02049939128ac4f4e8211b2d07fef8c0f86896e0..d790988adc92e7f76432d51afca98af52e3bea98 100644 (file)
@@ -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.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
   const toReplace = WEBSERVER.HOSTNAME + ':443'
index cb23d1cc2d4179605ba7bb008b9db6a48f5823e4..6c9427997b0e9fdbbfbf81d4a23a9c90a432a7cc 100644 (file)
@@ -1,8 +1,8 @@
 import * as Sequelize from 'sequelize'
 
 async function up (utils: {
-  transaction: Sequelize.Transaction,
-  queryInterface: Sequelize.QueryInterface,
+  transaction: Sequelize.Transaction
+  queryInterface: Sequelize.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
   await utils.queryInterface.dropTable('Authors')
index 82169671735929efeb837ee9217c585a39710140..fb3b25773839268cefdaf1d8bbb60a9cd750d517 100644 (file)
@@ -1,8 +1,8 @@
 import * as Sequelize from 'sequelize'
 
 async function up (utils: {
-  transaction: Sequelize.Transaction,
-  queryInterface: Sequelize.QueryInterface,
+  transaction: Sequelize.Transaction
+  queryInterface: Sequelize.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
   await utils.queryInterface.removeConstraint('actor', 'actor_avatarId_fkey')
index 6949d3a0c2974880ccc38e93fa080155e1bc2647..691640b35529aff56a6c5feb858e4f77e4ff8aef 100644 (file)
@@ -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.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
   const data = {
index cab4c72f1570b07fafadd716d7e77d3faa980776..97469948b8eae102d363df081d1125c338f357d9 100644 (file)
@@ -1,8 +1,8 @@
 import * as Sequelize from 'sequelize'
 
 async function up (utils: {
-  transaction: Sequelize.Transaction,
-  queryInterface: Sequelize.QueryInterface,
+  transaction: Sequelize.Transaction
+  queryInterface: Sequelize.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
   {
index 56d98bc690971372ab1b366e973176745704496a..aa7c751285347b2ffa799daac0d702352eb0d039 100644 (file)
@@ -1,8 +1,8 @@
 import * as Sequelize from 'sequelize'
 
 async function up (utils: {
-  transaction: Sequelize.Transaction,
-  queryInterface: Sequelize.QueryInterface,
+  transaction: Sequelize.Transaction
+  queryInterface: Sequelize.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
   {
index a12b35da9dde5e4677da8b0c2f243191479fd2b2..901a3c7997beb6f4ca8b16d6a065001ba482c018 100644 (file)
@@ -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.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
   await utils.queryInterface.removeColumn('server', 'score')
index 4fb5241815de4806b45f00c30e57128b91917968..d7853f8dc1522aff23c58c1be1718476fd8c38bd 100644 (file)
@@ -1,8 +1,8 @@
 import * as Sequelize from 'sequelize'
 
 async function up (utils: {
-  transaction: Sequelize.Transaction,
-  queryInterface: Sequelize.QueryInterface,
+  transaction: Sequelize.Transaction
+  queryInterface: Sequelize.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
   const query = 'UPDATE "actor" SET ' +
index df29145d04d07b39b76d0f50347e42e2d3b191bb..fb48a0c9d41740950c357ce91616000cc5c078b6 100644 (file)
@@ -1,8 +1,8 @@
 import * as Sequelize from 'sequelize'
 
 async function up (utils: {
-  transaction: Sequelize.Transaction,
-  queryInterface: Sequelize.QueryInterface,
+  transaction: Sequelize.Transaction
+  queryInterface: Sequelize.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
   await utils.queryInterface.dropTable('job')
index f7eeb0878684c9f819c8de46d0ddcc9afa31ab86..f59931e0f3db6930409e8855d68c3e5dc9043e2d 100644 (file)
@@ -1,8 +1,8 @@
 import * as Sequelize from 'sequelize'
 
 async function up (utils: {
-  transaction: Sequelize.Transaction,
-  queryInterface: Sequelize.QueryInterface,
+  transaction: Sequelize.Transaction
+  queryInterface: Sequelize.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
   {
index b196c93529074cd55aacf5852ed15304fd56ae30..a8769ed415e3c5e8c2e54316fe780ab9af23ee4a 100644 (file)
@@ -1,8 +1,8 @@
 import * as Sequelize from 'sequelize'
 
 async function up (utils: {
-  transaction: Sequelize.Transaction,
-  queryInterface: Sequelize.QueryInterface,
+  transaction: Sequelize.Transaction
+  queryInterface: Sequelize.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
   {
index 3b9eabe79376a9408d1c429a341a05404c3d56c8..3f7c75dce9c58028740ce6329feb4f8ba5419362 100644 (file)
@@ -1,8 +1,8 @@
 import * as Sequelize from 'sequelize'
 
 async function up (utils: {
-  transaction: Sequelize.Transaction,
-  queryInterface: Sequelize.QueryInterface,
+  transaction: Sequelize.Transaction
+  queryInterface: Sequelize.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
   {
index 1701ea07a669152f62c2dd57d7bd71715b9da7d6..d8c7b42a767176cfbb98bea3b7be774d905cedd0 100644 (file)
@@ -1,8 +1,8 @@
 import * as Sequelize from 'sequelize'
 
 async function up (utils: {
-  transaction: Sequelize.Transaction,
-  queryInterface: Sequelize.QueryInterface,
+  transaction: Sequelize.Transaction
+  queryInterface: Sequelize.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
 
index d0f6e8962ffac6af5bc022e2b4a8d63ed05defc9..9c2786f1202b23b8996d3f0326688f0f6c8f7a69 100644 (file)
@@ -1,8 +1,8 @@
 import * as Sequelize from 'sequelize'
 
 async function up (utils: {
-  transaction: Sequelize.Transaction,
-  queryInterface: Sequelize.QueryInterface,
+  transaction: Sequelize.Transaction
+  queryInterface: Sequelize.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
 
index ca95c7527423470346c3a9eb2045998e82974dd1..ee4ce926628a31bcd2b977f8a816116623ec6f89 100644 (file)
@@ -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.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
 
index ba395050f6b9b77f7de2c6a28cef862d99e04e21..26c0ca70071812ce68ac40effb91edd14cb9928e 100644 (file)
@@ -1,8 +1,8 @@
 import * as Sequelize from 'sequelize'
 
 async function up (utils: {
-  transaction: Sequelize.Transaction,
-  queryInterface: Sequelize.QueryInterface,
+  transaction: Sequelize.Transaction
+  queryInterface: Sequelize.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
   {
index 69d6efb9ea4d4b2cf19c460b9a9fde1f77e0730b..7de982f9341a9d8dfd4f16690707e75c9e606f2b 100644 (file)
@@ -1,5 +1,4 @@
 import * as Sequelize from 'sequelize'
-import { VideoAbuseState } from '../../../shared/models/videos'
 
 async function up (utils: {
   transaction: Sequelize.Transaction
index 85ef4ef39b418574402b6b4cc63f82c7c388554b..aab3a938f0cd5874e08192fef33b6b24faecd27f 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   {
index bdabf2929b3557c7841b14cba6d67a2a0bcd8584..b974b1a81995373d3b35b8e4be0228663538d87c 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   {
index dbf249f66953d2b6221c2acbf8efabde44212d67..e1999b07247da19178b64d8c1746d96249625c06 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   {
index aa5fc21fb1f808e2296536d39b0a0f8e34b111f8..5e35e14ba529f1f61a8451dfd16f35668e7d1274 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   {
index be206601fb320428aca03b06f40f33e579721416..9c5d56b7bd6a58329b1c2d328c2960d11aae7ffe 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   {
index d51f430c02561c1fe0a246d2a3d61bad2cea5bf2..181858d3d69467acd5f8186f6962e4837fcedad6 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   const indexNames = [
index 8284c58a0f7418d120774cd69f023c64bb3edd51..0e3f4fbef6990f467820df497631f602cee057d3 100644 (file)
@@ -1,8 +1,8 @@
 import * as Sequelize from 'sequelize'
 
 async function up (utils: {
-  transaction: Sequelize.Transaction,
-  queryInterface: Sequelize.QueryInterface,
+  transaction: Sequelize.Transaction
+  queryInterface: Sequelize.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
 
index 6fb7bbb901ba58781a439d734f4864ea9a660d30..41de41c55889dd15670d722146b2c155b1ad9433 100644 (file)
@@ -1,8 +1,8 @@
 import * as Sequelize from 'sequelize'
 
 async function up (utils: {
-  transaction: Sequelize.Transaction,
-  queryInterface: Sequelize.QueryInterface,
+  transaction: Sequelize.Transaction
+  queryInterface: Sequelize.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
 
index fca6d666f94272e590629f8f70062e379a927670..d88724a20cf448f95894bfc2b6e86d19ec3a4422 100644 (file)
@@ -1,8 +1,8 @@
 import * as Sequelize from 'sequelize'
 
 async function up (utils: {
-  transaction: Sequelize.Transaction,
-  queryInterface: Sequelize.QueryInterface,
+  transaction: Sequelize.Transaction
+  queryInterface: Sequelize.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
 
index c85a762abb059d5ecd63908ee72938e662bda522..f75541a7ffc24e0fe9a4d2d0eb0f08f149f9c5d6 100644 (file)
@@ -1,8 +1,8 @@
 import * as Sequelize from 'sequelize'
 
 async function up (utils: {
-  transaction: Sequelize.Transaction,
-  queryInterface: Sequelize.QueryInterface,
+  transaction: Sequelize.Transaction
+  queryInterface: Sequelize.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
 
index e79466447a940328a06d621c0b00ba19de8c4e27..c745f1f02414f7cf79b603bd29b14268c0e9f9f6 100644 (file)
@@ -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.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
   const data = {
index fe4f4a5f90adcfeca6345d5248160e8372ad12f4..7cbc14ab52a3c5bd39005ef7d0e79ac19dc1ffb1 100644 (file)
@@ -1,8 +1,8 @@
 import * as Sequelize from 'sequelize'
 
 async function up (utils: {
-  transaction: Sequelize.Transaction,
-  queryInterface: Sequelize.QueryInterface,
+  transaction: Sequelize.Transaction
+  queryInterface: Sequelize.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
 
index de69f5b9ea5c3e9d645e840ea032fb5091ab655e..76813f93f0ea813f0dbf6c45242f381898223c15 100644 (file)
@@ -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.QueryInterface
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
   const transaction = utils.transaction
index 4849020ef75c26d647b40250833f0a4c70510014..f79ae5ec7e6512db4c1960525b330b1a46001033 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   {
index 18f23d9b7ce779ff502f0d3ceedbc2d1390a3662..89af28d07499108a8ad48702ad7892b9b321e946 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
 
index 05caf8e1d899e844711cb389affae5d33bc4107d..6f9a01a9cdd0dad6c5600347ac5996ce0f7eb4ce 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   {
index 20553100a9ee6336c0f5bb6ff9cbe5a1a981556d..b705387da2c82ef13e60174860516498b5ef2ff6 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   {
index 384ca1a15b6f3bf3175dfaa27ae5212361a784ab..07c25436affce257fdeafa4e836b554340df84c7 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   {
index 1258563fd417928f564a5bd972dc4ff09a9c694d..f9af942e0ed3d89fb3d5f70cd7428e5550b93e98 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   const data = {
index 2a9fd6f02a17816aeeb9d154dfbe93aabddcaf36..18ecfb9971f17fb8c7f67d09e14f93351ec98871 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   try {
index 032c0562bc7a21c0170586f9c159f12da83511c9..eefbc386b56eab5cb3e12dada35591b3e0fc2e10 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   await utils.queryInterface.removeColumn('actor', 'uuid')
index 5ca87174675d74ec1da925fd6962ff5323fff796..9cf0affa5b3928bdf83d62bb43d145d346715b95 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   const data = {
index 278698bf4040d35948a1f74a6917c530245a6a97..9c24fbc9a1910bbe8144903ae1b75db99e2bf83a 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   const data = {
index f74d76115319394553b59efa7907eedc281cad57..7addb1bb37a98c151094787f6c60c743382abd95 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   const data = {
index c55b819602a37d85d407361bb4ef2510f4aed5a3..5c290b986bb1d95afab2122cfe6abad3233cc67d 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   {
index f536632a274f6cebba8601f5a7175b75751658e5..1b46923570ed7f8257a1c4756d22f50d2bc54777 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   {
index f822a4c0562d6061d1707d99e84988e319096ad0..98d563c88eb612bc143a7b2526e813036b387988 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   {
index 5fc57aac2cedf9ba79fe5027d31c1625b8e6f4a1..5c74819d20891d88d4c7605410afc7875f5b9a0a 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   {
index 4e5f9e6abe1ea1013f5e024de1adc8a1786e5633..720b99ccc80063fb756fdfd85444741af8fc4edf 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   const data = {
index 034bdd46d05462d70df8429ce28add3fe57ac0f7..1734828a43bfa4fe2477a75776e693388314217b 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   {
index 5c2aa85b58c0801521157ab1d54d111e123ad914..737440e9b0b53abfadb0c6586388b317e4f8301c 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   {
index f0baafe7b2df58fdcc70ec72365d51a76796ee62..f3f663f59a3b0f7515d889f15a9c194e8c46ef2b 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   {
index dad2d65695d1c63570ca8505efff5bce1c857552..ade1a2a572181f7179bbfe0d725d364f38de808d 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   {
index 460dac8be9f773cbfec13a61a7a75fa8bc3af31e..08e2e3989b87688764271cab3707db2faa3f9a8a 100644 (file)
@@ -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.Sequelize
   db: 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 })
index bcfb97b563b609b7f0c3899e8fceddd2376199b3..00e56015fb09462a3348789b410510b393516e5c 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   {
index 3067ac1a41b0249c1a04163730a8be332f406fc6..d6f5081abfb50719a1f07a6137bfedaf8feee5f2 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   {
index db8c85c292bc59c193f531ca23cdbe253f34393b..84a4fa0ba94984ceadb9714f549f1b3dfc55e2d0 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   {
index 53e401c2bf732ea045669000df759ce646565152..7365c30f8a985ae2cf4c13c1f90a1c73aefac8d9 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   await utils.sequelize.query('DROP INDEX IF EXISTS video_share_account_id;')
index 7e392c8c082f3f9066789898edea7c8e27b7e808..edbddba37c9b930152b8281c34947260a5becb38 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   {
index 7d8a3d4b97c86a458a8757d480d2addbcd7d7001..1f88206d31608195807f5aa1a710d9ce4034ab54 100644 (file)
@@ -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.Sequelize
   db: any
 }): Promise<void> {
   {
index 1cb0116b7bfc145633e6baf1b2bb3fac294dc503..77203ae24139ac9f40cceb7a86f1927af545687f 100644 (file)
@@ -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: string
     script: string
   }[] = []
 
index f802658cfe9d3b6c3509427964940f8c0b365deb..3f6edc070cadb9a929c86e5d988a574c21eeba08 100644 (file)
@@ -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 playlists
   if (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 | MActorAccountChannel
 
     if (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.actor
 
   if (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).host
 
     const serverOptions = {
       where: {
@@ -402,7 +404,7 @@ type FetchRemoteActorResult = {
   support?: string
   playlists?: string
   avatar?: {
-    name: string,
+    name: string
     fileUrl: string
   }
   attributedTo: ActivityPubAttributedTo[]
index 9e469e3e614c84a78f9d68bdd84922cfd481295b..eeafdf4ba8d04848242020af795f8fb4388cda8b 100644 (file)
@@ -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_LIMIT
   let i = 0
   let nextLink = firstBody.first
   while (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).host
       if (remoteHost === WEBSERVER.HOST) continue
 
       options.uri = nextLink
index 1abf43cd40020138a6e014fd68aa3d7cc8805d50..a1c95504e3d7d6af694598bc5b8c8b306592d99a 100644 (file)
@@ -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))
   }
 }
 
index 9f0225b644746bf8e20421d86f831d8ddba191ab..c4c6b849b9e3340dc15060e23795958c47ac9654 100644 (file)
@@ -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.ActorFollower
   const me = actorFollow.ActorFollowing
 
index 1709d834841c8f759b3d8e6f7f9775a5f152bb71..3585d704aeea8909e097731f1bd830bda0f70701 100644 (file)
@@ -130,10 +130,10 @@ export {
 // ---------------------------------------------------------------------------
 
 async function sendVideoRelatedCreateActivity (options: {
-  byActor: MActorLight,
-  video: MVideoAccountLight,
-  url: string,
-  object: any,
+  byActor: MActorLight
+  video: MVideoAccountLight
+  url: string
+  object: any
   transaction?: Transaction
 }) {
   const activityBuilder = (audience: ActivityAudience) => {
index 6e41f241f74421bb080c00dce1d9065bb07ba8b1..600469c71c331826a53b91112c5b728e236e0055 100644 (file)
@@ -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) => {
index da7638a7bb04d6640880b3db4c9a30b6f7c55b43..e4e523631be0995beea84c3e7e331c8b5bd03810 100644 (file)
@@ -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 user
 
   const url = getVideoAbuseActivityPubUrl(videoAbuse)
index e84a6f98b08112a7efd80ab7d081a365b0034a5a..5db25232519cc8dbbea10dee9fafbf4ab1fb0cbf 100644 (file)
@@ -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) => {
index 4258a3c36335ed4ea79d31b0cea0e9b7cd233747..643c468a9d169a3be6d261f74cb0969f7baaa125 100644 (file)
@@ -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 happen
     logger.warn('Do not sending reject to local follower.')
     return
index e9ab5b3c59acaee8da7edce9fa7b2436313f4060..33f1d4921b28cfdc733b375b6f4b1c20414b932d 100644 (file)
@@ -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.ActorFollower
   const 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 | ActivityAnnounce
   transaction: Transaction
 }) {
   const activityBuilder = (audience: ActivityAudience) => {
index 9c76671b5d8b931bdbbeef4fe14f7cbcd06bf9a2..cb500bd347e9a96ec60c5a8e641a29d54a89d068 100644 (file)
@@ -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: Transaction
 
   logger.info('Creating job to update video %s.', video.url)
 
-  const byActor = overrodeByActor ? overrodeByActor : video.VideoChannel.Account.Actor
+  const byActor = overrodeByActor || video.VideoChannel.Account.Actor
 
   const url = getUpdateActivityPubUrl(video.url, video.updatedAt.toISOString())
 
index 77b7234796b6c89c55d444ffebb7cb649bd4055c..6fb4efd60c36e468a1e96751adc64b562fbe57e3 100644 (file)
@@ -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: MVideoAccountLight
   transaction?: Transaction
 }) {
   const { byActor, video, transaction } = options
index d5c078a29815c6e3647bf1d9c4b5435a3322e533..8642d2432df8083afe5e6fce977a8e9d71e701ef 100644 (file)
@@ -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?: boolean
   commentCreated?: boolean
 }
 type ResolveThreadResult = Promise<{ video: MVideoAccountLightBlacklistAllFiles, comment: MCommentOwnerVideo, commentCreated: boolean }>
@@ -28,7 +28,7 @@ async function resolveThread (params: ResolveThreadParams): ResolveThreadResult
   if (params.commentCreated === undefined) params.commentCreated = false
   if (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: MCommentOwnerVideo
   if (comments.length !== 0) {
-    const firstReply = comments[ comments.length - 1 ] as MCommentOwnerVideo
+    const firstReply = comments[comments.length - 1] as MCommentOwnerVideo
     firstReply.inReplyToCommentId = null
     firstReply.originCommentId = null
     firstReply.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 MCommentOwnerVideo
       comment.originCommentId = firstReply.id
-      comment.inReplyToCommentId = comments[ i + 1 ].id
+      comment.inReplyToCommentId = comments[i + 1].id
       comment.videoId = video.id
       comment.changed('updatedAt', true)
       comment.Video = video
index 6bd46bb585654582bdfde6121f64f75139b27ef7..79ccfbc7edbba0e8b8c9d27496dec066e7659791 100644 (file)
@@ -58,8 +58,6 @@ async function createRates (ratesUrl: string[], video: MVideo, rate: VideoRateTy
     const field = rate === 'like' ? 'likes' : 'dislikes'
     await video.increment(field, { by: rateCounts })
   }
-
-  return
 }
 
 async function sendVideoRateChange (
index 6bc2258cc79d5ac1d07fcb40f91a18e94e4597f8..9e43caa204d26d3d10345c1196a191579a9a2240 100644 (file)
@@ -197,25 +197,25 @@ async function syncVideoExternalAttributes (video: MVideo, fetchedVideo: VideoTo
     jobPayloads.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?: VideoFetchByUrlType
   allowRefresh?: 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?: VideoFetchByUrlType
   allowRefresh?: 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: MChannelDefault
   overrideTo?: 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.to
       const videoData = await videoActivityObjectToDBAttributes(channel, videoObject, to)
       video.name = videoData.name
       video.uuid = videoData.uuid
@@ -412,8 +418,8 @@ async function updateVideoFromAP (options: {
 }
 
 async function refreshVideoIfNeeded (options: {
-  video: MVideoThumbnail,
-  fetchedType: VideoFetchByUrlType,
+  video: MVideoThumbnail
+  fetchedType: VideoFetchByUrlType
   syncParam: SyncParam
 }): Promise<MVideoThumbnail> {
   if (!options.video.isOutdated()) return options.video
@@ -582,13 +588,13 @@ async function createVideo (videoObject: VideoTorrentObject, channel: MChannelAc
       thumbnailModel = videoCreated.id
 
       return 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.UNLISTED
   const duration = videoObject.duration.replace(/[^\d]+/, '')
 
@@ -661,7 +667,7 @@ function videoFileActivityUrlToDBAttributes (
 
     const mediaType = fileUrl.mediaType
     const attribute = {
-      extname: MIMETYPES.VIDEO.MIMETYPE_EXT[ mediaType ],
+      extname: MIMETYPES.VIDEO.MIMETYPE_EXT[mediaType],
       infoHash: parsed.infoHash,
       resolution: fileUrl.height,
       size: fileUrl.size,
index 1d8a08ed0bfc59a891dab5cfa8aea0031baf4284..572bd03bd3c8a007f924203ece10656bab40c8db 100644 (file)
@@ -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] = html
 
     return 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 = ''
 
     // Opengraph
     Object.keys(openGraphMetaTags).forEach(tagName => {
-      const tagValue = openGraphMetaTags[ tagName ]
+      const tagValue = openGraphMetaTags[tagName]
 
       tagsString += `<meta property="${tagName}" content="${tagValue}" />`
     })
index 7484524a4542880e016e43d149a3ac0e830a5524..9ce6186b155ebea5049666851d70b431794ecb33 100644 (file)
@@ -32,7 +32,8 @@ class Emailer {
   private initialized = false
   private 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.Video
     const 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.Video
     const 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 = {
index 7bfeb57833e6304fa96cce89d4b80193c1a1ec92..d0d4fc5b551f4b780aaf86d034624c1b6bacd370 100644 (file)
@@ -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> {
 
index d3bde6e6a25f2d57897d02e1dcc4ce6b7f79faba..a28f3596f7aebc33be3f62c37aea5cee8a0389f3 100644 (file)
@@ -42,7 +42,7 @@ async function buildSignedRequestOptions (payload: Payload) {
 
 function buildGlobalHeaders (body: any) {
   return {
-    'Digest': buildDigest(body)
+    Digest: buildDigest(body)
   }
 }
 
index 99c991e72ab0182b086847c8194c909cc897a436..be9e7d181b0e65aa91ab29176a0edc8c69302bba 100644 (file)
@@ -11,7 +11,7 @@ import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'
 import { getVideoFilePath } from '@server/lib/video-paths'
 
 export type VideoFileImportPayload = {
-  videoUUID: string,
+  videoUUID: string
   filePath: string
 }
 
index 1fca17584f83408c9a84dc7c556998172155fc6f..09f225cec8311b6c06fd3608e1b3cfceb7aeb16d 100644 (file)
@@ -221,7 +221,7 @@ async function processFile (downloader: () => Promise<string>, videoImport: MVid
         isNewVideo: true
       }
 
-      await JobQueue.Instance.createJob({ type: 'video-transcoding', payload: dataInput })
+      await JobQueue.Instance.createJobWithPromise({ type: 'video-transcoding', payload: dataInput })
     }
 
   } catch (err) {
index 39b9fac98c3922ff71bf530b4a0cc92ef7cc4bd9..c020057c932052113ba0f437216dc3f3e2d3fe9b 100644 (file)
@@ -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
+  | MergeAudioTranscodingPayload
 
 async function processVideoTranscoding (job: Bull.Job) {
   const payload = job.data as VideoTranscodingPayload
@@ -105,7 +107,7 @@ async function onVideoFileOptimizerSuccess (videoArg: MVideoWithFile, payload: O
 
   const { 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 anymore
     if (!videoDatabase) return undefined
 
@@ -122,8 +124,6 @@ async function onVideoFileOptimizerSuccess (videoArg: MVideoWithFile, payload: O
     await 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 published
index 61f07c48718ec8f2c879326f613a4ac39f16b84b..14acace7da80a35f0d10338a6f73aa4c9c961e47 100644 (file)
@@ -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 = false
   private jobRedisPrefix: string
 
-  private constructor () {}
+  private constructor () {
+  }
 
-  async init () {
+  init () {
     // Already initialized
     if (this.initialized === true) return
     this.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?: boolean
     jobType: 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) {
index b609f45851be220e74d153a8784f2dc378f9de41..55f7a985dee6b0ccf941dcdadab47cea01873467 100644 (file)
@@ -15,41 +15,41 @@ export type AcceptResult = {
 
 // Can be filtered by plugins
 function 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: VideoModel
   user: UserModel
 }): AcceptResult {
   return { accepted: true }
 }
 
 function isLocalVideoCommentReplyAccepted (_object: {
-  commentBody: VideoCommentCreate,
-  parentComment: VideoCommentModel,
-  video: VideoModel,
+  commentBody: VideoCommentCreate
+  parentComment: VideoCommentModel
+  video: VideoModel
   user: UserModel
 }): AcceptResult {
   return { accepted: true }
 }
 
 function isRemoteVideoAccepted (_object: {
-  activity: ActivityCreate,
-  videoAP: VideoTorrentObject,
+  activity: ActivityCreate
+  videoAP: VideoTorrentObject
   byActor: ActorModel
 }): AcceptResult {
   return { accepted: true }
 }
 
 function isRemoteVideoCommentAccepted (_object: {
-  activity: ActivityCreate,
-  commentAP: VideoCommentObject,
+  activity: ActivityCreate
+  commentAP: VideoCommentObject
   byActor: ActorModel
 }): AcceptResult {
   return { accepted: true }
index 679b9bcf688ec9885e6b4a98bbd65c6976ac0589..63197eee13deaa67e1594f6898824bffd2592b19 100644 (file)
@@ -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 blacklisted
     if (video.privacy !== VideoPrivacy.PUBLIC || video.state !== VideoState.PUBLISHED || video.isBlacklisted()) return
 
     this.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)) return
 
     this.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[]) => void
     settingGetter: (user: T) => UserNotificationSettingValue
   }) {
     const emails: string[] = []
@@ -569,7 +572,7 @@ class Notifier {
     }
 
     if (emails.length !== 0) {
-      await options.emailSender(emails)
+      options.emailSender(emails)
     }
   }
 
index 25b4f3c617721cdc50b5c9d967355889027ad6ba..dcdfba28c53092a077d10a59a575c73f27eca5ae 100644 (file)
@@ -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)
index 7ebdabd3456e1f3dcbd3e0af9128153ad733f96e..73f7a71ceafee1627ac2c435d59def472555d059 100644 (file)
@@ -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) continue
 
       plugins.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: T
     label: 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: VideoConstant
     key: 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}).`)
     }
index f77d0b62c20ba22d3a92c01da5e097b7b35cf8c1..0c5dbdd3ec13949220a0750dd1d94c2c5031443e 100644 (file)
@@ -12,7 +12,7 @@ import {
 import { CONFIG } from '../initializers/config'
 
 type CachedRoute = {
-  body: string,
+  body: string
   contentType?: string
   statusCode?: string
 }
@@ -24,7 +24,8 @@ class Redis {
   private client: RedisClient
   private 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)
 
index dd326bc1e1b5f56e6dbd065ea0a929136effd481..d700a99f0b82257d630c3a1db7232f8aea7fb9ef 100644 (file)
@@ -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 })
         }
       }
 
index 7ff41e6394e152649f66796b6be395746bedfe63..014993e94cee04568588ca21445911f2db4c966b 100644 (file)
@@ -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) continue
 
           if (
index 39fbb9163b7b751b25ea50e9d07d03f8918112bc..5ae87fe5045356f06222e2c54dbcc29869717c0c 100644 (file)
@@ -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 {
index 6e61cbe7d79bc283c24db626492c16255c816291..e33a4133aeba7490bc4fa2c40c8ac6b9fb9bec25 100644 (file)
@@ -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[]
 }
 
index a99f716290accecf0dc89fd038966cdd8323a7c9..8dbd417711bb8cfdd1a297f94db31b54c9c7893b 100644 (file)
@@ -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 = filename
   thumbnail.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?: string
   existingThumbnail?: 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 = filename
   thumbnail.height = height
index c45438d95b0784ec96952df92a2974f5ae908be9..88e60a7df5c0d7cd59fb7474dd92e7d1bb645494 100644 (file)
@@ -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?: ChannelNames
   validateUser?: 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 | undefined
   type?: ActivityPubActorType
 }) {
   const { name, displayName, userId, applicationId, t, type = 'Person' } = parameters
index 1dd45b76d9d1fe742c52d4beef611aa991f357e6..3b90b1b9415982071d6deff43dacbeb18ec47b59 100644 (file)
@@ -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?: boolean
   transaction?: 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: boolean
   user?: MUser
 }) {
   const { user, video, isRemote, isNew } = parameters
index 41eab456bb7491e560c25297be3d443978516ead..14829c9d6506349374015f1c5f8532f309c5c5c2 100644 (file)
@@ -6,8 +6,7 @@ import { buildActorInstance, federateVideoIfNeeded, getVideoChannelActivityPubUr
 import { 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,
index b8074e6d20b8ff7d166a5b63981b390e89461c6e..fe83d23e7b1c766646a0dbc2a4909024f72b56e2 100644 (file)
@@ -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: MVideoFullLight
   account: MAccountDefault
 }, t: Sequelize.Transaction) {
   let originCommentId: number | null = null
index f3feae41e2edb2fe12ce28a0d587ec4360ee0178..ab7d04d25b85a2056b885a65eaf841852033306c 100644 (file)
@@ -6,6 +6,7 @@ import { ACCEPT_HEADERS, ACTIVITY_PUB, HTTP_SIGNATURE } from '../initializers/co
 import { 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 activity
     const 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) return
index d11d7079006658cffe03a5b6f9988cbca08c92e9..f5de6960311634a0fb9c7e2c11891a6be581d9cc 100644 (file)
@@ -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 front
   reportOnly: CONFIG.CSP.REPORT_ONLY
 })
index 607def85552bb78d60ad5adde5c2f29a3136afda..dd88005dd73a1abdf14844b24b07b1a1661a5617 100644 (file)
@@ -1,6 +1,3 @@
-import * as ipaddr from 'ipaddr.js'
-import { format } from 'util'
-
 const advertiseDoNotTrack = (_, res, next) => {
   res.setHeader('Tk', 'N')
   return next()
index 749f5cccd9b3f56e59f75ca36ca175233914fe2f..9eef03bb43fc8bba3384dd350ebe977dcc25214a 100644 (file)
@@ -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) {
index 75238228fefb229401a6ef7491beb39f5e7e097d..fcbb2902cfa7599e7377b4efa85bbd9f77420bdf 100644 (file)
@@ -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'
 
index 8623d07e8064729c94ae44bafb54b134a163066d..2acb974836514c300c048d7fa9b222a69b465012 100644 (file)
@@ -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) => {
index 2d1f61947036a7b095b24b11e2e4ce13b27beedc..ceab646c0e9a7d750b889b71c8bee23c0604f582 100644 (file)
@@ -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)) return
index 29f6c87bebfaa35890b5d31556ccdae86c739742..f34c2b174527085750e48ac5bc11c4e3e549bdae 100644 (file)
@@ -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)) {
index 16b42fc0d0b870c8b23433ceaa9cd41b3f0353c5..8cd3bc33d22823735b236f5fe3fad0420b507d95 100644 (file)
@@ -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)) return
index c78c67a8cd7d389e3c50087840891191dbff7e16..5d52b5804a7f6b5b7c41abb3e6ebe27f4f5b8a9f 100644 (file)
@@ -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.User
     if (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.User
 
     if (res.locals.account.id !== user.Account.id) {
index 7b0cd6f66c8b7d0484af0609ad29e930862c1a9a..872d9c2aba9b8b2a5dee5b85be90f06e14ecbe42 100644 (file)
@@ -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 })
index 77c5f940df4d3fa41f341c4e6e74b0e85a140e44..da2fafb10aaa32d6033244187b2fda2c5a72367a 100644 (file)
@@ -50,7 +50,7 @@ const addVideoCommentThreadValidator = [
     if (areValidationErrors(req, res)) return
     if (!await doesVideoExist(req.params.videoId, res)) return
     if (!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)) return
 
     return next()
   }
index 318dad10087b50e0fcaa25338aea8d2ed94bef21..5dc5db5338fd8250e6bcceb79d022ac9eb85a5ba 100644 (file)
@@ -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'),
index 1d67e8666f75756814b16f9e13d0a2aee4e00ea2..6b15c5464a8ad70a7090743106f5c94c7ff06fa6 100644 (file)
@@ -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()
index 5d5fae8aabccb8bab724106b22301d3499e465de..cbc144f69ed56cfc9161ad816341a7e5fa70e4e9 100644 (file)
@@ -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)) return
index 6733d9dec4366cf32b821a7b3a03d715ca0e00d6..11dd02706570421382b27d121aac0cb92a056ada 100644 (file)
@@ -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 video
     if (!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()
index c593595b2b2c22d3c6716bf181345f7e8c6c38a5..8aeb486d1fef684e65033d4028c1b500b649ad19 100644 (file)
@@ -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?: string
     accountId: 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
             }
           ]
index 8a0ffeb633d77795a82bda75188e649bb3948266..0905a0fb2affe7a04a41afdacd7fe619c603712b 100644 (file)
@@ -53,7 +53,7 @@ export type SummaryOptions = {
   ]
 }))
 @Scopes(() => ({
-  [ ScopeNames.SUMMARY ]: (options: SummaryOptions = {}) => {
+  [ScopeNames.SUMMARY]: (options: SummaryOptions = {}) => {
     const whereActor = options.whereActor || undefined
 
     const 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
             }
           }
         ]
index f649b8f95a29ca4b809650128461aadce9a5f5f2..5a725187a2918f1cb5ed36df1e223379e4d686e3 100644 (file)
@@ -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) })
       : undefined
 
     const videoImport = this.VideoImport ? {
index 4c2c5e27862673eb74af492c9c3f33899d613b27..fb4c15aef0e426bf4d8c4879d3507b79ee70f14e 100644 (file)
@@ -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')
+  )
   @Column
   autoPlayNextVideoPlaylist: 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'
   }
 
index f21d2b8a29894d50dedcfa6d143b407b1ce3df9f..27643704e152275ed7cfb02af43390a1db207058 100644 (file)
@@ -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?: ActivityPubActorType
     search?: 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?: ActivityPubActorType
     search?: 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" ' +
index d651a281aa02e11a4dd43468adaa0e3ba5588bfb..00e8dc9541614b04a6f154742d66cb39bac8ed56 100644 (file)
@@ -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',
index b680be237a1bb1d5a2242f5c683ad9077378cca4..d2101ce86f9cb4ddfa668890537cc7ac313357f3 100644 (file)
@@ -23,10 +23,10 @@ import { MOAuthTokenUser } from '@server/typings/models/oauth/oauth-token'
 
 export type OAuthTokenInfo = {
   refreshToken: string
-  refreshTokenExpiresAt: Date,
+  refreshTokenExpiresAt: Date
   client: {
     id: number
-  },
+  }
   user: {
     id: number
   }
index 4e66d72e3161fdb0b5e0262a9de1c1344f321e3f..1b63d381893fea5f9545b232904440a86e35863b 100644 (file)
@@ -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: VideoRedundanciesTarget
     strategy?: 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
         }
       }
     }
index d094da1f560084b9d51d39e93364941d92a0e823..95774a4674634bf8609cedc5bdd5ff619054180e 100644 (file)
@@ -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: number
     sort: string
   }) {
     const { uninstalled = false } = options
index f89b80011ae5b5860b58233c531e92cb7be99df4..f7afb8d4b854181622ffa5f9e9c28de42fc1e7d1 100644 (file)
@@ -67,7 +67,7 @@ function getVideoSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): Or
 function 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: typings
   return [ 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) {
index b69bc087260d1537dc94dff6e27453bb4919f6d4..e396784d29124f7f43af55c855c561b5d9506ce2 100644 (file)
@@ -92,7 +92,7 @@ export class ThumbnailModel extends Model<ThumbnailModel> {
   @UpdatedAt
   updatedAt: 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,
index 3636db18de73c125e02fbf5c0831c98b2d6a524c..da8c1577cc8753c4e170955ea1391868472ba842 100644 (file)
@@ -87,9 +87,9 @@ export class VideoAbuseModel extends Model<VideoAbuseModel> {
   }
 
   static listForApi (parameters: {
-    start: number,
-    count: number,
-    sort: string,
+    start: number
+    count: number
+    sort: string
     serverAccountId: number
     user?: MUserAccountId
   }) {
index 1307c27f1082aa488f80b70eb07b3fbb83440437..59d3e105085697fd7e228f450c11706a86a1a911 100644 (file)
@@ -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 {
index 4e98e7ba3f064333176f8a30c2e87c98365c7518..835216671730eeaa1955182318d61c3caf4d6262 100644 (file)
@@ -30,7 +30,7 @@ import { buildServerIdsFollowedBy, buildTrigramSearchIndex, createSimilarityAttr
 import { 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: number
     sort: string
   }) {
     const query = {
index fb4d16b4d17b878f595f3e8c2c5482abf0b59138..b33c33d5efa002bc52f618584cefcfe508fa70a8 100644 (file)
@@ -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: string
     user?: 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: number
     user?: 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 () {
index bb50edcaab76537c21a8bf4ba6d68579747f9e38..55b0ed062576450de0cd08c4c44a767622607fed 100644 (file)
@@ -27,12 +27,13 @@ import { generateMagnetUri } from '@server/helpers/webtorrent'
 export type VideoFormattingJSONOptions = {
   completeDescription?: boolean
   additionalAttributes: {
-    state?: boolean,
-    waitTranscoding?: boolean,
-    scheduledUpdate?: boolean,
+    state?: boolean
+    waitTranscoding?: boolean
+    scheduledUpdate?: boolean
     blacklistInfo?: 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',
index f2d71357f604941f6335df3a35cd0a2db002446a..4ba16f5fd4ee56cacc3010437e2bcdf055e714f5 100644 (file)
@@ -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: AccountModel
     user?: MUserAccountId
   }) {
     const accountIds = [ options.serverAccount.id ]
index ba1fc23eac3e952e9cda963b541db6e22e4df0fa..4ca17ebec0126f49ace0f97be84c932f5f2e19ea 100644 (file)
@@ -68,12 +68,12 @@ type AvailableForListOptions = {
   type?: VideoPlaylistType
   accountId?: number
   videoChannelId?: number
-  listMyPlaylists?: boolean,
+  listMyPlaylists?: boolean
   search?: 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?: boolean
     search?: string
   }) {
     const query = {
index 1a924e6c9f6e1968fa4a2bf0b8198955e9e9db4c..1ec8d717e5d4c8592b0bec73c6f2844d6002e818 100644 (file)
@@ -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 videos
     if (!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 typings
       where: {
         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 actor
           where: {
-            [ Op.and ]: [
+            [Op.and]: [
               {
                 id: {
-                  [ Op.not ]: null
+                  [Op.not]: null
                 }
               },
               {
@@ -1184,8 +1183,8 @@ export class VideoModel extends Model<VideoModel> {
       // totals: totalVideos + totalVideoShares
       let totalVideos = 0
       let 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 + totalVideoShares
       return {
@@ -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?: number
     followerActorId?: number
-    videoPlaylistId?: number,
-    trendingDays?: number,
-    user?: MUserAccountId,
-    historyOfUser?: MUserId,
+    videoPlaylistId?: number
+    trendingDays?: number
+    user?: MUserAccountId
+    historyOfUser?: MUserId
     countVideos?: 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 // seconds
     durationMax?: number // seconds
-    user?: MUserAccountId,
+    user?: MUserAccountId
     filter?: 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.endDate
 
       whereAnd.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.originallyPublishedEndDate
 
       whereAnd.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.durationMax
 
       whereAnd.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?: Transaction
     userId?: 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 videos
     const 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 undefined
 
     const 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 MStreamingPlaylistFilesVideo
       streamingPlaylistWithFiles.Video = this
 
       if (!Array.isArray(streamingPlaylistWithFiles.VideoFiles)) {
index 34c6be49be9be139a418fa1b54baf16340d4a5ab..d16f0510803773f6aa51f1ba6b046b5fe01ff906 100644 (file)
@@ -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,
index 3d54c20428e1de58d47a80d1c1bf31f6f938a3c8..35fd94eed6b66cd4181c47badc6fb2e8a03d3f18 100644 (file)
@@ -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,
index 8c00ba3d6fdcdc07224b86bb0f61e7753801ce17..60d95b823f2f916257b82f2d38676b2340a0da67 100644 (file)
@@ -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'
index aa4bc6c0f37705ff0b775d664a121cf5449e270d..232c5d82341a75d3754aaea140c3319a3af4edf1 100644 (file)
@@ -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 refresh
       await 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)
     })
   })
 
index dc960c5c3452f21e6cf3cc3875f44c6b6f2b852a..7e58bf0652fe834cd951d4a6000c175be6ba22de 100644 (file)
@@ -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}`)
     }
   }
 
index 4f79685bdff306c8f7820727cff8ecbfe84cd354..c29af7cd70059b89f0efd87d1fe76ff5949bd774 100644 (file)
@@ -1,4 +1,4 @@
-/* tslint:disable:no-unused-expression */
+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
 import 'mocha'
 
index 0661676ce6091bb7d36250767f79e02184d31023..fb459f756f9ae59fd178aef64e3af2e3420588f2 100644 (file)
@@ -1,4 +1,4 @@
-/* tslint:disable:no-unused-expression */
+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
 import 'mocha'
 
index 443fbcb60b190c42351cb30e2e3316a16095d4d0..f1a79806bb3b835c8813c62e3c96c9c481a201d3 100644 (file)
@@ -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'
index b3051945edc67ecfb96894325d207fd11d00d527..b2126b9b09981b7d80771d409a1ea743d86a2f83 100644 (file)
@@ -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'
 
index 8dad267233f01fbc26c10d8df208ec5a2205f94d..5fac734857648984c13703284c98fd7cb5af0ea1 100644 (file)
@@ -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'
 
index be2a603a3ad420f3ff511e9902374e8bd818cc39..2c2224a452b848a972362b6d06505b76ee78ec47 100644 (file)
@@ -1,4 +1,4 @@
-/* tslint:disable:no-unused-expression */
+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
 import 'mocha'
 
index 22e23796477b99f4d6a92acd5fc5fcda2d0d2760..8f4af8d162a32fb13023268221fbe9800cff59b8 100644 (file)
@@ -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,
index f9d96bcc0785089cc428ec7979c1f4aa5804ee46..719da54e689f3970ed1905a2b714aa4b2ba40e7d 100644 (file)
@@ -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'
 
index 9553bce17f466d2c06635b56820ed8b2a6f9f9ad..cf80b35c297e6217c43b02b95df4c6291c677cec 100644 (file)
@@ -1,4 +1,4 @@
-/* tslint:disable:no-unused-expression */
+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
 import 'mocha'
 
index 7012a39ee46f0ffe283ba76b616de9def7f93abb..b2370a094f826a4f60a41cc0605427da7e107820 100644 (file)
@@ -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' })).id
index 8ad9d98bf62db01ee566e66e6a899dadaec31c03..f8d0cd4ecea43664d03aa1a03872aee67394d2db 100644 (file)
@@ -1,4 +1,4 @@
-/* tslint:disable:no-unused-expression */
+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
 import 'mocha'
 
index d15753aedd61d2319cb00117fedfc3b5d16e803d..457adfaabf0033f2ce43e5ac01dd0d806b1331c0 100644 (file)
@@ -1,4 +1,4 @@
-/* tslint:disable:no-unused-expression */
+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
 import 'mocha'
 
index 3b06be7ef496281b29f6dbfd910429d089cca7d3..2048fa66739bf6875cb445592fd97473ae4b765f 100644 (file)
@@ -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'
index fa36c40780c7be91b9e0b663907107ab30a4d766..1edba4d64af30dc2c06835bad7b781e198399bd5 100644 (file)
@@ -1,4 +1,4 @@
-/* tslint:disable:no-unused-expression */
+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
 import 'mocha'
 
index 5d5af284c5ea8dab12dffb8b7abf240a6b5c0608..f448bb2a6253aa61cc30fe3b96d5f78ba6f74634 100644 (file)
@@ -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: ServerInfo
   let userAccessToken = ''
   let moderatorAccessToken = ''
+  // eslint-disable-next-line @typescript-eslint/no-unused-vars
   let 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,
index bf29f8d4d9126369d1b6521716932419cffec828..bea2177f35be7dcfed4739f8ea6b456f4c9eb91c 100644 (file)
@@ -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-vars
     let path: string
 
     before(() => {
@@ -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-vars
     let path: string
 
     before(() => {
index 6466888fb5386623139f645f0c7701666591e5ac..145f43980333144d9efcdacebff12545264c0581 100644 (file)
@@ -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 })
     })
index 6ddc20d691cd4685afff59a3e04eca0c86e57e67..a5f5c332284469b256e359fa4e4751e04f343956 100644 (file)
@@ -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 () {
index de88298d164360531ada329dedb3895848114b4a..2795ad7d5111b837d6c12fcd46f2758feb9726dc 100644 (file)
@@ -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 () {
index 5cf90bacc25407fde6b9a44de5a529b0182bdbb6..e67cc01fa42c4b0cd926b9046153e967a6920530 100644 (file)
@@ -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'
index 231d5cc85627f46f071a3e1059a19c7bdaf55680..dbea39c48cb3340142e061b2e9ccf7c1e66dc073 100644 (file)
@@ -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: ServerInfo
   let userAccessToken = ''
+  // eslint-disable-next-line @typescript-eslint/no-unused-vars
   let accountName: string
   let 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].id
       accountName = 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 = baseCorrectParams
       const 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 = baseCorrectParams
       const 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 = baseCorrectParams
       const 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 = baseCorrectParams
       const 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 })
index df158f3b1c8f0f412cb2c19bf8ef6671376d6411..0410e737a1e73e83b862654ba175c5b7edef2dc5 100644 (file)
@@ -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: string
   let watchLaterPlaylistId: number
   let videoId: number
+  // eslint-disable-next-line @typescript-eslint/no-unused-vars
   let videoId2: number
   let playlistElementId: number
 
@@ -449,7 +450,7 @@ describe('Test video playlists API validator', function () {
       videoId3 = (await uploadVideoAndGetId({ server, videoName: 'video 3' })).id
       videoId4 = (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)
       }
     })
index 811756745c299387ad5981ee0a0c01082eecd256..ec8654db27878f37d6b0198168c8b335638d9b0d 100644 (file)
@@ -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 () {
index 3739e3fad8151e9b9cab280992ffb38edc42c011..941f6265414c2ba6383bf28f01ceae74d93fbb2c 100644 (file)
@@ -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
 
   // ---------------------------------------------------------------
index 16ef1c50521761dc71fca2d86a4c73dc087201a1..0d4665954cdc35ed3c27decffac7a89a2e99a5d8 100644 (file)
@@ -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].name
       accountName = 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 baseCorrectParams
     const 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 = baseCorrectAttaches
 
       await 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 = baseCorrectParams
       let 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 = baseCorrectParams
       const 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 = baseCorrectParams
       const 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 = baseCorrectParams
       const 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 = baseCorrectParams
       const 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 = baseCorrectParams
       const 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 = baseCorrectParams
       const 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 = baseCorrectParams
       const 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 = baseCorrectParams
       const attaches = {
-        'previewfile': join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png')
+        previewfile: join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png')
       }
 
       await makeUploadRequest({
index 15a34f5aab9c86dc2c6a0addd84519dea6274d03..2a632e16ff4decd9508fe22bfc2f63dcf7b01768 100644 (file)
@@ -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[], additionalPara
   const 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[], additionalParam
   const 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[], additionalParam
 describe('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.undefined
 
       expect(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].id
       await 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: CheckerBaseParams
 
     before(() => {
@@ -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)
index 6a8937f24d1ad6c01f133125ba45dbc27e2d1650..4253124c8f1fbedb86efe8719fe6b8ea6bb471e1 100644 (file)
@@ -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 })).uuid
     await 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.data
       expect(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)
     }
   })
index f5bf130d59c361b3f6929b3f1d2c6dbd0f98558b..c5037a5417c31f20c881a39563ac328f47f3aa74 100644 (file)
@@ -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, add
   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
     video1Server2Id = 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 = video1Server2UUID
 
   const 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 = video1Server2UUID
 
   const 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.undefined
   expect(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.undefined
   expect(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',
index d5f0a545721cfb44ab38027818b6c6f4aae481d5..d7e3ed5be42a857979d8bb808870d744e37bc9d7 100644 (file)
@@ -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 channel
     await 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 channel
     await 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].port
     const 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 video
     await 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)
index dbfefadda60d7dbda9b4de12e08ceb7ff711f863..c62dfca0d7f6242e2461acf119e052aa326acca1 100644 (file)
@@ -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')
index 7882d93733e71ab457a525181a1efb0940d9b839..4801fe04a5050b775b806a11389c66048452631a 100644 (file)
@@ -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')
     }
 
     {
index a06f578fc4d1039dd74e7e639f7c7e2762581b8c..5f48dc0ebf2c9fee5effed01d4b88d4ab7aa5ab7 100644 (file)
@@ -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)
     })
   })
 
index cf99e5c0a6a9d6d0a372116aabacd9e225bc0367..64252545549ae62fa29b9481d65f48fb65d5c481 100644 (file)
@@ -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'
 
index e4e895acb3f6b050f8d449bc005a02ff0570fae5..bd1b0e38aad9cc97a5dfda6df84da101c24c35c8 100644 (file)
@@ -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'
index c55a221f2524f1a58eba107e23341e50f58cfd41..f18859e5d186d2538af0bead17930066e42a50f1 100644 (file)
@@ -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'
index 46663bf7cb6e844bbf3ea3070e4a7da6de78a690..a73440286560505063abc97a5cef58e72aec3c62 100644 (file)
@@ -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])
index 1984c9eb14a1d1ae749b541374186a0a09642063..cee85cc4b22a50cc34bf052bc8074fa904466e06 100644 (file)
@@ -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.expect
 
 async 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 = 'acc
 
 async 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)
     }
   })
index 4ffa9e7910f75eaa29d12c4c7785301c5e6746b0..b686af4e4eb4f79310edfc591f33c23af7a0d0b4 100644 (file)
@@ -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.data
 
     expect(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 = 0
     const 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.data
       expect(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].url
     const start = 0
     const count = 5
     const 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.data
 
     expect(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.data
 
     expect(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.data
     expect(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.id
 
             const 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.id
 
             const 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.id
 
             const 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.id
 
             const 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.null
         expect(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.true
         expect(dateIsValid(comment.updatedAt as string)).to.be.true
 
         const 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.body
         expect(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)
     })
 
index 7e36067f156e27594634b6abb4875a6a5b1b414f..2cf6e15adcd9290fda9bc4cc837841f10b0641ad 100644 (file)
@@ -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-c
 
 import {
   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: Video
   let 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 follower
     for (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 3
     killallServers([ 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 })).uuid
       videoIdsServer1.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)
index 58d8c8c105fd4b36fd47cce5f6baae4ea2bb8104..19c8836b59ba8641ebb04ac02661b19518585d6a 100644 (file)
@@ -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,
index d3c87740840f0b9b240d5c4921d66463f6db7f3b..b8714c7a104df5a4c90790a591f4380fb72e4a0b 100644 (file)
@@ -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'
index 86edeb2891c18ad4f1067573d92b78a9b9738854..d0450aba0b4496ea4589b8594831777d1014203f 100644 (file)
@@ -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 () {
index b8a8a2fee00b05e50791c007525a7dc49a3baf65..452d050125e153a3c87d14e0d0b829691c4dc10e 100644 (file)
@@ -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)
     }
 
     {
index b6b33a884f7ec1a51c4d9857040f0123378445b9..d0d79c4f616683a361c4684e1448223594dc61b8 100644 (file)
@@ -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'
index a01cd4b389de4aef5d606fe42ceec15e852b939c..c207bb5f00196e649e163458c62766e06d2cbab9 100644 (file)
@@ -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.uuid
index 9d7eec8ca508ffb367f06adbd2528d1e68a3b923..9d3a274d44411a410aab0a0890e829269c05706e 100644 (file)
@@ -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'
index 05e58017a7e8ee1d18efe682819152a8e7032a1c..21b9ae4f801b8b70b307eef763bce01cfe57a456 100644 (file)
@@ -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.data
         expect(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.data
         expect(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.data
         expect(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.undefined
 
         for (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.body
           expect(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.data
 
           expect(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.data
 
           expect(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.data
         expect(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.data
         expect(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.id
 
         await 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.data
 
         expect(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.data
           expect(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.data
           expect(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.data
           expect(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.undefined
 
           for (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.body
             expect(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.data
 
           expect(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.data
 
           expect(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.data
           expect(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.id
 
         await 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.data
 
         expect(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')
         }
       })
     })
index 08017f89c25d203301a801d739f1c3cffb3f674e..7d6b0c6a99684f7e45c264b07ece6f2077af2a82 100644 (file)
@@ -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.body
 
       expect(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.body
 
       expect(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.body
 
     expect(body['user3_channel@localhost:' + servers[2].port]).to.be.true
index 7914183188e6578f5cd354ce75faa2e6da82c3a1..591ce4959bd506a497afb11e475d81eadd7a91b3 100644 (file)
@@ -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.account
     expect(user.account.displayName).to.equal('my super display name')
 
     await waitJobs(servers)
index 7cd61f5395faa12aaf9a1b7b9c9c995c9902108f..675ebf690e8eea6b3582dc0c59b6caf013fb16c3 100644 (file)
@@ -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'
index 24203a7317dd888d6a964585df986a8cba119f65..502eac0bb42e4560ba6dbb0588b07ac10831e914 100644 (file)
@@ -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.body
 
       expect(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.data
       expect(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.null
       expect(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('user_1@example.com')
       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('user_1@example.com')
       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('user_1@example.com')
       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('user_1@example.com')
-      expect(users[ 1 ].nsfwPolicy).to.equal('display')
+      expect(users[1].username).to.equal('user_1')
+      expect(users[1].email).to.equal('user_1@example.com')
+      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('user_1@example.com')
+        expect(users[0].username).to.equal('user_1')
+        expect(users[0].email).to.equal('user_1@example.com')
       }
 
       {
@@ -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')
     })
   })
index f12d730ccf9fd53f8775c349a26d5f0bcee032e1..ac7a0b89cb6d898825b038a2f56b920d9ca30e3c 100644 (file)
@@ -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)
index fa3e250ecbbb7227b3761c99dafd48864eb6d7ac..e3029f1aeb4af3591e4bbd0d6a8e342599c88824 100644 (file)
@@ -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').id
 
         const 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.id
 
         const 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',
index 17172331f917b41639ef298c3bac60bb424554a2..5505a845a65306c48ce00667b05f6dc2b5f7103c 100644 (file)
@@ -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)
index 362d6b78fb0068e70f6410c15d31acb8737f585b..596fff9965fb045a969392d33bd5b707e4422f00 100644 (file)
@@ -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'
index 0cd6f22c76252b7e69d2616700055d8ada20c088..cd6df72672075e18ed5d1437c1cdbad801dd5dd2 100644 (file)
@@ -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)
     }
   })
index 854b2f0cb56ef6f0ce8d923403aaa1de50cfe26c..67bc0114c93815bffc39ca177953f1ef4b2b8b30 100644 (file)
@@ -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.data
       const 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
       })
 
index 5e13f59490b6db178e516c6f836919213621ebdc..b4ecb39f49b40d87712390ef088b9880cef15b99 100644 (file)
@@ -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.uuid
 
     await waitJobs(servers)
index 64ee2355af24ad2020623be4db5c626cc416caff..dee6575b92f6f078943333ca0873f36dc175ac34 100644 (file)
@@ -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 = 42000000
     await 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: ServerInfo
   const 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 server
     server = await flushAndRunServer(1)
-    await setAccessTokensToServers([server])
+    await setAccessTokensToServers([ server ])
 
     const videoQuota = 42000000
     const limitedVideoQuota = 10
index 4f600cae8eefb11ecd2be702734aeb26ca0810cb..f3a23bf17127aa967ced09cbd9c10c58a53a22c6 100644 (file)
@@ -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}/)
     }
   })
index 06e4ff9c822b3dab4244219c2aa2dc334e60b750..afb58e95a3db93d71895ce1f82f1001de01bd3e4 100644 (file)
@@ -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 {
index db4d278bf15adcafcbfff0fac7f06f956274ce7e..b8e98e45f1cf64ce1c87717c89558c5cdfe97880 100644 (file)
@@ -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 characters
       const truncatedDescription = 'my super description for server 1'.repeat(7) +
-                                   'my super descrip...'
+        'my super descrip...'
 
       expect(video.description).to.equal(truncatedDescription)
     }
index bde3b56569ce813a4172f8e4e8d366b2faa9ea21..6555bc8b67813ba943b3cc4a418b14218a31fb70 100644 (file)
@@ -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, hlsOn
 
       expect(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, hlsOn
       const masterPlaylist = res.text
 
       for (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.uuid
 
       await 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.uuid
 
       await 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)
 
index 1233ed6eb9ab07588407e01580ec9bcd6b90067c..a67e528c6cedba94321b757e9a6ec1352358acd0 100644 (file)
@@ -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.data
       await checkVideosServer1(server.url, videoHttp.uuid, videoMagnet.uuid, videoTorrent.uuid)
     }
   })
index ad6a4b43f3e7eeaf578135c218d39ed08fc90102..7eba8d7d9e8bcd079937349e2e709fb2096d4d67 100644 (file)
@@ -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.data
         expect(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.data
         expect(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.data
         expect(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.data
         expect(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.data
         expect(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.data
         expect(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.data
       expect(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.data
         expect(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.data
         expect(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.data
         expect(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')
       }
     })
   })
index 73ab02c17bbfb606a3145a9200843f49967c935f..a93a0b7de816bc19276a31f6ff5941922b09858e 100644 (file)
@@ -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.id
 
     const 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.id
 
     const 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
     })
index 9fd48ac7c0b52a5bd971c19a69ab4ffc057965e2..2bb97d7a8b05ae7dcecb902d09e405e4e685621f 100644 (file)
@@ -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.body
       expect(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 VideoPlaylist
 
         const 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.undefined
       expect(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.data
         expect(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.data
         expect(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.data
         expect(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.data
         expect(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.data
         expect(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.data
         expect(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.data
           expect(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.id
       playlistServer1UUID = 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.data
         expect(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.null
 
         const 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.uuid
 
       const 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].id
 
       async 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.id
 
       const 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.data
         expect(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.id
 
       const 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
         }
index e630ca84af2f6d303b41d22afcdc45f682d345eb..4bbbb90f3df9a63d00d937b60561055c5a5bab9e 100644 (file)
@@ -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.enu
 import {
   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)
index 65a8eafb85e13ab39004e75dcd5497d0da74d98d..204f436116199b2295cba3d79d60aa15dff14174 100644 (file)
@@ -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,
index 55eb76b3ba601168378aba9791cc757e5eb207f2..3e73ccbfa5109c4f290a188ae0786cfa62c8cbdc 100644 (file)
@@ -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.body
       expect(videoDetails.files).to.have.lengthOf(1)
 
-      const magnetUri = videoDetails.files[ 0 ].magnetUri
+      const magnetUri = videoDetails.files[0].magnetUri
       expect(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].magnetUri
       expect(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.body
 
       expect(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].magnetUri
         expect(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].magnetUri
       expect(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].magnetUri
       expect(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)
       }
index e1e65260fe1868198f795a9f9dcc419e65b9b645..95e12e43cd64e30876f5b611a0161a36b3d9589e 100644 (file)
@@ -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)
           }
         }
       }
index c7e55c1ab7625a2dbe043e9a0f4e281e30716b7a..6f90e9a57b9a829fd44fdd094c3e1035bd0d0a05 100644 (file)
@@ -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'
index 975a5c87a5ab4b2e8256daaeb48831f031cc93e4..ca08ab5b1ba1b8fc8c9778d6e3be79133ffbc63e 100644 (file)
@@ -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'
index fbddd40f4906f1e73c52084075c5dc834fe4a466..d063d79736286ba1f94e9ba1c66b962c2b0ff72e 100644 (file)
@@ -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.expect
 
index aca3216bb6726ec31a4fd9625c9eb42a02f6fc0c..dac049fe4c3dfeec96c7c7a0c626729a9269f553 100644 (file)
@@ -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)).body
 
       expect(videoDetail.files).to.have.lengthOf(2)
-      const [originalVideo, transcodedVideo] = videoDetail.files
+      const [ originalVideo, transcodedVideo ] = videoDetail.files
       assertVideoProperties(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)).body
 
       expect(videoDetail.files).to.have.lengthOf(4)
-      const [originalVideo, transcodedVideo420, transcodedVideo320, transcodedVideo240] = videoDetail.files
+      const [ originalVideo, transcodedVideo420, transcodedVideo320, transcodedVideo240 ] = videoDetail.files
       assertVideoProperties(originalVideo, 720, 'ogv', 140849)
       assertVideoProperties(transcodedVideo420, 480, 'mp4')
       assertVideoProperties(transcodedVideo320, 360, 'mp4')
index 7897ff1b37b7a1aebb855db0fb98554bbe48d93e..997a9a1fda5c7d74ee91f1cacc4e6f8f3178a60e 100644 (file)
@@ -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.expect
 
 describe('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)
index de5d672f54508a706c06bfd62a2ae088cce9eda2..e2e13598fcf92813d4766ec4df958c50e4b211b5 100644 (file)
@@ -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.expect
 
 describe('Test optimize old videos', function () {
   let servers: ServerInfo[] = []
+  // eslint-disable-next-line @typescript-eslint/no-unused-vars
   let video1UUID: string
+  // eslint-disable-next-line @typescript-eslint/no-unused-vars
   let video2UUID: string
 
   before(async function () {
index 15b6755f22d1338622944afcd77fd3d5abc75f6c..27fbde02de7848f38fd8e0cc6c12c461662ab1ce 100644 (file)
@@ -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)).body
 
       expect(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')
index a5257d671bce4e9b3f0f171639c2d6ce6628f70f..7f19f14b7f7e6eac7c30033d4fa4aca8e748f0bf 100644 (file)
@@ -1,4 +1,4 @@
-/* tslint:disable:no-unused-expression */
+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
 import 'mocha'
 import {
index 144e67c44e9214923fc9e399fe36db545d439965..304c8ca56b5b932209422a7b0c28f9c3760e8e7e 100644 (file)
@@ -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.body
       await 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.body
       await makeGetRequest({
-        url: servers[ 1 ].url,
+        url: servers[1].url,
         path: account.avatar.path,
         statusCodeExpected: 200
       })
index 55c43b32fca83fdd50331f41b46854e8369842c9..2070f16f57176c456a6f8f9ec2ed103bc226b986 100644 (file)
@@ -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'
index 778dcd08e549f59176ca9c6efa7a516a0bc390eb..d61724e5116f0b5d9081316b66375f10f96bf926 100644 (file)
@@ -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'
index 437470327bb73b7764b80d30b82e0bce61a0f9c0..4510177ccf0de942ae8f9d86d4bd76c07d72dafb 100644 (file)
@@ -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')
       }
     })
   })
index ebfd779e1a2dc3ced834fcd76f8ec5e467e5ee91..4c51b70003aa2f3805132ced1a769c0f7b9837ad 100644 (file)
@@ -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 @flo2@jean.com 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' ])
   })
index 31fc6dd7c0324fbca6cbb12c4a10046b3d3cb70e..c028b316d9695512273705d92ad3a15afa9721ee 100644 (file)
@@ -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'
index a754bc6e27ab39c5560c6ebc66a7d744f2def7f0..f8b2d599b8f1e606af4cabde456ae4ad136ee348 100644 (file)
@@ -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'
index ab2dd3a0ff5efd1440659e7c837754a07f74b7b0..32b035c9ef63f15ab1d9f7ef160a24c6264a03f6 100644 (file)
@@ -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'
index 510ec315197c9ad28b855d1c8f5b47eb181a95d7..ca57a4b518f71f1a12fe3b78f5ab898db507f4bb 100644 (file)
@@ -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: string
index 6a5ea46415c3f738dd4d26195285f461a71679db..6c1fd40ba7d160afe74120dbc4c6970e98fd735a 100644 (file)
@@ -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.uuid
       await 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.uuid
index 88d91a03338f4782b53ee42e1ed1a964348a121b..8dc2043b8509867009a29b14bfdec5d2e3d40af7 100644 (file)
@@ -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'
         }
       })
     }
index 6562e2b4554e98eef8cd1d56e3dbc3a1968a1234..5374b5eccc38385c59827683128f3921b910cf23 100644 (file)
@@ -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.ts
deleted file mode 100644 (file)
index b1c1688..0000000
+++ /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.ts
deleted file mode 100644 (file)
index cba5ac3..0000000
+++ /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
-}
index 15ac6c6a8c659fd85122580145bc8e9ce66f79e2..d1a631b69efbde489f49722689eb7e340f6d65fa 100644 (file)
@@ -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: quit
     if (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') {
index acac750346bcb59849b43d920f80a979ab5f5a78..6b486e57512dce0161b65924322d5197bb796df6 100644 (file)
@@ -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 @@ program
     const [ 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 any
 
     settings.remotes.forEach(element => {
       if (!netrc.machines[element]) return
index c7e85b570bc677257a9b8279406152d3b675b5dd..0efe87810c98f4d2bc39a40bf548b63c67e67b8c 100644 (file)
@@ -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 fields
     infoArray = [].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.body
 
   for (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 key
     if (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 webpageUrl
 
   const 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 url
   return '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[]) {
index b341c14c11673c862a0e88244b854acb0f1aed07..05b75fab2b3429829bf64a0c99dbae20f31353d4 100644 (file)
@@ -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.data
 
   const table = new CliTable3({
-    head: ['name', 'version', 'homepage'],
+    head: [ 'name', 'version', 'homepage' ],
     colWidths: [ 50, 10, 50 ]
-  }) as CliTable3.HorizontalTable
+  }) as any
 
   for (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.')
index a71f48104e6510f9dece3e98a44583d2011efe9a..1ab58a438f2cfc55145a811cc9d950b40023983c 100644 (file)
@@ -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 any
 
   for (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)
index ab6e215d9dc26f431797bf4166506ea14b64ac52..7c936ae0d8f74447d7c847aec75aebc9b28c9404 100644 (file)
@@ -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]
         })
       }
     }
index f604c9bee8fb96eecb3b6f7428c6b02435bc12c5..8de952e7b377488d4a4dd3104acbd437ec0aba9d 100644 (file)
@@ -24,14 +24,14 @@ command
 
 getServerCredentials(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))
index 9ac1d05f91022ce49212eb9747257d79f7c1a29c..5f7d1bb07d8edf5efa057baa6f402edd4456ebd9 100644 (file)
@@ -29,16 +29,10 @@ program
     console.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)
index 9883bbf05b9c4827d6f59374dccd87a1e4043cf0..88dd5f7f6ced53d831a2c7cd912fbabd3fe04ba4 100644 (file)
@@ -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 command
 if (!process.argv.slice(2).length) {
@@ -82,3 +82,4 @@ getSettings()
       })
       .parse(process.argv)
   })
+  .catch(err => console.error(err))
index c9cb553325ceb063f03fb0d2db6928b588b3805e..0d8bf11bd98b5838f5aab96af8896f5efa53b892 100644 (file)
@@ -12,7 +12,8 @@ export type MAccountBlocklist = Omit<AccountBlocklistModel, 'ByAccount' | 'Block
 
 export 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>
index adb1f3689364803a2d9de6c5c1b64249217f2596..7b826ee046be0db57aa86e42ab7fb39b500c21aa 100644 (file)
@@ -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>
index f44157eba1a00548ea23fda1e8ec5b7d6ed9d84b..5d0c03c8d537eeaaf8b59e6a287a0eb1371b0958 100644 (file)
@@ -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>
index ee4ece755b1fbd52ccc75245fc2d1b2d1f2574d4..1160e84cb7f076401ff2bf108fbbed80506c6dbc 100644 (file)
@@ -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>
index 8af6cc787768b170d1dfa047c4ceaa7fdb3b2cff..21b47180f7f75e2895b2481a6a07eb5878ce6ed8 100644 (file)
@@ -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'>
index 8ef042d4e87ba9c82495d5ee3842aa5cbaadfb14..b24a95fd89380380b34ffc2b2ed9eb034a8197e6 100644 (file)
@@ -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 }
index 94674c318b78e023da6de437c235eb4ec7d6d3e1..83eb8379487d1619fb27b584cb8cd21bc2b834fc 100644 (file)
@@ -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'>
index c3e6230f29d0dd4c85e9019d0a0c58efd6bd939a..ff6f49176d7af046f741eb087a3871a7147d9201 100644 (file)
@@ -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>
index 190cc0c289082cec5b76a33033c928b1a9b39151..b35e55aeb556d1e139f41438487239217adc788c 100644 (file)
@@ -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'>
index 1cdc691b06b0a819929cc18476e156ae85bb99a6..2080360e12e1d49c806513ce687416a1632bbd87 100644 (file)
@@ -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> &
index 6ac19c20b615add1e4b7ad472de6f77bfa2a6259..31cf075effcdcb60feeedfaa79d4332a20f56669 100644 (file)
@@ -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 object
 
 type 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>
index e6f478cdfc12b4770120b7d032e574728cbec429..95a53d13968a1da7f361b6728e8f00150adc86e1 100644 (file)
@@ -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 object
index e38c3f58600585e7af33d7a363d42101e313e6e4..955ec478057e6f6583a26d123acc1040ac1f50d1 100644 (file)
@@ -13,11 +13,13 @@ export type MVideoAbuse = Omit<VideoAbuseModel, 'Account' | 'Video' | 'toActivit
 
 export 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'>>
index 7122a9dc00243716246674e0cc96c4c7770f3e3b..ddb4db832fd6b08298463fc5d291318f06c8efe3 100644 (file)
@@ -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>
index eeddedb4011add3e24c050f144631a1dd42700cd..e7aff69566666114b7c411966326daf59510d87e 100644 (file)
@@ -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>
index e5b5bbc1d438579b1b6132443b49346398f01fd7..971dc3db5bc857828e3d5131f8cc1dd71d2a9a9e 100644 (file)
@@ -9,7 +9,8 @@ type Use<K extends keyof VideoChangeOwnershipModel, M> = PickWith<VideoChangeOwn
 
 export 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'>>
index 292d0ac95335184341a8ae7a69180b9e61f9250d..50f7c2d8a053c49647fb8d225f2d54889547a11a 100644 (file)
@@ -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>
index d693f918674bcc948e23c8e930a619ca2e7c6b18..d6e0b66f545aeaadf5aa05db03bd039887b046b3 100644 (file)
@@ -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>
index 139b22b2c931b6ea37ad72333774385934c5ed08..3fcaca78f6f427db09f7fe1b72d0fdb9663f36a0 100644 (file)
@@ -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 {
index e119f17f97ee80c979f620057c2109bf022aef4c..4e5c2e4f0ae2635e6b0c93a821788817ed6a4c37 100644 (file)
@@ -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>
index 1aeff78d88c01c70739a3d1e58d895968c3e25c6..f33c76594998ee44bb210dfd50dca7c3dffa39b7 100644 (file)
@@ -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>
index a40c7aca9fec7939c5a04a4fbd3347713372923f..49c27f4a7755e2867bc034da0336a93fc0273553 100644 (file)
@@ -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>
index f6bb527fc8079eee41c99bb981a84c6955c360cc..64ce4965b9c6c2614ea60441d729cb030d6a3e22 100644 (file)
@@ -9,10 +9,12 @@ type Use<K extends keyof AccountVideoRateModel, M> = PickWith<AccountVideoRateMo
 
 export 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>
index 25bdac057e5d29aa2b469cb878ada176190bbf32..5107aa7f4034d22de40e60bc09856b5a466f5c87 100644 (file)
@@ -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>>
index a7a90beeb7e0266eea368e001c3b593632a0091c..50ca75d269b8858b8a3609fcec1d72db7b95006b 100644 (file)
@@ -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>
index 6fd4899452e23d36ad27b36d4a8533f51d931135..3f54aa560b7ac3b2354bf61438f1ffc3ab1f9f92 100644 (file)
@@ -10,25 +10,31 @@ type Use<K extends keyof VideoStreamingPlaylistModel, M> = PickWith<VideoStreami
 
 export 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[]>
 
index 82d76f40ca5dc68e50c8d507218c6f03e5c371db..7eff0a91320f305d9c1d1dedb73dd668c1a67904 100644 (file)
@@ -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[]> &
index 24d43b2587007611a1836bc3a881e562e243f5c3..55500d8c455712419cbfc0fa4a1865e926130316 100644 (file)
@@ -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]
index 5de024c0898c8e7f535529a901bfe2b5eb52af52..1eee22d82f26ba83c50196efa2464ede06146632 100644 (file)
@@ -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
   }
index cfa4523c1f6783aaf3649b4923e0cf750877a9c9..c58e8bcf82149dfcfecca1d329ac4919ad1b5a51 100644 (file)
@@ -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 => {
index d04003988b74577412b4d20c18b2438776cc6b76..f4e86b85a1f2b916774a07ff60353f7aadaa923b 100644 (file)
@@ -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.expect
 let 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 minutes
 function 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' ])
index 42599c20e8e3701018e54e8236190f6d1d8ab893..5bd5d5d8a96120b3e89f3e9336b961bac6fe1de7 100644 (file)
@@ -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]
     }
   }
 }
index 3532fb429e75801a3c8a6fe840a54dcdfeb1849c..61167f212db424cfab522c6f478d79fa5f25eb6d 100644 (file)
@@ -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?: string
   range?: 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?: string
   statusCodeExpected?: 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: string
   fixture: string
 }) {
   let filePath = ''
index da806e692082f2269a6ef94b3c18b076847325f8..4c52ea11c48d1739b5946def11b931639d03c622 100644 (file)
@@ -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'
index 273aac74728ffe355258a68903c0ca3aa8e6280d..dc631e82318d3dd034aa5f7486f1314345b47987 100644 (file)
@@ -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/)
index e002e03dd76a9eab35d456d01fe56929cfd3a5e8..d50f8324139109909f28eaa2aba12065bbdae6c9 100644 (file)
@@ -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: string
   expectedStatus?: number
 }) {
   const path = '/api/v1/server/contact'
index 3f7729c20aab00773adb38ae1720c8269ddc2148..006d591995aed439baf9b9ca787383ae81f102a6 100644 (file)
@@ -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?: ActivityPubActorType
   state?: 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?: ActivityPubActorType
   state?: 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)
 }
 
index 56fe5fa2ad25a5cc53d89822e53fed5522e640a6..d984b3d1efe62ffc5c310b3539ff758561a42acc 100644 (file)
@@ -8,20 +8,20 @@ function getJobsList (url: string, accessToken: string, state: JobState) {
   const path = '/api/v1/jobs/' + state
 
   return 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: string
   jobType?: JobType
 }) {
   const { url, accessToken, state, start, count, sort, jobType } = options
index 5c0d1e511c1812daba288d9890850c0c842e3f65..2d02d823d5f176f1030b6e730ebefd40630243bc 100644 (file)
@@ -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?: boolean
   expectedStatus?: 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?: string
   search?: string
   expectedStatus?: number
 }) {
@@ -67,9 +67,9 @@ function listAvailablePlugins (parameters: {
 }
 
 function getPlugin (parameters: {
-  url: string,
-  accessToken: string,
-  npmName: string,
+  url: string
+  accessToken: string
+  npmName: string
   expectedStatus?: 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: any
   expectedStatus?: 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: string
   expectedStatus?: 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: string
   expectedStatus?: number
 }) {
   const { url, npmName, expectedStatus = 200 } = parameters
@@ -135,8 +135,8 @@ function getPublicSettings (parameters: {
 }
 
 function getPluginTranslations (parameters: {
-  url: string,
-  locale: string,
+  url: string
+  locale: string
   expectedStatus?: 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?: string
   npmName?: string
   expectedStatus?: number
 }) {
@@ -169,9 +169,9 @@ function installPlugin (parameters: {
 }
 
 function updatePlugin (parameters: {
-  url: string,
-  accessToken: string,
-  path?: string,
+  url: string
+  accessToken: string
+  path?: string
   npmName?: string
   expectedStatus?: number
 }) {
@@ -188,8 +188,8 @@ function updatePlugin (parameters: {
 }
 
 function uninstallPlugin (parameters: {
-  url: string,
-  accessToken: string,
+  url: string
+  accessToken: string
   npmName: string
   expectedStatus?: number
 }) {
index 7b488e23e15423441b2cf5993c6ded0ff65bf623..08467e4c0ad58b26b984ca9d3d5baaed32031772 100644 (file)
@@ -15,11 +15,11 @@ function updateRedundancy (url: string, accessToken: string, host: string, redun
 
 function listVideoRedundancies (options: {
   url: string
-  accessToken: string,
-  target: VideoRedundanciesTarget,
-  start?: number,
-  count?: number,
-  sort?: string,
+  accessToken: string
+  target: VideoRedundanciesTarget
+  start?: number
+  count?: number
+  sort?: string
   statusCodeExpected?: 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: string
   videoId: 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: string
   redundancyId: number
 }) {
   const { url, accessToken, redundancyId } = options
index a0720d778ec001ea95ad54fcaa581ba800634e1f..a0f0ce9c9792f11885e0a8ff5cd0814ab057bb65 100644 (file)
@@ -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: ChildProcess
   url: string
   host: string
 
@@ -20,13 +19,13 @@ interface ServerInfo {
   serverNumber: number
 
   client: {
-    id: string,
+    id: string
     secret: string
   }
 
   user: {
-    username: string,
-    password: string,
+    username: string
+    password: string
     email?: string
   }
 
@@ -57,7 +56,7 @@ function parallelTests () {
 }
 
 function flushAndRunMultipleServers (totalServers: number, configOverride?: Object) {
-  let apps = []
+  const apps = []
   let i = 0
 
   return new Promise<ServerInfo[]>(res => {
@@ -203,20 +202,20 @@ async function runServer (server: ServerInfo, configOverrideArg?: any, args = []
 
       // Capture things if we want to
       for (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 here
       for (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...)
index 627e17cc3a113b048f049c0c9dbb9c7940355cad..f87706f6a819bc9b0b785e60c3f0bfa515e1599e 100644 (file)
@@ -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'
index 5feb8417931e8e2fcb60979409da4b28ca293140..39e720b4260268f2200f883f94eba268aabeb16e 100644 (file)
@@ -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'
 
index f9bfb3cb3d22743ec76b3b51c825eb92627f7383..4fe54a74a5f86db964b8e45b9eed532208b063db 100644 (file)
@@ -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)
   }
 
index 9a5fd7e86824e3e27386ecc6a237be97cb70397b..f949878e48f5ddc2b14471fc0644171fae326137 100644 (file)
@@ -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[], sta
     statusCodeExpected
   })
 }
+
 function markAsReadAllNotifications (url: string, token: string, statusCodeExpected = 204) {
   const path = '/api/v1/users/me/notifications/read-all'
 
@@ -77,7 +78,7 @@ type CheckerBaseParams = {
   server: ServerInfo
   emails: object[]
   socketNotifications: UserNotification[]
-  token: string,
+  token: string
   check?: { 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
   }
 
index 2fe0e55c219e32e62e0dde89f84ab1f0f1a5f843..248af2d6e3e92b65efefa9d3f95a4fde48642491 100644 (file)
@@ -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?: UserAdminFlag
   specialStatus?: 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: string
   fixture: 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?: UserAdminFlag
   role?: UserRole
 }) {
   const path = '/api/v1/users/' + options.userId
index e25a292fc73abf17962eff168643e282e69f8d45..ba139ef95269ad7c682c62772098ccd9954e9f9d 100644 (file)
@@ -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?: VideoBlacklistType
   specialStatus?: number
 }) {
-  let { url, token, sort, type, specialStatus = 200 } = parameters
+  const { url, token, sort, type, specialStatus = 200 } = parameters
   const path = '/api/v1/videos/blacklist/'
 
   const query = { sort, type }
index 8d67f617b299ae5fcd1049c3de052dae9e090614..5bd533bba17517f7ba7cb6443133033dba5ec07e 100644 (file)
@@ -6,12 +6,12 @@ import { buildAbsoluteFixturePath } from '../miscs/miscs'
 const expect = chai.expect
 
 function createVideoCaption (args: {
-  url: string,
+  url: string
   accessToken: string
   videoId: string | number
   language: string
-  fixture: string,
-  mimeType?: string,
+  fixture: string
+  mimeType?: string
   statusCodeExpected?: number
 }) {
   const path = '/api/v1/videos/' + args.videoId + '/captions/' + args.language
index 0538423312bd10477499adf1327cf1bad1449714..51d433940daa45cd0970d9debcdf0a92ea272383 100644 (file)
@@ -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?: string
   specialStatus?: 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: string
   videoChannelName: 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)
   }
index 0ebf69ced7278eb9d99e8cb50ab3b26c7e38585b..81c48412df8723276791bc396d6f5f11492b9e69 100644 (file)
@@ -1,3 +1,5 @@
+/* eslint-disable @typescript-eslint/no-floating-promises */
+
 import * as request from 'supertest'
 import { makeDeleteRequest } from '../requests/requests'
 
index 150cc94edcb1b028fa7ec48cc889e5b591419f7f..8e5abd2f54a8db956ae6b59d42f6a6ce5e4e1b0a 100644 (file)
@@ -7,7 +7,7 @@ function getYoutubeVideoUrl () {
 }
 
 function getMagnetURI () {
-  // tslint:disable:max-line-length
+  // eslint-disable-next-line max-len
   return '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'
 }
 
index 6762c59736596275560616aaaf833c92decbeea9..5bcc02570984d2e211769140f3ff864f9d5ae8cc 100644 (file)
@@ -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: VideoPlaylistCreate
   expectedStatus?: 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 | string
   expectedStatus?: 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 | string
   elementAttrs: 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: VideoPlaylistElementUpdate
   expectedStatus?: 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: number
   expectedStatus?: 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 | string
   elementAttrs: {
-    startPosition: number,
-    insertAfterPosition: number,
+    startPosition: number
+    insertAfterPosition: number
     reorderLength?: number
-  },
+  }
   expectedStatus?: number
 }) {
   const path = '/api/v1/video-playlists/' + options.playlistId + '/videos/reorder'
index eb25011cbcb3a5381841c8f4b27c5454e8ea046e..e54da84aad30f68c03e5cae58b0c1b37809be313 100644 (file)
@@ -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)
 }
 
index aa13273aef7f194e38d74f583f317787d32063d3..39a06b0d7b304a8f125b0c29a7569c39cd632963 100644 (file)
@@ -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: string
     publishedAt?: string
     support: string
-    originallyPublishedAt?: string,
+    originallyPublishedAt?: string
     account: {
       name: string
       host: string
@@ -509,7 +509,7 @@ async function completeVideoCheck (
     files: {
       resolution: number
       size: number
-    }[],
+    }[]
     thumbnailfile?: string
     previewfile?: 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?: VideoPrivacy
   token?: string
 }) {
   const videoAttrs: any = { name: options.videoName }
index 492b672c7b4a7087864bfa0d8a705a7b4bbb5be3..20ecf176c607ebbf3ab138d0d92491cd19461217 100644 (file)
@@ -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: string
   object: APObject
 }
@@ -89,7 +110,7 @@ export interface ActivityDislike extends BaseActivity {
 }
 
 export interface ActivityFlag extends BaseActivity {
-  type: 'Flag',
-  content: string,
+  type: 'Flag'
+  content: string
   object: APObject | APObject[]
 }
index b8a2dc92515c2fb0d3f68eb5a6ec1d1e0ee89a5c..f022f3d02bba69e60ed954c1f71631c48491407c 100644 (file)
@@ -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
 }
index 1d9f4b3b3ca90289e2a6c38e6cfa9c10640f2239..fafdc246ded98ef697a1625d98fff26e7eede9bd 100644 (file)
@@ -1,6 +1,6 @@
 export interface ActivityPubSignature {
-  type: 'GraphSignature2012'
-  created: Date,
+  type: string
+  created: Date
   creator: string
   signatureValue: string
 }
index 4b0a3a724dc1d51deaa02a3fc7a755eb579323b6..19a8175824602553db0c8919e32557995e45cd79 100644 (file)
@@ -2,7 +2,7 @@ import { ActivityVideoUrlObject, ActivityPlaylistUrlObject } from './common-obje
 
 export interface CacheFileObject {
   id: string
-  type: 'CacheFile',
+  type: 'CacheFile'
   object: string
   expires: string
   url: ActivityVideoUrlObject | ActivityPlaylistUrlObject
index bab3ce366c6ce6b1b5615ef08948e5f4a9d30ef3..e94d054295448fdf3d1c60780b81a3b500963f8a 100644 (file)
@@ -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
+  | ActivityHtmlUrlObject
 
 export interface ActivityPubAttributedTo {
   type: 'Group' | 'Person'
index 5f1264a76b68e373beea13070584a8e86758c411..d9622b414895b6c70420b6284dc1fffa9c1971a1 100644 (file)
@@ -1,5 +1,5 @@
 export interface VideoAbuseObject {
-  type: 'Flag',
+  type: 'Flag'
   content: string
   object: string | string[]
 }
index cadd0ea4910fd55fc5688561c35a9c894653c66b..11de8fc56bbddb9cd1c0ffe194e588798531a8de 100644 (file)
@@ -20,8 +20,8 @@ export interface VideoTorrentObject {
   subtitleLanguage: ActivityIdentifierObject[]
   views: number
   sensitive: boolean
-  commentsEnabled: boolean,
-  downloadEnabled: boolean,
+  commentsEnabled: boolean
+  downloadEnabled: boolean
   waitTranscoding: boolean
   state: VideoState
   published: string
index 00348116a74bed001709f337da9442ffac93f3ae..4dd21ce8e664900ee8604729fee7d047ecaed769 100644 (file)
@@ -1,5 +1,5 @@
 export interface ViewObject {
-  type: 'View',
+  type: 'View'
   actor: string
   object: string
 }
index 0329442818b8c36c0addd06c2540248c814f2f48..9ae175df9e65faf7606728e9484d33e469cf9c3f 100644 (file)
@@ -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-line
   return translations && translations[str] ? translations[str] : str
 }
 
index 0a2d0492ec7518000745ce3b4c3225843ddfe419..336cb66d29275b2873783d1968f4c3959787781e 100644 (file)
@@ -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.
      */
index dec4618fa282f8b48af111e37087972d40ac2682..811a64429c1753ebbc782033151f977176d78a6b 100644 (file)
@@ -1,5 +1,5 @@
 export interface PeertubePluginLatestVersionRequest {
-  currentPeerTubeEngine?: string,
+  currentPeerTubeEngine?: string
 
   npmNames: string[]
 }
index 3f30776713fd39608406d922818a6317ff03b784..c26e9ae5b55dcca60ee67be8c9a385f7146f9372 100644 (file)
@@ -5,7 +5,7 @@ export type PluginTranslationPaths = {
 }
 
 export type ClientScript = {
-  script: string,
+  script: string
   scopes: PluginClientScope[]
 }
 
@@ -13,12 +13,12 @@ export type PluginPackageJson = {
   name: string
   version: string
   description: string
-  engine: { peertube: string },
+  engine: { peertube: string }
 
-  homepage: string,
-  author: string,
-  bugs: string,
-  library: string,
+  homepage: string
+  author: string
+  bugs: string
+  library: string
 
   staticDirs: { [ name: string ]: string }
   css: string[]
index 80ecd9e24d609a5f78fc7e83fd70d9d817d8ac0e..20f89b86d96b5915402cadd7898db65f8ae84dd1 100644 (file)
@@ -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
 }
 
index 014f69634e567ffc1e454c9750ef0d2d00efeab9..fa6e058324d5b190d310f59e1796344dd2e60882 100644 (file)
@@ -24,10 +24,12 @@ interface RedundancyInformation {
   size: number
 }
 
+// eslint-disable-next-line @typescript-eslint/no-empty-interface
 export interface FileRedundancyInformation extends RedundancyInformation {
 
 }
 
+// eslint-disable-next-line @typescript-eslint/no-empty-interface
 export interface StreamingPlaylistRedundancyInformation extends RedundancyInformation {
 
 }
index 032b91a29a8c4a0aa105014eed80ac3e08d9fb2c..07e17bda2b973120a886c8a32f3e6b5da1d15d20 100644 (file)
@@ -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: boolean
       manualApproval: boolean
     }
   }
index 19fd4c65924531b14505bb9b0dd34bef590cdf0e..cf29d20d40098d05d828017df950512aafa78b5b 100644 (file)
@@ -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: number
   state: JobState
   type: JobType
-  data: any,
-  error: any,
+  data: any
+  error: any
   createdAt: Date | string
   finishedOn: Date | string
   processedOn: Date | string
index f1bb2153cd3f42d2f785ebcb922bae148655353e..76e0d6f2ddfa562ae42b4a8efd720a4636d8f22f 100644 (file)
@@ -46,7 +46,7 @@ export interface ServerConfig {
   }
 
   signup: {
-    allowed: boolean,
+    allowed: boolean
     allowedForCurrentIP: boolean
     requiresEmailVerification: 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[]
     }
   }
index 16885119674ba78f248c227c874f0591f9045344..efb4510148e12ddedc6f1b2c84a1b9ad3f89851a 100644 (file)
@@ -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.json
deleted file mode 100644 (file)
index cfe2ac7..0000000
+++ /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
-  }
-}
index 0a1ad1d611e035ec4bc73b41d27798c8b94961f1..6e75dab9a59e50fe20ee9fbbd7f2c661fa2bfab7 100644 (file)
--- a/yarn.lock
+++ b/yarn.lock
   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"
   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"
   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/experimental-utils@2.18.0":
+  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/typescript-estree@2.18.0":
+  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 @@ after@0.8.2:
   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 @@ ansi-colors@3.2.3:
   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 @@ array-flatten@1.1.1:
   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 @@ callsite@1.0.0:
   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=
+
 content-disposition@0.5.3:
   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==
 
-debug@2.6.9, debug@^2.2.0:
+debug@2.6.9, 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 @@ dns-prefetch-control@0.2.0:
   resolved "https://registry.yarnpkg.com/dns-prefetch-control/-/dns-prefetch-control-0.2.0.tgz#73988161841f3dcc81f47686d539a2c702c88624"
   integrity sha512-hvSnros73+qyZXhHFjx2CMLwoj3Fe7eR9EJsFsqmcI1bB2OBWL/+0YzaEaKssCHnj/6crawNnUyw74Gm2EKe+Q==
 
-doctrine@0.7.2:
-  version "0.7.2"
-  resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-0.7.2.tgz#7cb860359ba3be90e040b26b729ce4bfa654c523"
-  integrity sha1-fLhgNZujvpDgQLJrcpzkv6ZUxSM=
+doctrine@1.5.0:
+  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"
 
 dont-sniff-mimetype@1.1.0:
   version "1.1.0"
@@ -1815,14 +1952,14 @@ env-variable@0.0.x:
   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 @@ escape-string-regexp@1.0.5, escape-string-regexp@^1.0.5, escape-string-regexp@~1
   resolved "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"
+
 extsprintf@1.3.0:
   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 @@ find-up@3.0.0, 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 @@ github-from-package@0.0.0:
   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 @@ glob@7.1.3:
     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 @@ i@0.3.x:
   resolved "https://registry.yarnpkg.com/i/-/i-0.3.6.tgz#d96c92732076f072711b6b10fd7d4f65ad8ee23d"
   integrity sha1-2WyScyB28HJxG2sQ/X1PZa2O4j0=
 
-iconv-lite@0.4.24, iconv-lite@^0.4.4, iconv-lite@~0.4.24:
+iconv-lite@0.4.24, 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 @@ isarray@2.0.1:
   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 @@ json-schema@0.2.3:
   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"
+
 libxmljs@0.19.7:
   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:
+mute-stream@0.0.8, 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=
+
 ncp@1.0.x:
   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==
+
 nocache@2.1.0:
   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.0
     define-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 @@ packet-reader@1.0.0:
   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 @@ path-to-regexp@0.1.7:
   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"
+
 pkginfo@0.3.x:
   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 @@ revalidator@0.1.x:
   resolved "https://registry.yarnpkg.com/revalidator/-/revalidator-0.1.8.tgz#fece61bfa0c1b52a206bd6b18198184bdd523a3b"
   integrity sha1-/s5hv6DBtSoga9axgZgYS91SOjs=
 
+rimraf@2.6.3:
+  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"
+
 rimraf@2.x.x, 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 @@ semver@4.3.2:
   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"
+
 smtp-connection@4.0.2:
   version "4.0.2"
   resolved "https://registry.yarnpkg.com/smtp-connection/-/smtp-connection-4.0.2.tgz#d9dd68d38569f3ad9265473670d09d8f3ea518db"
@@ -5230,6 +5828,11 @@ strip-json-comments@2.0.1, 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 @@ text-hex@1.0.x:
   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"
 
-tmp@0.0.x:
+tmp@0.0.x, 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"
 
-tslib@1.9.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"
+
 type-detect@0.1.1:
   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==
+
 type-is@1.6.15:
   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"
 
+write@1.0.3:
+  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 @@ yn@3.1.1:
   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"