aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-07-13 11:58:01 +0200
committerChocobozzz <me@florianbigard.com>2022-07-13 12:14:26 +0200
commitba2684ceddf9b76312635b9cddc6bf6975ce436a (patch)
treed7c9618b9a6f632029d809d8bf342adc26c85cc8
parente45dd87b93c621c606415f9e8d0d381de6d7a2d7 (diff)
downloadPeerTube-ba2684ceddf9b76312635b9cddc6bf6975ce436a.tar.gz
PeerTube-ba2684ceddf9b76312635b9cddc6bf6975ce436a.tar.zst
PeerTube-ba2684ceddf9b76312635b9cddc6bf6975ce436a.zip
Fix lint
-rw-r--r--.eslintrc.json4
-rw-r--r--client/.eslintrc.json2
-rw-r--r--package.json1
-rw-r--r--scripts/benchmark.ts2
-rw-r--r--server/controllers/api/users/index.ts2
-rw-r--r--server/controllers/api/videos/import.ts2
-rw-r--r--server/controllers/api/videos/view.ts2
-rw-r--r--server/controllers/services.ts2
-rw-r--r--server/lib/activitypub/actors/shared/url-to-object.ts4
-rw-r--r--server/lib/auth/external-auth.ts2
-rw-r--r--server/lib/blocklist.ts2
-rw-r--r--server/lib/moderation.ts4
-rw-r--r--server/lib/opentelemetry/tracing.ts2
-rw-r--r--server/lib/plugins/plugin-manager.ts2
-rw-r--r--server/lib/plugins/video-constant-manager-factory.ts2
-rw-r--r--server/lib/user.ts6
-rw-r--r--server/lib/video.ts4
-rw-r--r--server/models/actor/actor-follow.ts4
-rw-r--r--server/models/oauth/oauth-client.ts4
-rw-r--r--server/models/redundancy/video-redundancy.ts2
-rw-r--r--server/models/user/user.ts4
-rw-r--r--server/models/video/video-playlist.ts2
-rw-r--r--server/models/video/video.ts2
-rw-r--r--server/tests/api/check-params/abuses.ts6
-rw-r--r--server/tests/api/check-params/live.ts2
-rw-r--r--server/tests/api/check-params/users-admin.ts2
-rw-r--r--server/tests/api/check-params/users.ts2
-rw-r--r--server/tests/api/check-params/video-blacklist.ts4
-rw-r--r--server/tests/api/check-params/video-imports.ts2
-rw-r--r--server/tests/api/check-params/video-playlists.ts2
-rw-r--r--server/tests/api/check-params/videos.ts2
-rw-r--r--server/tests/api/check-params/views.ts12
-rw-r--r--server/tests/api/notifications/admin-notifications.ts2
-rw-r--r--server/tests/api/notifications/notifications-api.ts2
-rw-r--r--server/tests/api/redundancy/redundancy.ts2
-rw-r--r--server/tests/api/search/search-videos.ts6
-rw-r--r--server/tests/api/server/handle-down.ts2
-rw-r--r--server/tests/api/videos/video-nsfw.ts2
-rw-r--r--server/tests/plugins/filter-hooks.ts4
-rw-r--r--server/tests/shared/notifications.ts2
-rw-r--r--shared/server-commands/requests/requests.ts2
-rw-r--r--shared/server-commands/search/search-command.ts2
-rw-r--r--shared/server-commands/users/login-command.ts2
-rw-r--r--yarn.lock31
44 files changed, 93 insertions, 63 deletions
diff --git a/.eslintrc.json b/.eslintrc.json
index dd3821398..c2dd2fc44 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -43,7 +43,9 @@
43 2, 43 2,
44 { 44 {
45 "SwitchCase": 1, 45 "SwitchCase": 1,
46 "MemberExpression": "off" 46 "MemberExpression": "off",
47 // https://github.com/eslint/eslint/issues/15299
48 "ignoredNodes": ["PropertyDefinition"]
47 } 49 }
48 ], 50 ],
49 "@typescript-eslint/consistent-type-assertions": [ 51 "@typescript-eslint/consistent-type-assertions": [
diff --git a/client/.eslintrc.json b/client/.eslintrc.json
index 021de0118..f9326acc8 100644
--- a/client/.eslintrc.json
+++ b/client/.eslintrc.json
@@ -29,7 +29,7 @@
29 "arrow-body-style": "off", 29 "arrow-body-style": "off",
30 "import/no-webpack-loader-syntax": "off", 30 "import/no-webpack-loader-syntax": "off",
31 "no-underscore-dangle": "off", 31 "no-underscore-dangle": "off",
32 "node/no-callback-literal": "off", 32 "n/no-callback-literal": "off",
33 "@angular-eslint/component-selector": [ 33 "@angular-eslint/component-selector": [
34 "error", 34 "error",
35 { 35 {
diff --git a/package.json b/package.json
index c9a5edb52..add7b122a 100644
--- a/package.json
+++ b/package.json
@@ -220,6 +220,7 @@
220 "eslint": "^8.0.0", 220 "eslint": "^8.0.0",
221 "eslint-config-standard-with-typescript": "^22.0.0", 221 "eslint-config-standard-with-typescript": "^22.0.0",
222 "eslint-plugin-import": "^2.20.1", 222 "eslint-plugin-import": "^2.20.1",
223 "eslint-plugin-n": "^15.2.4",
223 "eslint-plugin-node": "^11.0.0", 224 "eslint-plugin-node": "^11.0.0",
224 "eslint-plugin-promise": "^6.0.0", 225 "eslint-plugin-promise": "^6.0.0",
225 "fast-xml-parser": "^4.0.0-beta.8", 226 "fast-xml-parser": "^4.0.0-beta.8",
diff --git a/scripts/benchmark.ts b/scripts/benchmark.ts
index 4a414a2fa..f7f9ad1bf 100644
--- a/scripts/benchmark.ts
+++ b/scripts/benchmark.ts
@@ -208,7 +208,7 @@ function runBenchmark (options: {
208 return new Promise((res, rej) => { 208 return new Promise((res, rej) => {
209 autocannon({ 209 autocannon({
210 url: server.url + path, 210 url: server.url + path,
211 method: method, 211 method,
212 body, 212 body,
213 connections: 20, 213 connections: 20,
214 headers, 214 headers,
diff --git a/server/controllers/api/users/index.ts b/server/controllers/api/users/index.ts
index 46e80d56d..7761ba602 100644
--- a/server/controllers/api/users/index.ts
+++ b/server/controllers/api/users/index.ts
@@ -226,7 +226,7 @@ async function registerUser (req: express.Request, res: express.Response) {
226 }) 226 })
227 227
228 const { user, account, videoChannel } = await createUserAccountAndChannelAndPlaylist({ 228 const { user, account, videoChannel } = await createUserAccountAndChannelAndPlaylist({
229 userToCreate: userToCreate, 229 userToCreate,
230 userDisplayName: body.displayName || undefined, 230 userDisplayName: body.displayName || undefined,
231 channelNames: body.channel 231 channelNames: body.channel
232 }) 232 })
diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts
index 44283e266..7576e77e7 100644
--- a/server/controllers/api/videos/import.ts
+++ b/server/controllers/api/videos/import.ts
@@ -274,7 +274,7 @@ async function buildVideo (channelId: number, body: VideoImportCreate, importDat
274 support: body.support || null, 274 support: body.support || null,
275 privacy: body.privacy || VideoPrivacy.PRIVATE, 275 privacy: body.privacy || VideoPrivacy.PRIVATE,
276 duration: 0, // duration will be set by the import job 276 duration: 0, // duration will be set by the import job
277 channelId: channelId, 277 channelId,
278 originallyPublishedAt: body.originallyPublishedAt 278 originallyPublishedAt: body.originallyPublishedAt
279 ? new Date(body.originallyPublishedAt) 279 ? new Date(body.originallyPublishedAt)
280 : importData.originallyPublishedAt 280 : importData.originallyPublishedAt
diff --git a/server/controllers/api/videos/view.ts b/server/controllers/api/videos/view.ts
index dee1ec67c..a747fa334 100644
--- a/server/controllers/api/videos/view.ts
+++ b/server/controllers/api/videos/view.ts
@@ -39,7 +39,7 @@ async function viewVideo (req: express.Request, res: express.Response) {
39 }) 39 })
40 40
41 if (successView) { 41 if (successView) {
42 Hooks.runAction('action:api.video.viewed', { video: video, ip, req, res }) 42 Hooks.runAction('action:api.video.viewed', { video, ip, req, res })
43 } 43 }
44 44
45 await updateUserHistoryIfNeeded(body, video, res) 45 await updateUserHistoryIfNeeded(body, video, res)
diff --git a/server/controllers/services.ts b/server/controllers/services.ts
index 70d08ab69..cabcbc00b 100644
--- a/server/controllers/services.ts
+++ b/server/controllers/services.ts
@@ -141,7 +141,7 @@ function buildOEmbed (options: {
141 html, 141 html,
142 width: embedWidth, 142 width: embedWidth,
143 height: embedHeight, 143 height: embedHeight,
144 title: title, 144 title,
145 author_name: channel.name, 145 author_name: channel.name,
146 author_url: channel.Actor.url, 146 author_url: channel.Actor.url,
147 provider_name: 'PeerTube', 147 provider_name: 'PeerTube',
diff --git a/server/lib/activitypub/actors/shared/url-to-object.ts b/server/lib/activitypub/actors/shared/url-to-object.ts
index 7bc37f1ff..12a121725 100644
--- a/server/lib/activitypub/actors/shared/url-to-object.ts
+++ b/server/lib/activitypub/actors/shared/url-to-object.ts
@@ -11,12 +11,12 @@ async function fetchRemoteActor (actorUrl: string): Promise<{ statusCode: number
11 11
12 if (sanitizeAndCheckActorObject(body) === false) { 12 if (sanitizeAndCheckActorObject(body) === false) {
13 logger.debug('Remote actor JSON is not valid.', { actorJSON: body }) 13 logger.debug('Remote actor JSON is not valid.', { actorJSON: body })
14 return { actorObject: undefined, statusCode: statusCode } 14 return { actorObject: undefined, statusCode }
15 } 15 }
16 16
17 if (checkUrlsSameHost(body.id, actorUrl) !== true) { 17 if (checkUrlsSameHost(body.id, actorUrl) !== true) {
18 logger.warn('Actor url %s has not the same host than its AP id %s', actorUrl, body.id) 18 logger.warn('Actor url %s has not the same host than its AP id %s', actorUrl, body.id)
19 return { actorObject: undefined, statusCode: statusCode } 19 return { actorObject: undefined, statusCode }
20 } 20 }
21 21
22 return { 22 return {
diff --git a/server/lib/auth/external-auth.ts b/server/lib/auth/external-auth.ts
index 80f5064b6..053112801 100644
--- a/server/lib/auth/external-auth.ts
+++ b/server/lib/auth/external-auth.ts
@@ -166,7 +166,7 @@ function getBypassFromExternalAuth (username: string, externalAuthToken: string)
166 return { 166 return {
167 bypass: true, 167 bypass: true,
168 pluginName: npmName, 168 pluginName: npmName,
169 authName: authName, 169 authName,
170 user 170 user
171 } 171 }
172} 172}
diff --git a/server/lib/blocklist.ts b/server/lib/blocklist.ts
index 98273a6ea..a11b717b5 100644
--- a/server/lib/blocklist.ts
+++ b/server/lib/blocklist.ts
@@ -8,7 +8,7 @@ function addAccountInBlocklist (byAccountId: number, targetAccountId: number) {
8 return sequelizeTypescript.transaction(async t => { 8 return sequelizeTypescript.transaction(async t => {
9 return AccountBlocklistModel.upsert({ 9 return AccountBlocklistModel.upsert({
10 accountId: byAccountId, 10 accountId: byAccountId,
11 targetAccountId: targetAccountId 11 targetAccountId
12 }, { transaction: t }) 12 }, { transaction: t })
13 }) 13 })
14} 14}
diff --git a/server/lib/moderation.ts b/server/lib/moderation.ts
index c2565f867..c23f5b6a6 100644
--- a/server/lib/moderation.ts
+++ b/server/lib/moderation.ts
@@ -115,8 +115,8 @@ async function createVideoAbuse (options: {
115 const videoAbuseInstance: MVideoAbuseVideoFull = await VideoAbuseModel.create({ 115 const videoAbuseInstance: MVideoAbuseVideoFull = await VideoAbuseModel.create({
116 abuseId: abuseInstance.id, 116 abuseId: abuseInstance.id,
117 videoId: videoInstance.id, 117 videoId: videoInstance.id,
118 startAt: startAt, 118 startAt,
119 endAt: endAt 119 endAt
120 }, { transaction }) 120 }, { transaction })
121 121
122 videoAbuseInstance.Video = videoInstance 122 videoAbuseInstance.Video = videoInstance
diff --git a/server/lib/opentelemetry/tracing.ts b/server/lib/opentelemetry/tracing.ts
index 5358d04de..23764e9e4 100644
--- a/server/lib/opentelemetry/tracing.ts
+++ b/server/lib/opentelemetry/tracing.ts
@@ -47,7 +47,7 @@ function registerOpentelemetryTracing () {
47 }) 47 })
48 48
49 registerInstrumentations({ 49 registerInstrumentations({
50 tracerProvider: tracerProvider, 50 tracerProvider,
51 instrumentations: [ 51 instrumentations: [
52 new PgInstrumentation({ 52 new PgInstrumentation({
53 enhancedDatabaseReporting: true 53 enhancedDatabaseReporting: true
diff --git a/server/lib/plugins/plugin-manager.ts b/server/lib/plugins/plugin-manager.ts
index 1305f660f..c21ebd0c5 100644
--- a/server/lib/plugins/plugin-manager.ts
+++ b/server/lib/plugins/plugin-manager.ts
@@ -563,7 +563,7 @@ export class PluginManager implements ServerHook {
563 if (!this.hooks[options.target]) this.hooks[options.target] = [] 563 if (!this.hooks[options.target]) this.hooks[options.target] = []
564 564
565 this.hooks[options.target].push({ 565 this.hooks[options.target].push({
566 npmName: npmName, 566 npmName,
567 pluginName: plugin.name, 567 pluginName: plugin.name,
568 handler: options.handler, 568 handler: options.handler,
569 priority: options.priority || 0 569 priority: options.priority || 0
diff --git a/server/lib/plugins/video-constant-manager-factory.ts b/server/lib/plugins/video-constant-manager-factory.ts
index f04dde29f..5f7edfbe2 100644
--- a/server/lib/plugins/video-constant-manager-factory.ts
+++ b/server/lib/plugins/video-constant-manager-factory.ts
@@ -97,7 +97,7 @@ export class VideoConstantManagerFactory {
97 } 97 }
98 } 98 }
99 99
100 this.updatedVideoConstants[type][npmName].added.push({ key: key, label } as VideoConstant) 100 this.updatedVideoConstants[type][npmName].added.push({ key, label } as VideoConstant)
101 obj[key] = label 101 obj[key] = label
102 102
103 return true 103 return true
diff --git a/server/lib/user.ts b/server/lib/user.ts
index 586fd0f12..f4ffae0e4 100644
--- a/server/lib/user.ts
+++ b/server/lib/user.ts
@@ -64,8 +64,8 @@ function buildUser (options: {
64 emailVerified, 64 emailVerified,
65 adminFlags, 65 adminFlags,
66 66
67 videoQuota: videoQuota, 67 videoQuota,
68 videoQuotaDaily: videoQuotaDaily, 68 videoQuotaDaily,
69 69
70 pluginAuth 70 pluginAuth
71 }) 71 })
@@ -147,7 +147,7 @@ async function createApplicationActor (applicationId: number) {
147 const accountCreated = await createLocalAccountWithoutKeys({ 147 const accountCreated = await createLocalAccountWithoutKeys({
148 name: SERVER_ACTOR_NAME, 148 name: SERVER_ACTOR_NAME,
149 userId: null, 149 userId: null,
150 applicationId: applicationId, 150 applicationId,
151 t: undefined, 151 t: undefined,
152 type: 'Application' 152 type: 'Application'
153 }) 153 })
diff --git a/server/lib/video.ts b/server/lib/video.ts
index 86718abbe..b843b11bc 100644
--- a/server/lib/video.ts
+++ b/server/lib/video.ts
@@ -26,7 +26,7 @@ function buildLocalVideoFromReq (videoInfo: VideoCreate, channelId: number): Fil
26 description: videoInfo.description, 26 description: videoInfo.description,
27 support: videoInfo.support, 27 support: videoInfo.support,
28 privacy: videoInfo.privacy || VideoPrivacy.PRIVATE, 28 privacy: videoInfo.privacy || VideoPrivacy.PRIVATE,
29 channelId: channelId, 29 channelId,
30 originallyPublishedAt: videoInfo.originallyPublishedAt 30 originallyPublishedAt: videoInfo.originallyPublishedAt
31 ? new Date(videoInfo.originallyPublishedAt) 31 ? new Date(videoInfo.originallyPublishedAt)
32 : null 32 : null
@@ -122,7 +122,7 @@ async function addOptimizeOrMergeAudioJob (options: {
122async function addTranscodingJob (payload: VideoTranscodingPayload, options: CreateJobOptions = {}) { 122async function addTranscodingJob (payload: VideoTranscodingPayload, options: CreateJobOptions = {}) {
123 await VideoJobInfoModel.increaseOrCreate(payload.videoUUID, 'pendingTranscode') 123 await VideoJobInfoModel.increaseOrCreate(payload.videoUUID, 'pendingTranscode')
124 124
125 return JobQueue.Instance.createJobWithPromise({ type: 'video-transcoding', payload: payload }, options) 125 return JobQueue.Instance.createJobWithPromise({ type: 'video-transcoding', payload }, options)
126} 126}
127 127
128async function getTranscodingJobPriority (user: MUserId) { 128async function getTranscodingJobPriority (user: MUserId) {
diff --git a/server/models/actor/actor-follow.ts b/server/models/actor/actor-follow.ts
index af1d85e9f..8870bec05 100644
--- a/server/models/actor/actor-follow.ts
+++ b/server/models/actor/actor-follow.ts
@@ -218,7 +218,7 @@ export class ActorFollowModel extends Model<Partial<AttributesOnly<ActorFollowMo
218 const query = { 218 const query = {
219 where: { 219 where: {
220 actorId, 220 actorId,
221 targetActorId: targetActorId 221 targetActorId
222 }, 222 },
223 include: [ 223 include: [
224 { 224 {
@@ -372,7 +372,7 @@ export class ActorFollowModel extends Model<Partial<AttributesOnly<ActorFollowMo
372 }) { 372 }) {
373 const { actorId, start, count, sort } = options 373 const { actorId, start, count, sort } = options
374 const where = { 374 const where = {
375 actorId: actorId 375 actorId
376 } 376 }
377 377
378 if (options.search) { 378 if (options.search) {
diff --git a/server/models/oauth/oauth-client.ts b/server/models/oauth/oauth-client.ts
index 860fa6f53..457e84613 100644
--- a/server/models/oauth/oauth-client.ts
+++ b/server/models/oauth/oauth-client.ts
@@ -53,8 +53,8 @@ export class OAuthClientModel extends Model<Partial<AttributesOnly<OAuthClientMo
53 static getByIdAndSecret (clientId: string, clientSecret: string) { 53 static getByIdAndSecret (clientId: string, clientSecret: string) {
54 const query = { 54 const query = {
55 where: { 55 where: {
56 clientId: clientId, 56 clientId,
57 clientSecret: clientSecret 57 clientSecret
58 } 58 }
59 } 59 }
60 60
diff --git a/server/models/redundancy/video-redundancy.ts b/server/models/redundancy/video-redundancy.ts
index 6f84747da..b363afb28 100644
--- a/server/models/redundancy/video-redundancy.ts
+++ b/server/models/redundancy/video-redundancy.ts
@@ -530,7 +530,7 @@ export class VideoRedundancyModel extends Model<Partial<AttributesOnly<VideoRedu
530 } 530 }
531 531
532 if (strategy) { 532 if (strategy) {
533 Object.assign(redundancyWhere, { strategy: strategy }) 533 Object.assign(redundancyWhere, { strategy })
534 } 534 }
535 535
536 const videoFilterWhere = { 536 const videoFilterWhere = {
diff --git a/server/models/user/user.ts b/server/models/user/user.ts
index dc260e512..3fd359359 100644
--- a/server/models/user/user.ts
+++ b/server/models/user/user.ts
@@ -488,9 +488,7 @@ export class UserModel extends Model<Partial<AttributesOnly<UserModel>>> {
488 } 488 }
489 489
490 if (blocked !== undefined) { 490 if (blocked !== undefined) {
491 Object.assign(where, { 491 Object.assign(where, { blocked })
492 blocked: blocked
493 })
494 } 492 }
495 493
496 const query: FindOptions = { 494 const query: FindOptions = {
diff --git a/server/models/video/video-playlist.ts b/server/models/video/video-playlist.ts
index 00cca0549..81ce3dc9e 100644
--- a/server/models/video/video-playlist.ts
+++ b/server/models/video/video-playlist.ts
@@ -423,7 +423,7 @@ export class VideoPlaylistModel extends Model<Partial<AttributesOnly<VideoPlayli
423 ]).then(([ count, rows ]) => ({ total: count, data: rows })) 423 ]).then(([ count, rows ]) => ({ total: count, data: rows }))
424 } 424 }
425 425
426 static searchForApi (options: Pick<AvailableForListOptions, 'followerActorId' | 'search'| 'host'| 'uuids'> & { 426 static searchForApi (options: Pick<AvailableForListOptions, 'followerActorId' | 'search' | 'host' | 'uuids'> & {
427 start: number 427 start: number
428 count: number 428 count: number
429 sort: string 429 sort: string
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index cdc1137be..53328d311 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -949,7 +949,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
949 const total = totalVideos + totalVideoShares 949 const total = totalVideos + totalVideoShares
950 return { 950 return {
951 data: rows, 951 data: rows,
952 total: total 952 total
953 } 953 }
954 }) 954 })
955 } 955 }
diff --git a/server/tests/api/check-params/abuses.ts b/server/tests/api/check-params/abuses.ts
index bc2cc640f..7d8347412 100644
--- a/server/tests/api/check-params/abuses.ts
+++ b/server/tests/api/check-params/abuses.ts
@@ -163,7 +163,7 @@ describe('Test abuses API validators', function () {
163 163
164 it('Should fail with a wrong video', async function () { 164 it('Should fail with a wrong video', async function () {
165 const fields = { video: { id: 'blabla' }, reason: 'my super reason' } 165 const fields = { video: { id: 'blabla' }, reason: 'my super reason' }
166 await makePostBodyRequest({ url: server.url, path: path, token: userToken, fields }) 166 await makePostBodyRequest({ url: server.url, path, token: userToken, fields })
167 }) 167 })
168 168
169 it('Should fail with an unknown video', async function () { 169 it('Should fail with an unknown video', async function () {
@@ -179,7 +179,7 @@ describe('Test abuses API validators', function () {
179 179
180 it('Should fail with a wrong comment', async function () { 180 it('Should fail with a wrong comment', async function () {
181 const fields = { comment: { id: 'blabla' }, reason: 'my super reason' } 181 const fields = { comment: { id: 'blabla' }, reason: 'my super reason' }
182 await makePostBodyRequest({ url: server.url, path: path, token: userToken, fields }) 182 await makePostBodyRequest({ url: server.url, path, token: userToken, fields })
183 }) 183 })
184 184
185 it('Should fail with an unknown comment', async function () { 185 it('Should fail with an unknown comment', async function () {
@@ -195,7 +195,7 @@ describe('Test abuses API validators', function () {
195 195
196 it('Should fail with a wrong account', async function () { 196 it('Should fail with a wrong account', async function () {
197 const fields = { account: { id: 'blabla' }, reason: 'my super reason' } 197 const fields = { account: { id: 'blabla' }, reason: 'my super reason' }
198 await makePostBodyRequest({ url: server.url, path: path, token: userToken, fields }) 198 await makePostBodyRequest({ url: server.url, path, token: userToken, fields })
199 }) 199 })
200 200
201 it('Should fail with an unknown account', async function () { 201 it('Should fail with an unknown account', async function () {
diff --git a/server/tests/api/check-params/live.ts b/server/tests/api/check-params/live.ts
index 29f847e51..b092f16f9 100644
--- a/server/tests/api/check-params/live.ts
+++ b/server/tests/api/check-params/live.ts
@@ -51,7 +51,7 @@ describe('Test video lives API validator', function () {
51 51
52 const username = 'user1' 52 const username = 'user1'
53 const password = 'my super password' 53 const password = 'my super password'
54 await server.users.create({ username: username, password: password }) 54 await server.users.create({ username, password })
55 userAccessToken = await server.login.getAccessToken({ username, password }) 55 userAccessToken = await server.login.getAccessToken({ username, password })
56 56
57 { 57 {
diff --git a/server/tests/api/check-params/users-admin.ts b/server/tests/api/check-params/users-admin.ts
index d8353f83b..716c22556 100644
--- a/server/tests/api/check-params/users-admin.ts
+++ b/server/tests/api/check-params/users-admin.ts
@@ -175,7 +175,7 @@ describe('Test users admin API validators', function () {
175 175
176 await makePostBodyRequest({ 176 await makePostBodyRequest({
177 url: server.url, 177 url: server.url,
178 path: path, 178 path,
179 token: server.accessToken, 179 token: server.accessToken,
180 fields, 180 fields,
181 expectedStatus: HttpStatusCode.OK_200 181 expectedStatus: HttpStatusCode.OK_200
diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts
index 84254945c..4c4f54958 100644
--- a/server/tests/api/check-params/users.ts
+++ b/server/tests/api/check-params/users.ts
@@ -163,7 +163,7 @@ describe('Test users API validators', function () {
163 url: server.url, 163 url: server.url,
164 path: registrationPath, 164 path: registrationPath,
165 token: server.accessToken, 165 token: server.accessToken,
166 fields: fields, 166 fields,
167 expectedStatus: HttpStatusCode.NO_CONTENT_204 167 expectedStatus: HttpStatusCode.NO_CONTENT_204
168 }) 168 })
169 }) 169 })
diff --git a/server/tests/api/check-params/video-blacklist.ts b/server/tests/api/check-params/video-blacklist.ts
index 1aab60826..0ec3f49d5 100644
--- a/server/tests/api/check-params/video-blacklist.ts
+++ b/server/tests/api/check-params/video-blacklist.ts
@@ -37,14 +37,14 @@ describe('Test video blacklist API validators', function () {
37 { 37 {
38 const username = 'user1' 38 const username = 'user1'
39 const password = 'my super password' 39 const password = 'my super password'
40 await servers[0].users.create({ username: username, password: password }) 40 await servers[0].users.create({ username, password })
41 userAccessToken1 = await servers[0].login.getAccessToken({ username, password }) 41 userAccessToken1 = await servers[0].login.getAccessToken({ username, password })
42 } 42 }
43 43
44 { 44 {
45 const username = 'user2' 45 const username = 'user2'
46 const password = 'my super password' 46 const password = 'my super password'
47 await servers[0].users.create({ username: username, password: password }) 47 await servers[0].users.create({ username, password })
48 userAccessToken2 = await servers[0].login.getAccessToken({ username, password }) 48 userAccessToken2 = await servers[0].login.getAccessToken({ username, password })
49 } 49 }
50 50
diff --git a/server/tests/api/check-params/video-imports.ts b/server/tests/api/check-params/video-imports.ts
index da9d0826a..4439810e8 100644
--- a/server/tests/api/check-params/video-imports.ts
+++ b/server/tests/api/check-params/video-imports.ts
@@ -35,7 +35,7 @@ describe('Test video imports API validator', function () {
35 35
36 const username = 'user1' 36 const username = 'user1'
37 const password = 'my super password' 37 const password = 'my super password'
38 await server.users.create({ username: username, password: password }) 38 await server.users.create({ username, password })
39 userAccessToken = await server.login.getAccessToken({ username, password }) 39 userAccessToken = await server.login.getAccessToken({ username, password })
40 40
41 { 41 {
diff --git a/server/tests/api/check-params/video-playlists.ts b/server/tests/api/check-params/video-playlists.ts
index 4b17ce7db..8db91a3f9 100644
--- a/server/tests/api/check-params/video-playlists.ts
+++ b/server/tests/api/check-params/video-playlists.ts
@@ -209,7 +209,7 @@ describe('Test video playlists API validator', function () {
209 } 209 }
210 } 210 }
211 const getUpdate = (params: any, playlistId: number | string) => { 211 const getUpdate = (params: any, playlistId: number | string) => {
212 return { ...params, playlistId: playlistId } 212 return { ...params, playlistId }
213 } 213 }
214 214
215 it('Should fail with an unauthenticated user', async function () { 215 it('Should fail with an unauthenticated user', async function () {
diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts
index 5ff51d1ff..e5c9b90c4 100644
--- a/server/tests/api/check-params/videos.ts
+++ b/server/tests/api/check-params/videos.ts
@@ -205,7 +205,7 @@ describe('Test videos API validator', function () {
205 support: 'my super support text', 205 support: 'my super support text',
206 tags: [ 'tag1', 'tag2' ], 206 tags: [ 'tag1', 'tag2' ],
207 privacy: VideoPrivacy.PUBLIC, 207 privacy: VideoPrivacy.PUBLIC,
208 channelId: channelId, 208 channelId,
209 originallyPublishedAt: new Date().toISOString() 209 originallyPublishedAt: new Date().toISOString()
210 } 210 }
211 }) 211 })
diff --git a/server/tests/api/check-params/views.ts b/server/tests/api/check-params/views.ts
index 8f1fa796b..9bf1ef6c3 100644
--- a/server/tests/api/check-params/views.ts
+++ b/server/tests/api/check-params/views.ts
@@ -64,12 +64,12 @@ describe('Test videos views', function () {
64 }) 64 })
65 65
66 it('Should fail without token', async function () { 66 it('Should fail without token', async function () {
67 await servers[0].videoStats.getOverallStats({ videoId: videoId, token: null, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) 67 await servers[0].videoStats.getOverallStats({ videoId, token: null, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
68 }) 68 })
69 69
70 it('Should fail with another token', async function () { 70 it('Should fail with another token', async function () {
71 await servers[0].videoStats.getOverallStats({ 71 await servers[0].videoStats.getOverallStats({
72 videoId: videoId, 72 videoId,
73 token: userAccessToken, 73 token: userAccessToken,
74 expectedStatus: HttpStatusCode.FORBIDDEN_403 74 expectedStatus: HttpStatusCode.FORBIDDEN_403
75 }) 75 })
@@ -114,7 +114,7 @@ describe('Test videos views', function () {
114 114
115 it('Should fail without token', async function () { 115 it('Should fail without token', async function () {
116 await servers[0].videoStats.getTimeserieStats({ 116 await servers[0].videoStats.getTimeserieStats({
117 videoId: videoId, 117 videoId,
118 token: null, 118 token: null,
119 metric: 'viewers', 119 metric: 'viewers',
120 expectedStatus: HttpStatusCode.UNAUTHORIZED_401 120 expectedStatus: HttpStatusCode.UNAUTHORIZED_401
@@ -123,7 +123,7 @@ describe('Test videos views', function () {
123 123
124 it('Should fail with another token', async function () { 124 it('Should fail with another token', async function () {
125 await servers[0].videoStats.getTimeserieStats({ 125 await servers[0].videoStats.getTimeserieStats({
126 videoId: videoId, 126 videoId,
127 token: userAccessToken, 127 token: userAccessToken,
128 metric: 'viewers', 128 metric: 'viewers',
129 expectedStatus: HttpStatusCode.FORBIDDEN_403 129 expectedStatus: HttpStatusCode.FORBIDDEN_403
@@ -198,7 +198,7 @@ describe('Test videos views', function () {
198 198
199 it('Should fail without token', async function () { 199 it('Should fail without token', async function () {
200 await servers[0].videoStats.getRetentionStats({ 200 await servers[0].videoStats.getRetentionStats({
201 videoId: videoId, 201 videoId,
202 token: null, 202 token: null,
203 expectedStatus: HttpStatusCode.UNAUTHORIZED_401 203 expectedStatus: HttpStatusCode.UNAUTHORIZED_401
204 }) 204 })
@@ -206,7 +206,7 @@ describe('Test videos views', function () {
206 206
207 it('Should fail with another token', async function () { 207 it('Should fail with another token', async function () {
208 await servers[0].videoStats.getRetentionStats({ 208 await servers[0].videoStats.getRetentionStats({
209 videoId: videoId, 209 videoId,
210 token: userAccessToken, 210 token: userAccessToken,
211 expectedStatus: HttpStatusCode.FORBIDDEN_403 211 expectedStatus: HttpStatusCode.FORBIDDEN_403
212 }) 212 })
diff --git a/server/tests/api/notifications/admin-notifications.ts b/server/tests/api/notifications/admin-notifications.ts
index f037e7aae..1501f9227 100644
--- a/server/tests/api/notifications/admin-notifications.ts
+++ b/server/tests/api/notifications/admin-notifications.ts
@@ -51,7 +51,7 @@ describe('Test admin notifications', function () {
51 adminNotifications = res.adminNotifications 51 adminNotifications = res.adminNotifications
52 52
53 baseParams = { 53 baseParams = {
54 server: server, 54 server,
55 emails, 55 emails,
56 socketNotifications: adminNotifications, 56 socketNotifications: adminNotifications,
57 token: server.accessToken 57 token: server.accessToken
diff --git a/server/tests/api/notifications/notifications-api.ts b/server/tests/api/notifications/notifications-api.ts
index 78864c8a0..e2b4777c0 100644
--- a/server/tests/api/notifications/notifications-api.ts
+++ b/server/tests/api/notifications/notifications-api.ts
@@ -99,7 +99,7 @@ describe('Test notifications API', function () {
99 99
100 before(() => { 100 before(() => {
101 baseParams = { 101 baseParams = {
102 server: server, 102 server,
103 emails, 103 emails,
104 socketNotifications: userNotifications, 104 socketNotifications: userNotifications,
105 token: userToken 105 token: userToken
diff --git a/server/tests/api/redundancy/redundancy.ts b/server/tests/api/redundancy/redundancy.ts
index 0f7ffcb4c..9887d2535 100644
--- a/server/tests/api/redundancy/redundancy.ts
+++ b/server/tests/api/redundancy/redundancy.ts
@@ -53,7 +53,7 @@ async function createServers (strategy: VideoRedundancyStrategy | null, addition
53 strategies.push( 53 strategies.push(
54 { 54 {
55 min_lifetime: '1 hour', 55 min_lifetime: '1 hour',
56 strategy: strategy, 56 strategy,
57 size: '400KB', 57 size: '400KB',
58 58
59 ...additionalParams 59 ...additionalParams
diff --git a/server/tests/api/search/search-videos.ts b/server/tests/api/search/search-videos.ts
index ff4c3c161..b1ebc855c 100644
--- a/server/tests/api/search/search-videos.ts
+++ b/server/tests/api/search/search-videos.ts
@@ -106,7 +106,7 @@ describe('Test videos search', function () {
106 licence: 2, 106 licence: 2,
107 language: 'en' 107 language: 'en'
108 } 108 }
109 await server.videos.upload({ attributes: attributes }) 109 await server.videos.upload({ attributes })
110 110
111 await server.videos.upload({ attributes: { ...attributes, name: attributes.name + ' duplicate' } }) 111 await server.videos.upload({ attributes: { ...attributes, name: attributes.name + ' duplicate' } })
112 } 112 }
@@ -119,7 +119,7 @@ describe('Test videos search', function () {
119 licence: 3, 119 licence: 3,
120 language: 'pl' 120 language: 'pl'
121 } 121 }
122 await server.videos.upload({ attributes: attributes }) 122 await server.videos.upload({ attributes })
123 } 123 }
124 124
125 { 125 {
@@ -210,7 +210,7 @@ describe('Test videos search', function () {
210 const search = { 210 const search = {
211 categoryOneOf: [ 3 ] 211 categoryOneOf: [ 3 ]
212 } 212 }
213 const body = await command.advancedVideoSearch({ search: search }) 213 const body = await command.advancedVideoSearch({ search })
214 214
215 expect(body.total).to.equal(1) 215 expect(body.total).to.equal(1)
216 216
diff --git a/server/tests/api/server/handle-down.ts b/server/tests/api/server/handle-down.ts
index 3dcd076f5..c45d3ea60 100644
--- a/server/tests/api/server/handle-down.ts
+++ b/server/tests/api/server/handle-down.ts
@@ -162,7 +162,7 @@ describe('Test handle downs', function () {
162 162
163 for (const state of states) { 163 for (const state of states) {
164 const body = await servers[0].jobs.list({ 164 const body = await servers[0].jobs.list({
165 state: state, 165 state,
166 start: 0, 166 start: 0,
167 count: 50, 167 count: 50,
168 sort: '-createdAt' 168 sort: '-createdAt'
diff --git a/server/tests/api/videos/video-nsfw.ts b/server/tests/api/videos/video-nsfw.ts
index 99ea67a0f..34713025d 100644
--- a/server/tests/api/videos/video-nsfw.ts
+++ b/server/tests/api/videos/video-nsfw.ts
@@ -136,7 +136,7 @@ describe('Test video NSFW policy', function () {
136 it('Should create a user having the default nsfw policy', async function () { 136 it('Should create a user having the default nsfw policy', async function () {
137 const username = 'user1' 137 const username = 'user1'
138 const password = 'my super password' 138 const password = 'my super password'
139 await server.users.create({ username: username, password: password }) 139 await server.users.create({ username, password })
140 140
141 userAccessToken = await server.login.getAccessToken({ username, password }) 141 userAccessToken = await server.login.getAccessToken({ username, password })
142 142
diff --git a/server/tests/plugins/filter-hooks.ts b/server/tests/plugins/filter-hooks.ts
index e0f25ca26..b1f83d201 100644
--- a/server/tests/plugins/filter-hooks.ts
+++ b/server/tests/plugins/filter-hooks.ts
@@ -395,7 +395,7 @@ describe('Test plugin filter hooks', function () {
395 const uuids: string[] = [] 395 const uuids: string[] = []
396 396
397 for (const name of [ 'bad torrent', 'bad file', 'bad playlist file' ]) { 397 for (const name of [ 'bad torrent', 'bad file', 'bad playlist file' ]) {
398 const uuid = (await servers[0].videos.quickUpload({ name: name })).uuid 398 const uuid = (await servers[0].videos.quickUpload({ name })).uuid
399 uuids.push(uuid) 399 uuids.push(uuid)
400 } 400 }
401 401
@@ -446,7 +446,7 @@ describe('Test plugin filter hooks', function () {
446 446
447 for (const name of [ 'bad embed', 'good embed' ]) { 447 for (const name of [ 'bad embed', 'good embed' ]) {
448 { 448 {
449 const uuid = (await servers[0].videos.quickUpload({ name: name })).uuid 449 const uuid = (await servers[0].videos.quickUpload({ name })).uuid
450 embedVideos.push(await servers[0].videos.get({ id: uuid })) 450 embedVideos.push(await servers[0].videos.get({ id: uuid }))
451 } 451 }
452 452
diff --git a/server/tests/shared/notifications.ts b/server/tests/shared/notifications.ts
index 09bc8da03..ee15e2b09 100644
--- a/server/tests/shared/notifications.ts
+++ b/server/tests/shared/notifications.ts
@@ -780,7 +780,7 @@ async function checkNotification (options: CheckerBaseParams & {
780 const check = options.check || { web: true, mail: true } 780 const check = options.check || { web: true, mail: true }
781 781
782 if (check.web) { 782 if (check.web) {
783 const notification = await server.notifications.getLatest({ token: token }) 783 const notification = await server.notifications.getLatest({ token })
784 784
785 if (notification || checkType !== 'absence') { 785 if (notification || checkType !== 'absence') {
786 notificationChecker(notification, checkType) 786 notificationChecker(notification, checkType)
diff --git a/shared/server-commands/requests/requests.ts b/shared/server-commands/requests/requests.ts
index 95e4fe6b1..a08a6e0b9 100644
--- a/shared/server-commands/requests/requests.ts
+++ b/shared/server-commands/requests/requests.ts
@@ -52,7 +52,7 @@ function makeActivityPubGetRequest (url: string, path: string, expectedStatus =
52 return makeGetRequest({ 52 return makeGetRequest({
53 url, 53 url,
54 path, 54 path,
55 expectedStatus: expectedStatus, 55 expectedStatus,
56 accept: 'application/activity+json,text/html;q=0.9,\\*/\\*;q=0.8' 56 accept: 'application/activity+json,text/html;q=0.9,\\*/\\*;q=0.8'
57 }) 57 })
58} 58}
diff --git a/shared/server-commands/search/search-command.ts b/shared/server-commands/search/search-command.ts
index 0fbbcd6ef..a5b498b66 100644
--- a/shared/server-commands/search/search-command.ts
+++ b/shared/server-commands/search/search-command.ts
@@ -74,7 +74,7 @@ export class SearchCommand extends AbstractCommand {
74 ...options, 74 ...options,
75 75
76 search: { 76 search: {
77 search: search, 77 search,
78 sort: sort ?? '-publishedAt' 78 sort: sort ?? '-publishedAt'
79 } 79 }
80 }) 80 })
diff --git a/shared/server-commands/users/login-command.ts b/shared/server-commands/users/login-command.ts
index 143f72a59..54070e426 100644
--- a/shared/server-commands/users/login-command.ts
+++ b/shared/server-commands/users/login-command.ts
@@ -60,7 +60,7 @@ export class LoginCommand extends AbstractCommand {
60 const body = { 60 const body = {
61 client_id: this.server.store.client.id, 61 client_id: this.server.store.client.id,
62 client_secret: this.server.store.client.secret, 62 client_secret: this.server.store.client.secret,
63 username: username, 63 username,
64 response_type: 'code', 64 response_type: 'code',
65 grant_type: 'password', 65 grant_type: 'password',
66 scope: 'upload', 66 scope: 'upload',
diff --git a/yarn.lock b/yarn.lock
index e73c78f63..2a42fc428 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3157,6 +3157,13 @@ bufrw@^1.3.0:
3157 hexer "^1.5.0" 3157 hexer "^1.5.0"
3158 xtend "^4.0.0" 3158 xtend "^4.0.0"
3159 3159
3160builtins@^5.0.1:
3161 version "5.0.1"
3162 resolved "https://registry.yarnpkg.com/builtins/-/builtins-5.0.1.tgz#87f6db9ab0458be728564fa81d876d8d74552fa9"
3163 integrity sha512-qwVpFEHNfhYJIzNRBvd2C1kyo6jz3ZSMPyyuR47OPdiKWlbYnZNyDWuyR175qDnAJLiCo5fBBqPb3RiXgWlkOQ==
3164 dependencies:
3165 semver "^7.0.0"
3166
3160bull@^4.1.0: 3167bull@^4.1.0:
3161 version "4.8.4" 3168 version "4.8.4"
3162 resolved "https://registry.yarnpkg.com/bull/-/bull-4.8.4.tgz#c538610492050d5160dbd9180704145f135a0aa9" 3169 resolved "https://registry.yarnpkg.com/bull/-/bull-4.8.4.tgz#c538610492050d5160dbd9180704145f135a0aa9"
@@ -4350,6 +4357,14 @@ eslint-plugin-es@^3.0.0:
4350 eslint-utils "^2.0.0" 4357 eslint-utils "^2.0.0"
4351 regexpp "^3.0.0" 4358 regexpp "^3.0.0"
4352 4359
4360eslint-plugin-es@^4.1.0:
4361 version "4.1.0"
4362 resolved "https://registry.yarnpkg.com/eslint-plugin-es/-/eslint-plugin-es-4.1.0.tgz#f0822f0c18a535a97c3e714e89f88586a7641ec9"
4363 integrity sha512-GILhQTnjYE2WorX5Jyi5i4dz5ALWxBIdQECVQavL6s7cI76IZTDWleTHkxz/QT3kvcs2QlGHvKLYsSlPOlPXnQ==
4364 dependencies:
4365 eslint-utils "^2.0.0"
4366 regexpp "^3.0.0"
4367
4353eslint-plugin-import@^2.20.1: 4368eslint-plugin-import@^2.20.1:
4354 version "2.26.0" 4369 version "2.26.0"
4355 resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz#f812dc47be4f2b72b478a021605a59fc6fe8b88b" 4370 resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz#f812dc47be4f2b72b478a021605a59fc6fe8b88b"
@@ -4369,6 +4384,20 @@ eslint-plugin-import@^2.20.1:
4369 resolve "^1.22.0" 4384 resolve "^1.22.0"
4370 tsconfig-paths "^3.14.1" 4385 tsconfig-paths "^3.14.1"
4371 4386
4387eslint-plugin-n@^15.2.4:
4388 version "15.2.4"
4389 resolved "https://registry.yarnpkg.com/eslint-plugin-n/-/eslint-plugin-n-15.2.4.tgz#d62021a0821ae650701ed459756aaf478a9b6056"
4390 integrity sha512-tjnVMv2fiXYMnuiIFI8QMtyUFI42SckEEWvi8h68SWGWshfqO6SSCASy24dGMGAiy7NUk6DZt90DM0iNUsmQ5w==
4391 dependencies:
4392 builtins "^5.0.1"
4393 eslint-plugin-es "^4.1.0"
4394 eslint-utils "^3.0.0"
4395 ignore "^5.1.1"
4396 is-core-module "^2.9.0"
4397 minimatch "^3.1.2"
4398 resolve "^1.10.1"
4399 semver "^7.3.7"
4400
4372eslint-plugin-node@^11.0.0: 4401eslint-plugin-node@^11.0.0:
4373 version "11.1.0" 4402 version "11.1.0"
4374 resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz#c95544416ee4ada26740a30474eefc5402dc671d" 4403 resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz#c95544416ee4ada26740a30474eefc5402dc671d"
@@ -8005,7 +8034,7 @@ semver@^6.0.0, semver@^6.1.0:
8005 resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" 8034 resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
8006 integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== 8035 integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==
8007 8036
8008semver@^7.3.2, semver@^7.3.5, semver@^7.3.7: 8037semver@^7.0.0, semver@^7.3.2, semver@^7.3.5, semver@^7.3.7:
8009 version "7.3.7" 8038 version "7.3.7"
8010 resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.7.tgz#12c5b649afdbf9049707796e22a4028814ce523f" 8039 resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.7.tgz#12c5b649afdbf9049707796e22a4028814ce523f"
8011 integrity sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g== 8040 integrity sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==