aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.eslintrc.json10
-rw-r--r--server/lib/activitypub/activity.ts2
-rw-r--r--server/middlewares/validators/config.ts4
-rw-r--r--server/tests/api/moderation/abuses.ts20
-rw-r--r--server/tests/feeds/feeds.ts2
-rw-r--r--server/tools/peertube-import-videos.ts4
6 files changed, 25 insertions, 17 deletions
diff --git a/.eslintrc.json b/.eslintrc.json
index c2dd2fc44..770913bf1 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -38,6 +38,7 @@
38 } 38 }
39 } 39 }
40 ], 40 ],
41 "quotes": "off",
41 "@typescript-eslint/indent": [ 42 "@typescript-eslint/indent": [
42 "error", 43 "error",
43 2, 44 2,
@@ -78,7 +79,14 @@
78 "@typescript-eslint/dot-notation": "off", 79 "@typescript-eslint/dot-notation": "off",
79 "@typescript-eslint/method-signature-style": "off", 80 "@typescript-eslint/method-signature-style": "off",
80 "@typescript-eslint/no-base-to-string": "off", 81 "@typescript-eslint/no-base-to-string": "off",
81 "@typescript-eslint/quotes": "off", 82 "@typescript-eslint/quotes": [
83 "error",
84 "single",
85 {
86 "avoidEscape": true,
87 "allowTemplateLiterals": true
88 }
89 ],
82 "@typescript-eslint/no-var-requires": "off", 90 "@typescript-eslint/no-var-requires": "off",
83 "@typescript-eslint/explicit-function-return-type": "off", 91 "@typescript-eslint/explicit-function-return-type": "off",
84 "@typescript-eslint/promise-function-async": "off", 92 "@typescript-eslint/promise-function-async": "off",
diff --git a/server/lib/activitypub/activity.ts b/server/lib/activitypub/activity.ts
index ba2967ce9..1f6ec221e 100644
--- a/server/lib/activitypub/activity.ts
+++ b/server/lib/activitypub/activity.ts
@@ -1,4 +1,4 @@
1import { ActivityType } from "@shared/models" 1import { ActivityType } from '@shared/models'
2 2
3function getAPId (object: string | { id: string }) { 3function getAPId (object: string | { id: string }) {
4 if (typeof object === 'string') return object 4 if (typeof object === 'string') return object
diff --git a/server/middlewares/validators/config.ts b/server/middlewares/validators/config.ts
index 1e839d577..a44fcb854 100644
--- a/server/middlewares/validators/config.ts
+++ b/server/middlewares/validators/config.ts
@@ -30,7 +30,7 @@ const customConfigUpdateValidator = [
30 body('signup.enabled').isBoolean().withMessage('Should have a valid signup enabled boolean'), 30 body('signup.enabled').isBoolean().withMessage('Should have a valid signup enabled boolean'),
31 body('signup.limit').isInt().withMessage('Should have a valid signup limit'), 31 body('signup.limit').isInt().withMessage('Should have a valid signup limit'),
32 body('signup.requiresEmailVerification').isBoolean().withMessage('Should have a valid requiresEmailVerification boolean'), 32 body('signup.requiresEmailVerification').isBoolean().withMessage('Should have a valid requiresEmailVerification boolean'),
33 body('signup.minimumAge').isInt().withMessage("Should have a valid minimum age required"), 33 body('signup.minimumAge').isInt().withMessage('Should have a valid minimum age required'),
34 34
35 body('admin.email').isEmail().withMessage('Should have a valid administrator email'), 35 body('admin.email').isEmail().withMessage('Should have a valid administrator email'),
36 body('contactForm.enabled').isBoolean().withMessage('Should have a valid contact form enabled boolean'), 36 body('contactForm.enabled').isBoolean().withMessage('Should have a valid contact form enabled boolean'),
@@ -38,7 +38,7 @@ const customConfigUpdateValidator = [
38 body('user.videoQuota').custom(isUserVideoQuotaValid).withMessage('Should have a valid video quota'), 38 body('user.videoQuota').custom(isUserVideoQuotaValid).withMessage('Should have a valid video quota'),
39 body('user.videoQuotaDaily').custom(isUserVideoQuotaDailyValid).withMessage('Should have a valid daily video quota'), 39 body('user.videoQuotaDaily').custom(isUserVideoQuotaDailyValid).withMessage('Should have a valid daily video quota'),
40 40
41 body('videoChannels.maxPerUser').isInt().withMessage("Should have a valid maximum amount of video channels per user"), 41 body('videoChannels.maxPerUser').isInt().withMessage('Should have a valid maximum amount of video channels per user'),
42 42
43 body('transcoding.enabled').isBoolean().withMessage('Should have a valid transcoding enabled boolean'), 43 body('transcoding.enabled').isBoolean().withMessage('Should have a valid transcoding enabled boolean'),
44 body('transcoding.allowAdditionalExtensions').isBoolean().withMessage('Should have a valid additional extensions boolean'), 44 body('transcoding.allowAdditionalExtensions').isBoolean().withMessage('Should have a valid additional extensions boolean'),
diff --git a/server/tests/api/moderation/abuses.ts b/server/tests/api/moderation/abuses.ts
index 568fbefcf..0a656b41f 100644
--- a/server/tests/api/moderation/abuses.ts
+++ b/server/tests/api/moderation/abuses.ts
@@ -260,12 +260,12 @@ describe('Test abuses', function () {
260 await waitJobs(servers) 260 await waitJobs(servers)
261 261
262 const body = await commands[1].getAdminList() 262 const body = await commands[1].getAdminList()
263 expect(body.total).to.equal(2, "wrong number of videos returned") 263 expect(body.total).to.equal(2, 'wrong number of videos returned')
264 expect(body.data).to.have.lengthOf(2, "wrong number of videos returned") 264 expect(body.data).to.have.lengthOf(2, 'wrong number of videos returned')
265 265
266 const abuse = body.data[0] 266 const abuse = body.data[0]
267 expect(abuse.id).to.equal(abuseServer2.id, "wrong origin server id for first video") 267 expect(abuse.id).to.equal(abuseServer2.id, 'wrong origin server id for first video')
268 expect(abuse.video.id).to.equal(abuseServer2.video.id, "wrong video id") 268 expect(abuse.video.id).to.equal(abuseServer2.video.id, 'wrong video id')
269 expect(abuse.video.channel).to.exist 269 expect(abuse.video.channel).to.exist
270 expect(abuse.video.deleted).to.be.true 270 expect(abuse.video.deleted).to.be.true
271 }) 271 })
@@ -299,13 +299,13 @@ describe('Test abuses', function () {
299 299
300 const abuseVideo3 = body.data.find(a => a.video.id === video3Id) 300 const abuseVideo3 = body.data.find(a => a.video.id === video3Id)
301 expect(abuseVideo3).to.not.be.undefined 301 expect(abuseVideo3).to.not.be.undefined
302 expect(abuseVideo3.video.countReports).to.equal(1, "wrong reports count for video 3") 302 expect(abuseVideo3.video.countReports).to.equal(1, 'wrong reports count for video 3')
303 expect(abuseVideo3.video.nthReport).to.equal(1, "wrong report position in report list for video 3") 303 expect(abuseVideo3.video.nthReport).to.equal(1, 'wrong report position in report list for video 3')
304 expect(abuseVideo3.countReportsForReportee).to.equal(1, "wrong reports count for reporter on video 3 abuse") 304 expect(abuseVideo3.countReportsForReportee).to.equal(1, 'wrong reports count for reporter on video 3 abuse')
305 expect(abuseVideo3.countReportsForReporter).to.equal(3, "wrong reports count for reportee on video 3 abuse") 305 expect(abuseVideo3.countReportsForReporter).to.equal(3, 'wrong reports count for reportee on video 3 abuse')
306 306
307 const abuseServer1 = abuses.find(a => a.video.id === servers[0].store.videoCreated.id) 307 const abuseServer1 = abuses.find(a => a.video.id === servers[0].store.videoCreated.id)
308 expect(abuseServer1.countReportsForReportee).to.equal(3, "wrong reports count for reporter on video 1 abuse") 308 expect(abuseServer1.countReportsForReportee).to.equal(3, 'wrong reports count for reporter on video 1 abuse')
309 } 309 }
310 }) 310 })
311 311
@@ -327,7 +327,7 @@ describe('Test abuses', function () {
327 { 327 {
328 const abuse = body.data.find(a => a.id === createRes.abuse.id) 328 const abuse = body.data.find(a => a.id === createRes.abuse.id)
329 expect(abuse.reason).to.equals(reason5) 329 expect(abuse.reason).to.equals(reason5)
330 expect(abuse.predefinedReasons).to.deep.equals(predefinedReasons5, "predefined reasons do not match the one reported") 330 expect(abuse.predefinedReasons).to.deep.equals(predefinedReasons5, 'predefined reasons do not match the one reported')
331 expect(abuse.video.startAt).to.equal(1, "starting timestamp doesn't match the one reported") 331 expect(abuse.video.startAt).to.equal(1, "starting timestamp doesn't match the one reported")
332 expect(abuse.video.endAt).to.equal(5, "ending timestamp doesn't match the one reported") 332 expect(abuse.video.endAt).to.equal(5, "ending timestamp doesn't match the one reported")
333 } 333 }
diff --git a/server/tests/feeds/feeds.ts b/server/tests/feeds/feeds.ts
index c7331d544..67a9ed8e0 100644
--- a/server/tests/feeds/feeds.ts
+++ b/server/tests/feeds/feeds.ts
@@ -433,7 +433,7 @@ describe('Test syndication feeds', () => {
433 433
434 { 434 {
435 const body = await servers[0].subscriptions.listVideos({ token: userAccessToken }) 435 const body = await servers[0].subscriptions.listVideos({ token: userAccessToken })
436 expect(body.total).to.equal(2, "there should be 2 videos part of the subscription") 436 expect(body.total).to.equal(2, 'there should be 2 videos part of the subscription')
437 437
438 const query = { accountId: userAccountId, token: userFeedToken } 438 const query = { accountId: userAccountId, token: userFeedToken }
439 const json = await servers[0].feed.getJSON({ feed: 'subscriptions', query, ignoreCache: true }) 439 const json = await servers[0].feed.getJSON({ feed: 'subscriptions', query, ignoreCache: true })
diff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.ts
index 661a4cf35..e2f80c703 100644
--- a/server/tools/peertube-import-videos.ts
+++ b/server/tools/peertube-import-videos.ts
@@ -37,7 +37,7 @@ command
37 .option('--last <last>', 'Process last n elements of returned playlist') 37 .option('--last <last>', 'Process last n elements of returned playlist')
38 .option('--wait-interval <waitInterval>', 'Duration between two video imports (in seconds)', convertIntoMs) 38 .option('--wait-interval <waitInterval>', 'Duration between two video imports (in seconds)', convertIntoMs)
39 .option('-T, --tmpdir <tmpdir>', 'Working directory', __dirname) 39 .option('-T, --tmpdir <tmpdir>', 'Working directory', __dirname)
40 .usage("[global options] [ -- youtube-dl options]") 40 .usage('[global options] [ -- youtube-dl options]')
41 .parse(process.argv) 41 .parse(process.argv)
42 42
43const options = command.opts() 43const options = command.opts()
@@ -97,7 +97,7 @@ async function run (url: string, username: string, password: string) {
97 for (const [ index, info ] of infoArray.entries()) { 97 for (const [ index, info ] of infoArray.entries()) {
98 try { 98 try {
99 if (index > 0 && options.waitInterval && !skipInterval) { 99 if (index > 0 && options.waitInterval && !skipInterval) {
100 log.info("Wait for %d seconds before continuing.", options.waitInterval / 1000) 100 log.info('Wait for %d seconds before continuing.', options.waitInterval / 1000)
101 await wait(options.waitInterval) 101 await wait(options.waitInterval)
102 } 102 }
103 103