diff options
author | Chocobozzz <me@florianbigard.com> | 2020-06-17 10:55:40 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-06-17 11:42:50 +0200 |
commit | faa9d434b4d681837ff2a87603337c2623419669 (patch) | |
tree | 1f3c798dd6fd5f2dcbb019978f063f448c019974 /server | |
parent | 982f2fc9b42537ca40ff29bf62c1ca3692d4b587 (diff) | |
download | PeerTube-faa9d434b4d681837ff2a87603337c2623419669.tar.gz PeerTube-faa9d434b4d681837ff2a87603337c2623419669.tar.zst PeerTube-faa9d434b4d681837ff2a87603337c2623419669.zip |
Update server dependencies
Diffstat (limited to 'server')
-rw-r--r-- | server/controllers/api/users/index.ts | 4 | ||||
-rw-r--r-- | server/controllers/api/videos/import.ts | 2 | ||||
-rw-r--r-- | server/controllers/api/videos/index.ts | 4 | ||||
-rw-r--r-- | server/lib/activitypub/actor.ts | 4 | ||||
-rw-r--r-- | server/lib/activitypub/audience.ts | 2 | ||||
-rw-r--r-- | server/middlewares/oauth.ts | 2 | ||||
-rw-r--r-- | server/middlewares/validators/videos/video-imports.ts | 2 | ||||
-rw-r--r-- | server/models/video/video-abuse.ts | 2 | ||||
-rw-r--r-- | server/models/video/video.ts | 3 | ||||
-rw-r--r-- | server/tests/api/check-params/users.ts | 7 | ||||
-rw-r--r-- | server/tests/api/check-params/video-abuses.ts | 14 | ||||
-rw-r--r-- | server/tests/api/check-params/video-imports.ts | 3 | ||||
-rw-r--r-- | server/tests/api/check-params/video-playlists.ts | 3 | ||||
-rw-r--r-- | server/tests/api/ci-2.sh | 2 | ||||
-rw-r--r-- | server/tests/api/ci-4.sh | 2 | ||||
-rw-r--r-- | server/tests/api/notifications/comments-notifications.ts | 22 | ||||
-rw-r--r-- | server/tests/cli/optimize-old-videos.ts | 10 | ||||
-rw-r--r-- | server/tools/peertube-auth.ts | 2 | ||||
-rw-r--r-- | server/typings/express.ts | 4 |
19 files changed, 31 insertions, 63 deletions
diff --git a/server/controllers/api/users/index.ts b/server/controllers/api/users/index.ts index c488f720b..06a43d7a3 100644 --- a/server/controllers/api/users/index.ts +++ b/server/controllers/api/users/index.ts | |||
@@ -53,15 +53,13 @@ import { tokensRouter } from '@server/controllers/api/users/token' | |||
53 | 53 | ||
54 | const auditLogger = auditLoggerFactory('users') | 54 | const auditLogger = auditLoggerFactory('users') |
55 | 55 | ||
56 | // @ts-ignore | ||
57 | const signupRateLimiter = RateLimit({ | 56 | const signupRateLimiter = RateLimit({ |
58 | windowMs: CONFIG.RATES_LIMIT.SIGNUP.WINDOW_MS, | 57 | windowMs: CONFIG.RATES_LIMIT.SIGNUP.WINDOW_MS, |
59 | max: CONFIG.RATES_LIMIT.SIGNUP.MAX, | 58 | max: CONFIG.RATES_LIMIT.SIGNUP.MAX, |
60 | skipFailedRequests: true | 59 | skipFailedRequests: true |
61 | }) | 60 | }) |
62 | 61 | ||
63 | // @ts-ignore | 62 | const askSendEmailLimiter = RateLimit({ |
64 | const askSendEmailLimiter = new RateLimit({ | ||
65 | windowMs: CONFIG.RATES_LIMIT.ASK_SEND_EMAIL.WINDOW_MS, | 63 | windowMs: CONFIG.RATES_LIMIT.ASK_SEND_EMAIL.WINDOW_MS, |
66 | max: CONFIG.RATES_LIMIT.ASK_SEND_EMAIL.MAX | 64 | max: CONFIG.RATES_LIMIT.ASK_SEND_EMAIL.MAX |
67 | }) | 65 | }) |
diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts index b4f70a086..ec270148d 100644 --- a/server/controllers/api/videos/import.ts +++ b/server/controllers/api/videos/import.ts | |||
@@ -68,7 +68,7 @@ export { | |||
68 | function addVideoImport (req: express.Request, res: express.Response) { | 68 | function addVideoImport (req: express.Request, res: express.Response) { |
69 | if (req.body.targetUrl) return addYoutubeDLImport(req, res) | 69 | if (req.body.targetUrl) return addYoutubeDLImport(req, res) |
70 | 70 | ||
71 | const file = req.files && req.files['torrentfile'] ? req.files['torrentfile'][0] : undefined | 71 | const file = req.files?.['torrentfile']?.[0] |
72 | if (req.body.magnetUri || file) return addTorrentImport(req, res, file) | 72 | if (req.body.magnetUri || file) return addTorrentImport(req, res, file) |
73 | } | 73 | } |
74 | 74 | ||
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index 8048c568c..3ca5a9192 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts | |||
@@ -317,11 +317,11 @@ async function updateVideo (req: express.Request, res: express.Response) { | |||
317 | const hadPrivacyForFederation = videoInstance.hasPrivacyForFederation() | 317 | const hadPrivacyForFederation = videoInstance.hasPrivacyForFederation() |
318 | 318 | ||
319 | // Process thumbnail or create it from the video | 319 | // Process thumbnail or create it from the video |
320 | const thumbnailModel = req.files && req.files['thumbnailfile'] | 320 | const thumbnailModel = req.files?.['thumbnailfile'] |
321 | ? await createVideoMiniatureFromExisting(req.files['thumbnailfile'][0].path, videoInstance, ThumbnailType.MINIATURE, false) | 321 | ? await createVideoMiniatureFromExisting(req.files['thumbnailfile'][0].path, videoInstance, ThumbnailType.MINIATURE, false) |
322 | : undefined | 322 | : undefined |
323 | 323 | ||
324 | const previewModel = req.files && req.files['previewfile'] | 324 | const previewModel = req.files?.['previewfile'] |
325 | ? await createVideoMiniatureFromExisting(req.files['previewfile'][0].path, videoInstance, ThumbnailType.PREVIEW, false) | 325 | ? await createVideoMiniatureFromExisting(req.files['previewfile'][0].path, videoInstance, ThumbnailType.PREVIEW, false) |
326 | : undefined | 326 | : undefined |
327 | 327 | ||
diff --git a/server/lib/activitypub/actor.ts b/server/lib/activitypub/actor.ts index c743dcf3f..0e5742071 100644 --- a/server/lib/activitypub/actor.ts +++ b/server/lib/activitypub/actor.ts | |||
@@ -166,7 +166,7 @@ async function updateActorInstance (actorInstance: ActorModel, attributes: Activ | |||
166 | actorInstance.followersUrl = attributes.followers | 166 | actorInstance.followersUrl = attributes.followers |
167 | actorInstance.followingUrl = attributes.following | 167 | actorInstance.followingUrl = attributes.following |
168 | 168 | ||
169 | if (attributes.endpoints && attributes.endpoints.sharedInbox) { | 169 | if (attributes.endpoints?.sharedInbox) { |
170 | actorInstance.sharedInboxUrl = attributes.endpoints.sharedInbox | 170 | actorInstance.sharedInboxUrl = attributes.endpoints.sharedInbox |
171 | } | 171 | } |
172 | } | 172 | } |
@@ -457,7 +457,7 @@ async function fetchRemoteActor (actorUrl: string): Promise<{ statusCode?: numbe | |||
457 | followersUrl: actorJSON.followers, | 457 | followersUrl: actorJSON.followers, |
458 | followingUrl: actorJSON.following, | 458 | followingUrl: actorJSON.following, |
459 | 459 | ||
460 | sharedInboxUrl: actorJSON.endpoints && actorJSON.endpoints.sharedInbox | 460 | sharedInboxUrl: actorJSON.endpoints?.sharedInbox |
461 | ? actorJSON.endpoints.sharedInbox | 461 | ? actorJSON.endpoints.sharedInbox |
462 | : null | 462 | : null |
463 | }) | 463 | }) |
diff --git a/server/lib/activitypub/audience.ts b/server/lib/activitypub/audience.ts index 551d04ae3..4b30d1f6f 100644 --- a/server/lib/activitypub/audience.ts +++ b/server/lib/activitypub/audience.ts | |||
@@ -55,7 +55,7 @@ async function getActorsInvolvedInVideo (video: MVideoId, t: Transaction) { | |||
55 | 55 | ||
56 | const videoAll = video as VideoModel | 56 | const videoAll = video as VideoModel |
57 | 57 | ||
58 | const videoActor = videoAll.VideoChannel && videoAll.VideoChannel.Account | 58 | const videoActor = videoAll.VideoChannel?.Account |
59 | ? videoAll.VideoChannel.Account.Actor | 59 | ? videoAll.VideoChannel.Account.Actor |
60 | : await ActorModel.loadFromAccountByVideoId(video.id, t) | 60 | : await ActorModel.loadFromAccountByVideoId(video.id, t) |
61 | 61 | ||
diff --git a/server/middlewares/oauth.ts b/server/middlewares/oauth.ts index 9d0eaa51f..b1149174b 100644 --- a/server/middlewares/oauth.ts +++ b/server/middlewares/oauth.ts | |||
@@ -48,7 +48,7 @@ function authenticateSocket (socket: Socket, next: (err?: any) => void) { | |||
48 | function authenticatePromiseIfNeeded (req: express.Request, res: express.Response, authenticateInQuery = false) { | 48 | function authenticatePromiseIfNeeded (req: express.Request, res: express.Response, authenticateInQuery = false) { |
49 | return new Promise(resolve => { | 49 | return new Promise(resolve => { |
50 | // Already authenticated? (or tried to) | 50 | // Already authenticated? (or tried to) |
51 | if (res.locals.oauth && res.locals.oauth.token.User) return resolve() | 51 | if (res.locals.oauth?.token.User) return resolve() |
52 | 52 | ||
53 | if (res.locals.authenticated === false) return res.sendStatus(401) | 53 | if (res.locals.authenticated === false) return res.sendStatus(401) |
54 | 54 | ||
diff --git a/server/middlewares/validators/videos/video-imports.ts b/server/middlewares/validators/videos/video-imports.ts index e3d900a9e..d69aff118 100644 --- a/server/middlewares/validators/videos/video-imports.ts +++ b/server/middlewares/validators/videos/video-imports.ts | |||
@@ -38,7 +38,7 @@ const videoImportAddValidator = getCommonVideoEditAttributes().concat([ | |||
38 | logger.debug('Checking videoImportAddValidator parameters', { parameters: req.body }) | 38 | logger.debug('Checking videoImportAddValidator parameters', { parameters: req.body }) |
39 | 39 | ||
40 | const user = res.locals.oauth.token.User | 40 | const user = res.locals.oauth.token.User |
41 | const torrentFile = req.files && req.files['torrentfile'] ? req.files['torrentfile'][0] : undefined | 41 | const torrentFile = req.files?.['torrentfile'] ? req.files['torrentfile'][0] : undefined |
42 | 42 | ||
43 | if (areValidationErrors(req, res)) return cleanUpReqFiles(req) | 43 | if (areValidationErrors(req, res)) return cleanUpReqFiles(req) |
44 | 44 | ||
diff --git a/server/models/video/video-abuse.ts b/server/models/video/video-abuse.ts index e0cf50b59..40f0ce12b 100644 --- a/server/models/video/video-abuse.ts +++ b/server/models/video/video-abuse.ts | |||
@@ -394,7 +394,7 @@ export class VideoAbuseModel extends Model<VideoAbuseModel> { | |||
394 | name: video.name, | 394 | name: video.name, |
395 | nsfw: video.nsfw, | 395 | nsfw: video.nsfw, |
396 | deleted: !this.Video, | 396 | deleted: !this.Video, |
397 | blacklisted: this.Video && this.Video.isBlacklisted(), | 397 | blacklisted: this.Video?.isBlacklisted() || false, |
398 | thumbnailPath: this.Video?.getMiniatureStaticPath(), | 398 | thumbnailPath: this.Video?.getMiniatureStaticPath(), |
399 | channel: this.Video?.VideoChannel.toFormattedJSON() || this.deletedVideo?.channel | 399 | channel: this.Video?.VideoChannel.toFormattedJSON() || this.deletedVideo?.channel |
400 | }, | 400 | }, |
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 1f590c02d..b4efb76ee 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -1605,8 +1605,7 @@ export class VideoModel extends Model<VideoModel> { | |||
1605 | } | 1605 | } |
1606 | 1606 | ||
1607 | isBlocked () { | 1607 | isBlocked () { |
1608 | return (this.VideoChannel.Account.Actor.Server && this.VideoChannel.Account.Actor.Server.isBlocked()) || | 1608 | return this.VideoChannel.Account.Actor.Server?.isBlocked() || this.VideoChannel.Account.isBlocked() |
1609 | this.VideoChannel.Account.isBlocked() | ||
1610 | } | 1609 | } |
1611 | 1610 | ||
1612 | getQualityFileBy<T extends MVideoWithFile> (this: T, fun: (files: MVideoFile[], it: (file: MVideoFile) => number) => MVideoFile) { | 1611 | getQualityFileBy<T extends MVideoWithFile> (this: T, fun: (files: MVideoFile[], it: (file: MVideoFile) => number) => MVideoFile) { |
diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts index 472fbda43..74f0a2d3f 100644 --- a/server/tests/api/check-params/users.ts +++ b/server/tests/api/check-params/users.ts | |||
@@ -55,8 +55,6 @@ describe('Test users API validators', function () { | |||
55 | let moderatorAccessToken = '' | 55 | let moderatorAccessToken = '' |
56 | let emailPort: number | 56 | let emailPort: number |
57 | let overrideConfig: Object | 57 | let overrideConfig: Object |
58 | // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
59 | let channelId: number | ||
60 | 58 | ||
61 | // --------------------------------------------------------------- | 59 | // --------------------------------------------------------------- |
62 | 60 | ||
@@ -130,11 +128,6 @@ describe('Test users API validators', function () { | |||
130 | } | 128 | } |
131 | 129 | ||
132 | { | 130 | { |
133 | const res = await getMyUserInformation(server.url, server.accessToken) | ||
134 | channelId = res.body.videoChannels[0].id | ||
135 | } | ||
136 | |||
137 | { | ||
138 | const res = await uploadVideo(server.url, server.accessToken, {}) | 131 | const res = await uploadVideo(server.url, server.accessToken, {}) |
139 | videoId = res.body.video.id | 132 | videoId = res.body.video.id |
140 | } | 133 | } |
diff --git a/server/tests/api/check-params/video-abuses.ts b/server/tests/api/check-params/video-abuses.ts index e643cb95e..a3fe00ffb 100644 --- a/server/tests/api/check-params/video-abuses.ts +++ b/server/tests/api/check-params/video-abuses.ts | |||
@@ -141,13 +141,6 @@ describe('Test video abuses API validators', function () { | |||
141 | }) | 141 | }) |
142 | 142 | ||
143 | describe('When updating a video abuse', function () { | 143 | describe('When updating a video abuse', function () { |
144 | const basePath = '/api/v1/videos/' | ||
145 | // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
146 | let path: string | ||
147 | |||
148 | before(() => { | ||
149 | path = basePath + server.video.id + '/abuse/' + videoAbuseId | ||
150 | }) | ||
151 | 144 | ||
152 | it('Should fail with a non authenticated user', async function () { | 145 | it('Should fail with a non authenticated user', async function () { |
153 | await updateVideoAbuse(server.url, 'blabla', server.video.uuid, videoAbuseId, {}, 401) | 146 | await updateVideoAbuse(server.url, 'blabla', server.video.uuid, videoAbuseId, {}, 401) |
@@ -179,13 +172,6 @@ describe('Test video abuses API validators', function () { | |||
179 | }) | 172 | }) |
180 | 173 | ||
181 | describe('When deleting a video abuse', function () { | 174 | describe('When deleting a video abuse', function () { |
182 | const basePath = '/api/v1/videos/' | ||
183 | // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
184 | let path: string | ||
185 | |||
186 | before(() => { | ||
187 | path = basePath + server.video.id + '/abuse/' + videoAbuseId | ||
188 | }) | ||
189 | 175 | ||
190 | it('Should fail with a non authenticated user', async function () { | 176 | it('Should fail with a non authenticated user', async function () { |
191 | await deleteVideoAbuse(server.url, 'blabla', server.video.uuid, videoAbuseId, 401) | 177 | await deleteVideoAbuse(server.url, 'blabla', server.video.uuid, videoAbuseId, 401) |
diff --git a/server/tests/api/check-params/video-imports.ts b/server/tests/api/check-params/video-imports.ts index dbea39c48..3759e47c4 100644 --- a/server/tests/api/check-params/video-imports.ts +++ b/server/tests/api/check-params/video-imports.ts | |||
@@ -29,8 +29,6 @@ describe('Test video imports API validator', function () { | |||
29 | const path = '/api/v1/videos/imports' | 29 | const path = '/api/v1/videos/imports' |
30 | let server: ServerInfo | 30 | let server: ServerInfo |
31 | let userAccessToken = '' | 31 | let userAccessToken = '' |
32 | // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
33 | let accountName: string | ||
34 | let channelId: number | 32 | let channelId: number |
35 | 33 | ||
36 | // --------------------------------------------------------------- | 34 | // --------------------------------------------------------------- |
@@ -50,7 +48,6 @@ describe('Test video imports API validator', function () { | |||
50 | { | 48 | { |
51 | const res = await getMyUserInformation(server.url, server.accessToken) | 49 | const res = await getMyUserInformation(server.url, server.accessToken) |
52 | channelId = res.body.videoChannels[0].id | 50 | channelId = res.body.videoChannels[0].id |
53 | accountName = res.body.account.name + '@' + res.body.account.host | ||
54 | } | 51 | } |
55 | }) | 52 | }) |
56 | 53 | ||
diff --git a/server/tests/api/check-params/video-playlists.ts b/server/tests/api/check-params/video-playlists.ts index 0410e737a..46ec00d46 100644 --- a/server/tests/api/check-params/video-playlists.ts +++ b/server/tests/api/check-params/video-playlists.ts | |||
@@ -36,8 +36,6 @@ describe('Test video playlists API validator', function () { | |||
36 | let privatePlaylistUUID: string | 36 | let privatePlaylistUUID: string |
37 | let watchLaterPlaylistId: number | 37 | let watchLaterPlaylistId: number |
38 | let videoId: number | 38 | let videoId: number |
39 | // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
40 | let videoId2: number | ||
41 | let playlistElementId: number | 39 | let playlistElementId: number |
42 | 40 | ||
43 | // --------------------------------------------------------------- | 41 | // --------------------------------------------------------------- |
@@ -52,7 +50,6 @@ describe('Test video playlists API validator', function () { | |||
52 | 50 | ||
53 | userAccessToken = await generateUserAccessToken(server, 'user1') | 51 | userAccessToken = await generateUserAccessToken(server, 'user1') |
54 | videoId = (await uploadVideoAndGetId({ server, videoName: 'video 1' })).id | 52 | videoId = (await uploadVideoAndGetId({ server, videoName: 'video 1' })).id |
55 | videoId2 = (await uploadVideoAndGetId({ server, videoName: 'video 2' })).id | ||
56 | 53 | ||
57 | { | 54 | { |
58 | const res = await getAccountPlaylistsListWithToken(server.url, server.accessToken, 'root', 0, 5, VideoPlaylistType.WATCH_LATER) | 55 | const res = await getAccountPlaylistsListWithToken(server.url, server.accessToken, 'root', 0, 5, VideoPlaylistType.WATCH_LATER) |
diff --git a/server/tests/api/ci-2.sh b/server/tests/api/ci-2.sh index 52c839d12..016df1cfc 100644 --- a/server/tests/api/ci-2.sh +++ b/server/tests/api/ci-2.sh | |||
@@ -5,6 +5,6 @@ set -eu | |||
5 | serverFiles=$(find server/tests/api/server -type f | grep -v index.ts | xargs echo) | 5 | serverFiles=$(find server/tests/api/server -type f | grep -v index.ts | xargs echo) |
6 | usersFiles=$(find server/tests/api/users -type f | grep -v index.ts | xargs echo) | 6 | usersFiles=$(find server/tests/api/users -type f | grep -v index.ts | xargs echo) |
7 | 7 | ||
8 | MOCHA_PARALLEL=true npm run mocha-parallel-tests -- --max-parallel $1 --timeout 30000 --exit \ | 8 | MOCHA_PARALLEL=true npm run mocha -- --parallel --jobs $1 --timeout 30000 --exit \ |
9 | --require ts-node/register --require tsconfig-paths/register --bail \ | 9 | --require ts-node/register --require tsconfig-paths/register --bail \ |
10 | $serverFiles $usersFiles | 10 | $serverFiles $usersFiles |
diff --git a/server/tests/api/ci-4.sh b/server/tests/api/ci-4.sh index 22785cf33..7d83cbdfc 100644 --- a/server/tests/api/ci-4.sh +++ b/server/tests/api/ci-4.sh | |||
@@ -5,6 +5,6 @@ set -eu | |||
5 | redundancyFiles=$(find server/tests/api/redundancy -type f | grep -v index.ts | xargs echo) | 5 | redundancyFiles=$(find server/tests/api/redundancy -type f | grep -v index.ts | xargs echo) |
6 | activitypubFiles=$(find server/tests/api/activitypub -type f | grep -v index.ts | xargs echo) | 6 | activitypubFiles=$(find server/tests/api/activitypub -type f | grep -v index.ts | xargs echo) |
7 | 7 | ||
8 | MOCHA_PARALLEL=true npm run mocha-parallel-tests -- --max-parallel $1 --timeout 30000 --exit \ | 8 | MOCHA_PARALLEL=true npm run mocha -- --parallel --jobs $1 --timeout 30000 --exit \ |
9 | --require ts-node/register --require tsconfig-paths/register --bail \ | 9 | --require ts-node/register --require tsconfig-paths/register --bail \ |
10 | $redundancyFiles $activitypubFiles | 10 | $redundancyFiles $activitypubFiles |
diff --git a/server/tests/api/notifications/comments-notifications.ts b/server/tests/api/notifications/comments-notifications.ts index cd3ed2f70..dfe846cc4 100644 --- a/server/tests/api/notifications/comments-notifications.ts +++ b/server/tests/api/notifications/comments-notifications.ts | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { cleanupTests, getVideoCommentThreads, getVideoThreadComments, updateMyUser, wait } from '../../../../shared/extra-utils' | 5 | import { cleanupTests, getVideoCommentThreads, getVideoThreadComments, updateMyUser } from '../../../../shared/extra-utils' |
6 | import { ServerInfo, uploadVideo } from '../../../../shared/extra-utils/index' | 6 | import { ServerInfo, uploadVideo } from '../../../../shared/extra-utils/index' |
7 | import { MockSmtpServer } from '../../../../shared/extra-utils/miscs/email' | 7 | import { MockSmtpServer } from '../../../../shared/extra-utils/miscs/email' |
8 | import { waitJobs } from '../../../../shared/extra-utils/server/jobs' | 8 | import { waitJobs } from '../../../../shared/extra-utils/server/jobs' |
@@ -56,7 +56,7 @@ describe('Test comments notifications', function () { | |||
56 | const resComment = await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, 'comment') | 56 | const resComment = await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, 'comment') |
57 | const commentId = resComment.body.comment.id | 57 | const commentId = resComment.body.comment.id |
58 | 58 | ||
59 | await wait(500) | 59 | await waitJobs(servers) |
60 | await checkNewCommentOnMyVideo(baseParams, uuid, commentId, commentId, 'absence') | 60 | await checkNewCommentOnMyVideo(baseParams, uuid, commentId, commentId, 'absence') |
61 | }) | 61 | }) |
62 | 62 | ||
@@ -69,7 +69,7 @@ describe('Test comments notifications', function () { | |||
69 | const resComment = await addVideoCommentThread(servers[0].url, userAccessToken, uuid, 'comment') | 69 | const resComment = await addVideoCommentThread(servers[0].url, userAccessToken, uuid, 'comment') |
70 | const commentId = resComment.body.comment.id | 70 | const commentId = resComment.body.comment.id |
71 | 71 | ||
72 | await wait(500) | 72 | await waitJobs(servers) |
73 | await checkNewCommentOnMyVideo(baseParams, uuid, commentId, commentId, 'absence') | 73 | await checkNewCommentOnMyVideo(baseParams, uuid, commentId, commentId, 'absence') |
74 | }) | 74 | }) |
75 | 75 | ||
@@ -84,7 +84,7 @@ describe('Test comments notifications', function () { | |||
84 | const resComment = await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, 'comment') | 84 | const resComment = await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, 'comment') |
85 | const commentId = resComment.body.comment.id | 85 | const commentId = resComment.body.comment.id |
86 | 86 | ||
87 | await wait(500) | 87 | await waitJobs(servers) |
88 | await checkNewCommentOnMyVideo(baseParams, uuid, commentId, commentId, 'absence') | 88 | await checkNewCommentOnMyVideo(baseParams, uuid, commentId, commentId, 'absence') |
89 | 89 | ||
90 | await removeAccountFromAccountBlocklist(servers[0].url, userAccessToken, 'root') | 90 | await removeAccountFromAccountBlocklist(servers[0].url, userAccessToken, 'root') |
@@ -99,7 +99,7 @@ describe('Test comments notifications', function () { | |||
99 | const resComment = await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, 'comment') | 99 | const resComment = await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, 'comment') |
100 | const commentId = resComment.body.comment.id | 100 | const commentId = resComment.body.comment.id |
101 | 101 | ||
102 | await wait(500) | 102 | await waitJobs(servers) |
103 | await checkNewCommentOnMyVideo(baseParams, uuid, commentId, commentId, 'presence') | 103 | await checkNewCommentOnMyVideo(baseParams, uuid, commentId, commentId, 'presence') |
104 | }) | 104 | }) |
105 | 105 | ||
@@ -134,7 +134,7 @@ describe('Test comments notifications', function () { | |||
134 | const resComment = await addVideoCommentReply(servers[0].url, servers[0].accessToken, uuid, threadId, 'reply') | 134 | const resComment = await addVideoCommentReply(servers[0].url, servers[0].accessToken, uuid, threadId, 'reply') |
135 | const commentId = resComment.body.comment.id | 135 | const commentId = resComment.body.comment.id |
136 | 136 | ||
137 | await wait(500) | 137 | await waitJobs(servers) |
138 | await checkNewCommentOnMyVideo(baseParams, uuid, commentId, threadId, 'presence') | 138 | await checkNewCommentOnMyVideo(baseParams, uuid, commentId, threadId, 'presence') |
139 | }) | 139 | }) |
140 | 140 | ||
@@ -200,7 +200,7 @@ describe('Test comments notifications', function () { | |||
200 | const resComment = await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, '@user_1 hello') | 200 | const resComment = await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, '@user_1 hello') |
201 | const commentId = resComment.body.comment.id | 201 | const commentId = resComment.body.comment.id |
202 | 202 | ||
203 | await wait(500) | 203 | await waitJobs(servers) |
204 | await checkCommentMention(baseParams, uuid, commentId, commentId, 'super root name', 'absence') | 204 | await checkCommentMention(baseParams, uuid, commentId, commentId, 'super root name', 'absence') |
205 | }) | 205 | }) |
206 | 206 | ||
@@ -213,7 +213,7 @@ describe('Test comments notifications', function () { | |||
213 | const resComment = await addVideoCommentThread(servers[0].url, userAccessToken, uuid, '@user_1 hello') | 213 | const resComment = await addVideoCommentThread(servers[0].url, userAccessToken, uuid, '@user_1 hello') |
214 | const commentId = resComment.body.comment.id | 214 | const commentId = resComment.body.comment.id |
215 | 215 | ||
216 | await wait(500) | 216 | await waitJobs(servers) |
217 | await checkCommentMention(baseParams, uuid, commentId, commentId, 'super root name', 'absence') | 217 | await checkCommentMention(baseParams, uuid, commentId, commentId, 'super root name', 'absence') |
218 | }) | 218 | }) |
219 | 219 | ||
@@ -228,7 +228,7 @@ describe('Test comments notifications', function () { | |||
228 | const resComment = await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, '@user_1 hello') | 228 | const resComment = await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, '@user_1 hello') |
229 | const commentId = resComment.body.comment.id | 229 | const commentId = resComment.body.comment.id |
230 | 230 | ||
231 | await wait(500) | 231 | await waitJobs(servers) |
232 | await checkCommentMention(baseParams, uuid, commentId, commentId, 'super root name', 'absence') | 232 | await checkCommentMention(baseParams, uuid, commentId, commentId, 'super root name', 'absence') |
233 | 233 | ||
234 | await removeAccountFromAccountBlocklist(servers[0].url, userAccessToken, 'root') | 234 | await removeAccountFromAccountBlocklist(servers[0].url, userAccessToken, 'root') |
@@ -257,13 +257,13 @@ describe('Test comments notifications', function () { | |||
257 | const resThread = await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, '@user_1 hello 1') | 257 | const resThread = await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, '@user_1 hello 1') |
258 | const threadId = resThread.body.comment.id | 258 | const threadId = resThread.body.comment.id |
259 | 259 | ||
260 | await wait(500) | 260 | await waitJobs(servers) |
261 | await checkCommentMention(baseParams, uuid, threadId, threadId, 'super root name', 'presence') | 261 | await checkCommentMention(baseParams, uuid, threadId, threadId, 'super root name', 'presence') |
262 | 262 | ||
263 | const resComment = await addVideoCommentReply(servers[0].url, servers[0].accessToken, uuid, threadId, 'hello 2 @user_1') | 263 | const resComment = await addVideoCommentReply(servers[0].url, servers[0].accessToken, uuid, threadId, 'hello 2 @user_1') |
264 | const commentId = resComment.body.comment.id | 264 | const commentId = resComment.body.comment.id |
265 | 265 | ||
266 | await wait(500) | 266 | await waitJobs(servers) |
267 | await checkCommentMention(baseParams, uuid, commentId, threadId, 'super root name', 'presence') | 267 | await checkCommentMention(baseParams, uuid, commentId, threadId, 'super root name', 'presence') |
268 | }) | 268 | }) |
269 | 269 | ||
diff --git a/server/tests/cli/optimize-old-videos.ts b/server/tests/cli/optimize-old-videos.ts index e2e13598f..43f9b7f55 100644 --- a/server/tests/cli/optimize-old-videos.ts +++ b/server/tests/cli/optimize-old-videos.ts | |||
@@ -28,10 +28,6 @@ const expect = chai.expect | |||
28 | 28 | ||
29 | describe('Test optimize old videos', function () { | 29 | describe('Test optimize old videos', function () { |
30 | let servers: ServerInfo[] = [] | 30 | let servers: ServerInfo[] = [] |
31 | // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
32 | let video1UUID: string | ||
33 | // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
34 | let video2UUID: string | ||
35 | 31 | ||
36 | before(async function () { | 32 | before(async function () { |
37 | this.timeout(200000) | 33 | this.timeout(200000) |
@@ -52,10 +48,8 @@ describe('Test optimize old videos', function () { | |||
52 | } | 48 | } |
53 | 49 | ||
54 | // Upload two videos for our needs | 50 | // Upload two videos for our needs |
55 | const res1 = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video1', fixture: tempFixturePath }) | 51 | await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video1', fixture: tempFixturePath }) |
56 | video1UUID = res1.body.video.uuid | 52 | await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video2', fixture: tempFixturePath }) |
57 | const res2 = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video2', fixture: tempFixturePath }) | ||
58 | video2UUID = res2.body.video.uuid | ||
59 | 53 | ||
60 | await waitJobs(servers) | 54 | await waitJobs(servers) |
61 | }) | 55 | }) |
diff --git a/server/tools/peertube-auth.ts b/server/tools/peertube-auth.ts index c1a804f83..74bce7314 100644 --- a/server/tools/peertube-auth.ts +++ b/server/tools/peertube-auth.ts | |||
@@ -28,7 +28,7 @@ async function delInstance (url: string) { | |||
28 | async function setInstance (url: string, username: string, password: string, isDefault: boolean) { | 28 | async function setInstance (url: string, username: string, password: string, isDefault: boolean) { |
29 | const [ settings, netrc ] = await Promise.all([ getSettings(), getNetrc() ]) | 29 | const [ settings, netrc ] = await Promise.all([ getSettings(), getNetrc() ]) |
30 | 30 | ||
31 | if (settings.remotes.indexOf(url) === -1) { | 31 | if (settings.remotes.includes(url) === false) { |
32 | settings.remotes.push(url) | 32 | settings.remotes.push(url) |
33 | } | 33 | } |
34 | 34 | ||
diff --git a/server/typings/express.ts b/server/typings/express.ts index 5973496f1..15d445c2d 100644 --- a/server/typings/express.ts +++ b/server/typings/express.ts | |||
@@ -32,6 +32,10 @@ import { UserRole } from '@shared/models' | |||
32 | import { RegisterServerAuthExternalOptions } from '@shared/models/plugins/register-server-auth.model' | 32 | import { RegisterServerAuthExternalOptions } from '@shared/models/plugins/register-server-auth.model' |
33 | 33 | ||
34 | declare module 'express' { | 34 | declare module 'express' { |
35 | interface Request { | ||
36 | query: any | ||
37 | } | ||
38 | |||
35 | interface Response { | 39 | interface Response { |
36 | 40 | ||
37 | locals: { | 41 | locals: { |