ActivityPub-federated video streaming platform using P2P directly in your web browser
checkBadSortPagination -> checkBadSort
Chocobozzz674ba3ddfb39
diff --git a/packages/tests/src/api/check-params/abuses.ts b/packages/tests/src/api/check-params/abuses.tsindex 1effc82b1b..d2f8a7c0e3 100644--- a/packages/tests/src/api/check-params/abuses.ts+++ b/packages/tests/src/api/check-params/abuses.ts@@ -1,6 +1,6 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { checkBadCountPagination, checkBadSort, checkBadStartPagination } from '@tests/shared/checks.js'import { AbuseCreate, AbuseState, HttpStatusCode } from '@peertube/peertube-models'import {AbusesCommand,@@ -55,7 +55,7 @@ describe('Test abuses API validators', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path, server.accessToken)+ await checkBadSort(server.url, path, server.accessToken)})it('Should fail with a non authenticated user', async function () {@@ -122,7 +122,7 @@ describe('Test abuses API validators', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path, userToken)+ await checkBadSort(server.url, path, userToken)})it('Should fail with a non authenticated user', async function () {@@ -284,7 +284,6 @@ describe('Test abuses API validators', function () {})describe('When updating an abuse', function () {-it('Should fail with a non authenticated user', async function () {await command.update({ token: 'blabla', abuseId, body: {}, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })})@@ -339,7 +338,6 @@ describe('Test abuses API validators', function () {})describe('When listing abuse messages', function () {-it('Should fail with an invalid abuse id', async function () {await command.listMessages({ token: userToken, abuseId: 888, expectedStatus: HttpStatusCode.NOT_FOUND_404 })})@@ -380,7 +378,6 @@ describe('Test abuses API validators', function () {})describe('When deleting a video abuse', function () {-it('Should fail with a non authenticated user', async function () {await command.delete({ token: 'blabla', abuseId, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })})diff --git a/packages/tests/src/api/check-params/accounts.ts b/packages/tests/src/api/check-params/accounts.tsindex 87810bbd32..c3695827b1 100644--- a/packages/tests/src/api/check-params/accounts.ts+++ b/packages/tests/src/api/check-params/accounts.ts@@ -1,6 +1,6 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { checkBadCountPagination, checkBadSort, checkBadStartPagination } from '@tests/shared/checks.js'import { HttpStatusCode } from '@peertube/peertube-models'import { cleanupTests, createSingleServer, PeerTubeServer } from '@peertube/peertube-server-commands'@@ -26,12 +26,11 @@ describe('Test accounts API validators', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path, server.accessToken)+ await checkBadSort(server.url, path, server.accessToken)})})describe('When getting an account', function () {-it('Should return 404 with a non existing name', async function () {await server.accounts.get({ accountName: 'arfaze', expectedStatus: HttpStatusCode.NOT_FOUND_404 })})diff --git a/packages/tests/src/api/check-params/blocklist.ts b/packages/tests/src/api/check-params/blocklist.tsindex fcd6d08f8c..3c6c362018 100644--- a/packages/tests/src/api/check-params/blocklist.ts+++ b/packages/tests/src/api/check-params/blocklist.ts@@ -1,6 +1,6 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { checkBadCountPagination, checkBadSort, checkBadStartPagination } from '@tests/shared/checks.js'import { HttpStatusCode } from '@peertube/peertube-models'import {cleanupTests,@@ -37,7 +37,6 @@ describe('Test blocklist API validators', function () {// ---------------------------------------------------------------describe('When managing user blocklist', function () {-describe('When managing user accounts blocklist', function () {const path = '/api/v1/users/me/blocklist/accounts'@@ -59,7 +58,7 @@ describe('Test blocklist API validators', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path, server.accessToken)+ await checkBadSort(server.url, path, server.accessToken)})})@@ -154,7 +153,7 @@ describe('Test blocklist API validators', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path, server.accessToken)+ await checkBadSort(server.url, path, server.accessToken)})})@@ -230,7 +229,6 @@ describe('Test blocklist API validators', function () {})describe('When managing server blocklist', function () {-describe('When managing server accounts blocklist', function () {const path = '/api/v1/server/blocklist/accounts'@@ -261,7 +259,7 @@ describe('Test blocklist API validators', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path, server.accessToken)+ await checkBadSort(server.url, path, server.accessToken)})})@@ -384,7 +382,7 @@ describe('Test blocklist API validators', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path, server.accessToken)+ await checkBadSort(server.url, path, server.accessToken)})})diff --git a/packages/tests/src/api/check-params/channel-activities.ts b/packages/tests/src/api/check-params/channel-activities.tsindex 7606898d49..9f6c447168 100644--- a/packages/tests/src/api/check-params/channel-activities.ts+++ b/packages/tests/src/api/check-params/channel-activities.ts@@ -6,7 +6,7 @@ import {PeerTubeServer,setAccessTokensToServers} from '@peertube/peertube-server-commands'-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { checkBadCountPagination, checkBadSort, checkBadStartPagination } from '@tests/shared/checks.js'describe('Test video channel activities API validator', () => {const path = '/api/v1/video-channels/root_channel/activities'@@ -36,7 +36,7 @@ describe('Test video channel activities API validator', () => {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path, server.accessToken)+ await checkBadSort(server.url, path, server.accessToken)})it('Should fail without authentication', async function () {diff --git a/packages/tests/src/api/check-params/channel-syncs.ts b/packages/tests/src/api/check-params/channel-syncs.tsindex c0cafe2516..7e71f8dd75 100644--- a/packages/tests/src/api/check-params/channel-syncs.ts+++ b/packages/tests/src/api/check-params/channel-syncs.ts@@ -1,4 +1,4 @@-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { checkBadCountPagination, checkBadSort, checkBadStartPagination } from '@tests/shared/checks.js'import { FIXTURE_URLS } from '@tests/shared/fixture-urls.js'import { HttpStatusCode, VideoChannelSyncCreate } from '@peertube/peertube-models'import {@@ -222,7 +222,7 @@ describe('Test video channel sync API validator', () => {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, myPath, server.accessToken)+ await checkBadSort(server.url, myPath, server.accessToken)})it('Should succeed with the correct parameters', async function () {diff --git a/packages/tests/src/api/check-params/channels.ts b/packages/tests/src/api/check-params/channels.tsindex 30cec6449d..80ff739466 100644--- a/packages/tests/src/api/check-params/channels.ts+++ b/packages/tests/src/api/check-params/channels.ts@@ -14,7 +14,7 @@ import {PeerTubeServer,setAccessTokensToServers} from '@peertube/peertube-server-commands'-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { checkBadCountPagination, checkBadSort, checkBadStartPagination } from '@tests/shared/checks.js'import { expect } from 'chai'describe('Test video channels API validator', function () {@@ -63,7 +63,7 @@ describe('Test video channels API validator', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, videoChannelPath, server.accessToken)+ await checkBadSort(server.url, videoChannelPath, server.accessToken)})})@@ -79,7 +79,7 @@ describe('Test video channels API validator', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, accountChannelPath, server.accessToken)+ await checkBadSort(server.url, accountChannelPath, server.accessToken)})it('Should fail with a unknown account', async function () {@@ -341,7 +341,7 @@ describe('Test video channels API validator', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path, server.accessToken)+ await checkBadSort(server.url, path, server.accessToken)})it('Should fail with a unauthenticated user', async function () {diff --git a/packages/tests/src/api/check-params/follows.ts b/packages/tests/src/api/check-params/follows.tsindex e92a3acd6e..1a2661bd90 100644--- a/packages/tests/src/api/check-params/follows.ts+++ b/packages/tests/src/api/check-params/follows.ts@@ -1,6 +1,6 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { checkBadCountPagination, checkBadSort, checkBadStartPagination } from '@tests/shared/checks.js'import { HttpStatusCode } from '@peertube/peertube-models'import {cleanupTests,@@ -127,7 +127,7 @@ describe('Test server follows API validators', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path)+ await checkBadSort(server.url, path)})it('Should fail with an incorrect state', async function () {@@ -175,7 +175,7 @@ describe('Test server follows API validators', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path)+ await checkBadSort(server.url, path)})it('Should fail with an incorrect actor type', async function () {diff --git a/packages/tests/src/api/check-params/jobs.ts b/packages/tests/src/api/check-params/jobs.tsindex 331d58c6a6..23f52122ec 100644--- a/packages/tests/src/api/check-params/jobs.ts+++ b/packages/tests/src/api/check-params/jobs.ts@@ -1,6 +1,6 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { checkBadCountPagination, checkBadSort, checkBadStartPagination } from '@tests/shared/checks.js'import { HttpStatusCode } from '@peertube/peertube-models'import {cleanupTests,@@ -34,7 +34,6 @@ describe('Test jobs API validators', function () {})describe('When listing jobs', function () {-it('Should fail with a bad state', async function () {await makeGetRequest({url: server.url,@@ -63,7 +62,7 @@ describe('Test jobs API validators', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path, server.accessToken)+ await checkBadSort(server.url, path, server.accessToken)})it('Should fail with a non authenticated user', async function () {diff --git a/packages/tests/src/api/check-params/live.ts b/packages/tests/src/api/check-params/live.tsindex 4b093138b2..6616737756 100644--- a/packages/tests/src/api/check-params/live.ts+++ b/packages/tests/src/api/check-params/live.ts@@ -22,7 +22,7 @@ import {setAccessTokensToServers,stopFfmpeg} from '@peertube/peertube-server-commands'-import { checkBadSortPagination } from '@tests/shared/checks.js'+import { checkBadSort } from '@tests/shared/checks.js'import { expect } from 'chai'describe('Test video lives API validator', function () {@@ -449,7 +449,7 @@ describe('Test video lives API validator', function () {describe('When getting live sessions', function () {it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path, server.accessToken)+ await checkBadSort(server.url, path, server.accessToken)})it('Should fail with a bad access token', async function () {diff --git a/packages/tests/src/api/check-params/plugins.ts b/packages/tests/src/api/check-params/plugins.tsindex dec60b2e2c..7124ad6ee1 100644--- a/packages/tests/src/api/check-params/plugins.ts+++ b/packages/tests/src/api/check-params/plugins.ts@@ -1,6 +1,6 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { checkBadCountPagination, checkBadSort, checkBadStartPagination } from '@tests/shared/checks.js'import { HttpStatusCode, PeerTubePlugin, PluginType } from '@peertube/peertube-models'import {cleanupTests,@@ -189,7 +189,7 @@ describe('Test server plugins API validators', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path, server.accessToken)+ await checkBadSort(server.url, path, server.accessToken)})it('Should fail with an invalid plugin type', async function () {@@ -260,7 +260,7 @@ describe('Test server plugins API validators', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path, server.accessToken)+ await checkBadSort(server.url, path, server.accessToken)})it('Should fail with an invalid plugin type', async function () {diff --git a/packages/tests/src/api/check-params/redundancy.ts b/packages/tests/src/api/check-params/redundancy.tsindex 2c5d8be8f8..f7e79bc226 100644--- a/packages/tests/src/api/check-params/redundancy.ts+++ b/packages/tests/src/api/check-params/redundancy.ts@@ -1,6 +1,6 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { checkBadCountPagination, checkBadSort, checkBadStartPagination } from '@tests/shared/checks.js'import { HttpStatusCode, VideoCreateResult } from '@peertube/peertube-models'import {cleanupTests,@@ -76,7 +76,7 @@ describe('Test server redundancy API validators', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(url, path, servers[0].accessToken)+ await checkBadSort(url, path, servers[0].accessToken)})it('Should fail with a bad target', async function () {diff --git a/packages/tests/src/api/check-params/registrations.ts b/packages/tests/src/api/check-params/registrations.tsindex 4cf5cdc4ae..a142ab8d68 100644--- a/packages/tests/src/api/check-params/registrations.ts+++ b/packages/tests/src/api/check-params/registrations.ts@@ -1,6 +1,6 @@import { omit } from '@peertube/peertube-core-utils'import { HttpStatusCode, HttpStatusCodeType, UserRole } from '@peertube/peertube-models'-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { checkBadCountPagination, checkBadSort, checkBadStartPagination } from '@tests/shared/checks.js'import {cleanupTests,createSingleServer,@@ -28,7 +28,6 @@ describe('Test registrations API validators', function () {await setDefaultChannelAvatar([ server ])await server.config.enableSignup(false)-;({ token: moderatorToken } = await server.users.generate('moderator', UserRole.MODERATOR));({ token: userToken } = await server.users.generate('user', UserRole.USER))})@@ -319,7 +318,6 @@ describe('Test registrations API validators', function () {this.timeout(60000)await server.config.enableSignup(true)-;({ id: id1 } = await server.registrations.requestRegistration({ username: 'request_2', registrationReason: 'toto' }));({ id: id2 } = await server.registrations.requestRegistration({ username: 'request_3', registrationReason: 'toto' }))})@@ -421,7 +419,7 @@ describe('Test registrations API validators', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path, server.accessToken)+ await checkBadSort(server.url, path, server.accessToken)})it('Should fail with a non authenticated user', async function () {diff --git a/packages/tests/src/api/check-params/runners.ts b/packages/tests/src/api/check-params/runners.tsindex c40a6b4b40..da6ad7434c 100644--- a/packages/tests/src/api/check-params/runners.ts+++ b/packages/tests/src/api/check-params/runners.ts@@ -23,7 +23,7 @@ import {VideoStudioCommand,waitJobs} from '@peertube/peertube-server-commands'-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { checkBadCountPagination, checkBadSort, checkBadStartPagination } from '@tests/shared/checks.js'import { basename } from 'path'const badUUID = '910ec12a-d9e6-458b-a274-0abb655f9464'@@ -132,7 +132,7 @@ describe('Test managing runners', function () {})it('Should fail to list with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path, server.accessToken)+ await checkBadSort(server.url, path, server.accessToken)})it('Should succeed to list with the correct params', async function () {@@ -237,7 +237,7 @@ describe('Test managing runners', function () {})it('Should fail to list with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path, server.accessToken)+ await checkBadSort(server.url, path, server.accessToken)})it('Should fail with an invalid state', async function () {@@ -310,7 +310,7 @@ describe('Test managing runners', function () {})it('Should fail to list with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path, server.accessToken)+ await checkBadSort(server.url, path, server.accessToken)})it('Should fail with an invalid state', async function () {diff --git a/packages/tests/src/api/check-params/search.ts b/packages/tests/src/api/check-params/search.tsindex 0dfe6317fe..75af2d4cf1 100644--- a/packages/tests/src/api/check-params/search.ts+++ b/packages/tests/src/api/check-params/search.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { HttpStatusCode } from '@peertube/peertube-models'-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { checkBadCountPagination, checkBadSort, checkBadStartPagination } from '@tests/shared/checks.js'import {cleanupTests,createSingleServer,@@ -51,7 +51,7 @@ describe('Test videos API validator', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path, null, query)+ await checkBadSort(server.url, path, null, query)})it('Should succeed with the correct parameters', async function () {@@ -172,7 +172,7 @@ describe('Test videos API validator', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path, null, query)+ await checkBadSort(server.url, path, null, query)})it('Should fail with an invalid host', async function () {@@ -206,7 +206,7 @@ describe('Test videos API validator', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path, null, query)+ await checkBadSort(server.url, path, null, query)})it('Should fail with an invalid host', async function () {@@ -223,7 +223,6 @@ describe('Test videos API validator', function () {})describe('Search target', function () {-it('Should fail/succeed depending on the search target', async function () {const query = { search: 'coucou' }const paths = [diff --git a/packages/tests/src/api/check-params/token-session.ts b/packages/tests/src/api/check-params/token-session.tsindex e5644fd3e0..e957c1f53d 100644--- a/packages/tests/src/api/check-params/token-session.ts+++ b/packages/tests/src/api/check-params/token-session.ts@@ -8,7 +8,7 @@ import {PeerTubeServer,setAccessTokensToServers} from '@peertube/peertube-server-commands'-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { checkBadCountPagination, checkBadSort, checkBadStartPagination } from '@tests/shared/checks.js'describe('Test token session API validators', function () {let server: PeerTubeServer@@ -45,7 +45,7 @@ describe('Test token session API validators', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path, userToken1)+ await checkBadSort(server.url, path, userToken1)})it('Should fail with an unknown user', async function () {diff --git a/packages/tests/src/api/check-params/user-me.ts b/packages/tests/src/api/check-params/user-me.tsindex 737806d7ae..70c5024d3a 100644--- a/packages/tests/src/api/check-params/user-me.ts+++ b/packages/tests/src/api/check-params/user-me.ts@@ -12,7 +12,7 @@ import {setAccessTokensToServers,UsersCommand} from '@peertube/peertube-server-commands'-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { checkBadCountPagination, checkBadSort, checkBadStartPagination } from '@tests/shared/checks.js'import { MockSmtpServer } from '@tests/shared/mock-servers/index.js'describe('Test my user API validators', function () {@@ -449,7 +449,7 @@ describe('Test my user API validators', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path, userToken)+ await checkBadSort(server.url, path, userToken)})it('Should fail with a unauthenticated user', async function () {@@ -487,7 +487,7 @@ describe('Test my user API validators', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path, userToken)+ await checkBadSort(server.url, path, userToken)})it('Should fail with a unauthenticated user', async function () {diff --git a/packages/tests/src/api/check-params/user-notifications.ts b/packages/tests/src/api/check-params/user-notifications.tsindex 8f0782f640..d9ab1bc226 100644--- a/packages/tests/src/api/check-params/user-notifications.ts+++ b/packages/tests/src/api/check-params/user-notifications.ts@@ -1,7 +1,7 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */import { io } from 'socket.io-client'-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { checkBadCountPagination, checkBadSort, checkBadStartPagination } from '@tests/shared/checks.js'import { wait } from '@peertube/peertube-core-utils'import { HttpStatusCode, UserNotificationSetting, UserNotificationSettingValue, UserNotificationType } from '@peertube/peertube-models'import {@@ -39,7 +39,7 @@ describe('Test user notifications API validators', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path, server.accessToken)+ await checkBadSort(server.url, path, server.accessToken)})it('Should fail with an incorrect typeOneOf parameter', async function () {diff --git a/packages/tests/src/api/check-params/user-subscriptions.ts b/packages/tests/src/api/check-params/user-subscriptions.tsindex e97f513a0b..ba34697cb4 100644--- a/packages/tests/src/api/check-params/user-subscriptions.ts+++ b/packages/tests/src/api/check-params/user-subscriptions.ts@@ -11,7 +11,7 @@ import {waitJobs} from '@peertube/peertube-server-commands'import { HttpStatusCode } from '@peertube/peertube-models'-import { checkBadStartPagination, checkBadCountPagination, checkBadSortPagination } from '@tests/shared/checks.js'+import { checkBadStartPagination, checkBadCountPagination, checkBadSort } from '@tests/shared/checks.js'describe('Test user subscriptions API validators', function () {const path = '/api/v1/users/me/subscriptions'@@ -45,7 +45,7 @@ describe('Test user subscriptions API validators', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path, server.accessToken)+ await checkBadSort(server.url, path, server.accessToken)})it('Should fail with a non authenticated user', async function () {@@ -78,7 +78,7 @@ describe('Test user subscriptions API validators', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path, server.accessToken)+ await checkBadSort(server.url, path, server.accessToken)})it('Should fail with a non authenticated user', async function () {diff --git a/packages/tests/src/api/check-params/users-admin.ts b/packages/tests/src/api/check-params/users-admin.tsindex 97398bc4e2..67c64cab49 100644--- a/packages/tests/src/api/check-params/users-admin.ts+++ b/packages/tests/src/api/check-params/users-admin.ts@@ -1,6 +1,6 @@/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { checkBadCountPagination, checkBadSort, checkBadStartPagination } from '@tests/shared/checks.js'import { MockSmtpServer } from '@tests/shared/mock-servers/index.js'import { omit } from '@peertube/peertube-core-utils'import { HttpStatusCode, UserAdminFlag, UserRole } from '@peertube/peertube-models'@@ -67,7 +67,7 @@ describe('Test users admin API validators', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path, server.accessToken)+ await checkBadSort(server.url, path, server.accessToken)})it('Should fail with a non authenticated user', async function () {diff --git a/packages/tests/src/api/check-params/video-blacklist.ts b/packages/tests/src/api/check-params/video-blacklist.tsindex e52561d874..694ddc7c2c 100644--- a/packages/tests/src/api/check-params/video-blacklist.ts+++ b/packages/tests/src/api/check-params/video-blacklist.ts@@ -12,7 +12,7 @@ import {setAccessTokensToServers,waitJobs} from '@peertube/peertube-server-commands'-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { checkBadCountPagination, checkBadSort, checkBadStartPagination } from '@tests/shared/checks.js'import { expect } from 'chai'describe('Test video blacklist API validators', function () {@@ -266,7 +266,7 @@ describe('Test video blacklist API validators', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(servers[0].url, basePath, servers[0].accessToken)+ await checkBadSort(servers[0].url, basePath, servers[0].accessToken)})it('Should fail with an invalid type', async function () {diff --git a/packages/tests/src/api/check-params/video-comments.ts b/packages/tests/src/api/check-params/video-comments.tsindex 99c54ed6fa..8c58fca536 100644--- a/packages/tests/src/api/check-params/video-comments.ts+++ b/packages/tests/src/api/check-params/video-comments.ts@@ -11,7 +11,7 @@ import {setAccessTokensToServers,setDefaultVideoChannel} from '@peertube/peertube-server-commands'-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { checkBadCountPagination, checkBadSort, checkBadStartPagination } from '@tests/shared/checks.js'import { expect } from 'chai'describe('Test video comments API validator', function () {@@ -85,7 +85,7 @@ describe('Test video comments API validator', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, pathThread, server.accessToken)+ await checkBadSort(server.url, pathThread, server.accessToken)})it('Should fail with an incorrect video', async function () {@@ -457,7 +457,7 @@ describe('Test video comments API validator', function () {for (const path of paths) {await checkBadStartPagination(server.url, path, server.accessToken)await checkBadCountPagination(server.url, path, server.accessToken)- await checkBadSortPagination(server.url, path, server.accessToken)+ await checkBadSort(server.url, path, server.accessToken)}})diff --git a/packages/tests/src/api/check-params/video-imports.ts b/packages/tests/src/api/check-params/video-imports.tsindex 8eb47f6c35..766ff8b4cd 100644--- a/packages/tests/src/api/check-params/video-imports.ts+++ b/packages/tests/src/api/check-params/video-imports.ts@@ -14,7 +14,7 @@ import {setDefaultVideoChannel,waitJobs} from '@peertube/peertube-server-commands'-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { checkBadCountPagination, checkBadSort, checkBadStartPagination } from '@tests/shared/checks.js'import { FIXTURE_URLS } from '@tests/shared/fixture-urls.js'import { SQLCommand } from '@tests/shared/sql-command.js'@@ -60,7 +60,7 @@ describe('Test video imports API validator', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, myPath, server.accessToken)+ await checkBadSort(server.url, myPath, server.accessToken)})it('Should fail with a bad id param', async function () {diff --git a/packages/tests/src/api/check-params/video-passwords.ts b/packages/tests/src/api/check-params/video-passwords.tsindex 9d4d6ea789..c9d57b54da 100644--- a/packages/tests/src/api/check-params/video-passwords.ts+++ b/packages/tests/src/api/check-params/video-passwords.ts@@ -15,7 +15,7 @@ import {makePostBodyRequest,setAccessTokensToServers} from '@peertube/peertube-server-commands'-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { checkBadCountPagination, checkBadSort, checkBadStartPagination } from '@tests/shared/checks.js'import { FIXTURE_URLS } from '@tests/shared/fixture-urls.js'import { checkUploadVideoParam } from '@tests/shared/videos.js'import { expect } from 'chai'@@ -564,7 +564,7 @@ describe('Test video passwords validator', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path + video.uuid + '/passwords', server.accessToken)+ await checkBadSort(server.url, path + video.uuid + '/passwords', server.accessToken)})it('Should fail for unauthenticated user', async function () {diff --git a/packages/tests/src/api/check-params/video-playlists.ts b/packages/tests/src/api/check-params/video-playlists.tsindex 1b2edecb32..e25fac56df 100644--- a/packages/tests/src/api/check-params/video-playlists.ts+++ b/packages/tests/src/api/check-params/video-playlists.ts@@ -20,7 +20,7 @@ import {setAccessTokensToServers,setDefaultVideoChannel} from '@peertube/peertube-server-commands'-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { checkBadCountPagination, checkBadSort, checkBadStartPagination } from '@tests/shared/checks.js'import { expect } from 'chai'describe('Test video playlists API validator', function () {@@ -146,9 +146,9 @@ describe('Test video playlists API validator', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, globalPath, server.accessToken)- await checkBadSortPagination(server.url, accountPath, server.accessToken)- await checkBadSortPagination(server.url, videoChannelPath, server.accessToken)+ await checkBadSort(server.url, globalPath, server.accessToken)+ await checkBadSort(server.url, accountPath, server.accessToken)+ await checkBadSort(server.url, videoChannelPath, server.accessToken)})it('Should fail with a bad playlist type', async function () {diff --git a/packages/tests/src/api/check-params/videos.ts b/packages/tests/src/api/check-params/videos.tsindex 23c7573d35..9a7d748458 100644--- a/packages/tests/src/api/check-params/videos.ts+++ b/packages/tests/src/api/check-params/videos.ts@@ -22,7 +22,7 @@ import {setAccessTokensToServers,setDefaultVideoChannel} from '@peertube/peertube-server-commands'-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { checkBadCountPagination, checkBadSort, checkBadStartPagination } from '@tests/shared/checks.js'import { checkUploadVideoParam } from '@tests/shared/videos.js'import { expect } from 'chai'@@ -90,7 +90,7 @@ describe('Test videos API validator', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path)+ await checkBadSort(server.url, path)})it('Should fail with a bad skipVideos query', async function () {@@ -114,7 +114,7 @@ describe('Test videos API validator', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path, undefined, { search: 'test' })+ await checkBadSort(server.url, path, undefined, { search: 'test' })})it('Should succeed with the correct parameters', async function () {@@ -134,7 +134,7 @@ describe('Test videos API validator', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path, server.accessToken)+ await checkBadSort(server.url, path, server.accessToken)})it('Should fail with an invalid channel', async function () {@@ -207,7 +207,7 @@ describe('Test videos API validator', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path, server.accessToken)+ await checkBadSort(server.url, path, server.accessToken)})it('Should succeed with the correct parameters', async function () {@@ -231,7 +231,7 @@ describe('Test videos API validator', function () {})it('Should fail with an incorrect sort', async function () {- await checkBadSortPagination(server.url, path, server.accessToken)+ await checkBadSort(server.url, path, server.accessToken)})it('Should succeed with the correct parameters', async function () {diff --git a/packages/tests/src/api/check-params/watched-words.ts b/packages/tests/src/api/check-params/watched-words.tsindex 68fbd27521..1e1340f31e 100644--- a/packages/tests/src/api/check-params/watched-words.ts+++ b/packages/tests/src/api/check-params/watched-words.ts@@ -10,7 +10,7 @@ import {setAccessTokensToServers,setDefaultAccountAvatar} from '@peertube/peertube-server-commands'-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js'+import { checkBadCountPagination, checkBadSort, checkBadStartPagination } from '@tests/shared/checks.js'describe('Test watched words API validators', function () {let server: PeerTubeServer@@ -57,7 +57,6 @@ describe('Test watched words API validators', function () {})describe('Account & server watched words', function () {-describe('When listing watched words', function () {const paths = ['/api/v1/watched-words/accounts/user1/lists',@@ -89,13 +88,13 @@ describe('Test watched words API validators', function () {for (const path of paths) {await checkBadStartPagination(server.url, path, userToken)await checkBadCountPagination(server.url, path, userToken)- await checkBadSortPagination(server.url, path, userToken)+ await checkBadSort(server.url, path, userToken)}})})describe('When adding/updating watched words', function () {- const baseParams = () => ([+ const baseParams = () => [{token: userToken,accountName: 'user1',@@ -109,7 +108,7 @@ describe('Test watched words API validators', function () {words: [ 'word1' ],listId: serverListId}- ])+ ]it('Should fail with an unauthenticated user', async function () {for (const baseParam of baseParams()) {@@ -182,7 +181,7 @@ describe('Test watched words API validators', function () {})describe('When deleting watched words', function () {- const baseParams = () => ([+ const baseParams = () => [{token: userToken,accountName: 'user1',@@ -192,7 +191,7 @@ describe('Test watched words API validators', function () {token: moderatorToken,listId: serverListId}- ])+ ]it('Should fail with an unauthenticated user', async function () {for (const baseParam of baseParams()) {@@ -215,7 +214,6 @@ describe('Test watched words API validators', function () {})describe('Account specific watched words', function () {-describe('When listing watched words', function () {it('Should fail with an unknown account', async function () {await command.listWordsLists({ accountName: 'unknown', expectedStatus: HttpStatusCode.NOT_FOUND_404 })diff --git a/packages/tests/src/shared/checks.ts b/packages/tests/src/shared/checks.tsindex 6e4139915f..59e28bdc33 100644--- a/packages/tests/src/shared/checks.ts+++ b/packages/tests/src/shared/checks.ts@@ -152,7 +152,7 @@ async function checkBadCountPagination (url: string, path: string, token?: strin})}-function checkBadSortPagination (url: string, path: string, token?: string, query = {}) {+function checkBadSort (url: string, path: string, token?: string, query = {}) {return makeGetRequest({url,path,@@ -180,7 +180,7 @@ async function checkVideoDuration (server: PeerTubeServer, videoUUID: string, duexport {checkBadCountPagination,- checkBadSortPagination,+ checkBadSort,checkBadStartPagination,checkVideoDuration,dateIsValid,diff --git a/server/core/lib/job-queue/handlers/manage-video-torrent.ts b/server/core/lib/job-queue/handlers/manage-video-torrent.tsindex 24bfc5acb9..e07468c919 100644--- a/server/core/lib/job-queue/handlers/manage-video-torrent.ts+++ b/server/core/lib/job-queue/handlers/manage-video-torrent.ts@@ -1,6 +1,6 @@import { Job } from 'bullmq'import { extractVideo } from '@server/helpers/video.js'-import { createTorrentAndSetInfoHash, updateTorrentMetadata } from '@server/helpers/webtorrent.js'+import { createTorrentAndSetInfoHash, updateTorrentMetadata } from '@server/lib/webtorrent.js'import { VideoPathManager } from '@server/lib/video-path-manager.js'import { VideoModel } from '@server/models/video/video.js'import { VideoFileModel } from '@server/models/video/video-file.js'diff --git a/server/core/lib/job-queue/handlers/move-to-file-system.ts b/server/core/lib/job-queue/handlers/move-to-file-system.tsindex 22170194e8..0e72f39283 100644--- a/server/core/lib/job-queue/handlers/move-to-file-system.ts+++ b/server/core/lib/job-queue/handlers/move-to-file-system.ts@@ -1,6 +1,6 @@import { FileStorage, isMoveCaptionPayload, isMoveVideoStoragePayload, MoveStoragePayload, VideoStateType } from '@peertube/peertube-models'import { logger, loggerTagsFactory } from '@server/helpers/logger.js'-import { updateTorrentMetadata } from '@server/helpers/webtorrent.js'+import { updateTorrentMetadata } from '@server/lib/webtorrent.js'import { P2P_MEDIA_LOADER_PEER_VERSION } from '@server/initializers/constants.js'import {makeCaptionFileAvailable,diff --git a/server/core/lib/job-queue/handlers/move-to-object-storage.ts b/server/core/lib/job-queue/handlers/move-to-object-storage.tsindex 0ac890a972..a7d5ce9a3a 100644--- a/server/core/lib/job-queue/handlers/move-to-object-storage.ts+++ b/server/core/lib/job-queue/handlers/move-to-object-storage.ts@@ -1,6 +1,6 @@import { FileStorage, isMoveCaptionPayload, isMoveVideoStoragePayload, MoveStoragePayload, VideoStateType } from '@peertube/peertube-models'import { logger, loggerTagsFactory } from '@server/helpers/logger.js'-import { updateTorrentMetadata } from '@server/helpers/webtorrent.js'+import { updateTorrentMetadata } from '@server/lib/webtorrent.js'import { P2P_MEDIA_LOADER_PEER_VERSION } from '@server/initializers/constants.js'import { buildCaptionM3U8Content } from '@server/lib/hls.js'import {diff --git a/server/core/lib/job-queue/handlers/video-file-import.ts b/server/core/lib/job-queue/handlers/video-file-import.tsindex 56d6fc8e72..8741b0e039 100644--- a/server/core/lib/job-queue/handlers/video-file-import.ts+++ b/server/core/lib/job-queue/handlers/video-file-import.ts@@ -1,7 +1,7 @@import { Job } from 'bullmq'import { copy } from 'fs-extra/esm'import { VideoFileImportPayload } from '@peertube/peertube-models'-import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent.js'+import { createTorrentAndSetInfoHash } from '@server/lib/webtorrent.js'import { CONFIG } from '@server/initializers/config.js'import { federateVideoIfNeeded } from '@server/lib/activitypub/videos/index.js'import { VideoPathManager } from '@server/lib/video-path-manager.js'diff --git a/server/core/lib/job-queue/handlers/video-import.ts b/server/core/lib/job-queue/handlers/video-import.tsindex a5115cfe97..74394e0de0 100644--- a/server/core/lib/job-queue/handlers/video-import.ts+++ b/server/core/lib/job-queue/handlers/video-import.ts@@ -28,6 +28,7 @@ import { buildNewFile } from '@server/lib/video-file.js'import { addLocalOrRemoteStoryboardJobIfNeeded, buildMoveVideoJob } from '@server/lib/video-jobs.js'import { VideoPathManager } from '@server/lib/video-path-manager.js'import { buildNextVideoState } from '@server/lib/video-state.js'+import { createTorrentAndSetInfoHash, downloadWebTorrentVideo } from '@server/lib/webtorrent.js'import { VideoCaptionModel } from '@server/models/video/video-caption.js'import { MUserId, MVideoFile, MVideoFullLight } from '@server/types/models/index.js'import { MVideoImport, MVideoImportDefault, MVideoImportDefaultFiles, MVideoImportVideo } from '@server/types/models/video/video-import.js'@@ -37,7 +38,6 @@ import { move, remove } from 'fs-extra/esm'import { stat } from 'fs/promises'import { logger } from '../../../helpers/logger.js'import { getSecureTorrentName } from '../../../helpers/utils.js'-import { createTorrentAndSetInfoHash, downloadWebTorrentVideo } from '../../../helpers/webtorrent.js'import { CONSTRAINTS_FIELDS, JOB_TTL } from '../../../initializers/constants.js'import { sequelizeTypescript } from '../../../initializers/database.js'import { VideoFileModel } from '../../../models/video/video-file.js'diff --git a/server/core/lib/transcoding/hls-transcoding.ts b/server/core/lib/transcoding/hls-transcoding.tsindex 01117877cd..bc1b2211bc 100644--- a/server/core/lib/transcoding/hls-transcoding.ts+++ b/server/core/lib/transcoding/hls-transcoding.ts@@ -1,7 +1,7 @@import { pick } from '@peertube/peertube-core-utils'import { getVideoStreamDuration, HLSFromTSTranscodeOptions, HLSTranscodeOptions } from '@peertube/peertube-ffmpeg'import { retryTransactionWrapper } from '@server/helpers/database-utils.js'-import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent.js'+import { createTorrentAndSetInfoHash } from '@server/lib/webtorrent.js'import { sequelizeTypescript } from '@server/initializers/database.js'import { MVideo } from '@server/types/models/index.js'import { MutexInterface } from 'async-mutex'diff --git a/server/core/lib/transcoding/web-transcoding.ts b/server/core/lib/transcoding/web-transcoding.tsindex 8d9a011262..f843f8a497 100644--- a/server/core/lib/transcoding/web-transcoding.ts+++ b/server/core/lib/transcoding/web-transcoding.ts@@ -7,7 +7,7 @@ import {} from '@peertube/peertube-ffmpeg'import { VideoFileStream } from '@peertube/peertube-models'import { computeOutputFPS } from '@server/helpers/ffmpeg/index.js'-import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent.js'+import { createTorrentAndSetInfoHash } from '@server/lib/webtorrent.js'import { VideoModel } from '@server/models/video/video.js'import { MVideoFile, MVideoFullLight } from '@server/types/models/index.js'import { Job } from 'bullmq'diff --git a/server/core/lib/video-studio.ts b/server/core/lib/video-studio.tsindex a528fa44ef..d5b089594a 100644--- a/server/core/lib/video-studio.ts+++ b/server/core/lib/video-studio.ts@@ -2,7 +2,7 @@ import { buildAspectRatio } from '@peertube/peertube-core-utils'import { getVideoStreamDuration } from '@peertube/peertube-ffmpeg'import { VideoStudioEditionPayload, VideoStudioTask, VideoStudioTaskPayload } from '@peertube/peertube-models'import { logger, loggerTagsFactory } from '@server/helpers/logger.js'-import { createTorrentAndSetInfoHashFromPath } from '@server/helpers/webtorrent.js'+import { createTorrentAndSetInfoHashFromPath } from '@server/lib/webtorrent.js'import { CONFIG } from '@server/initializers/config.js'import { MUser, MVideoFile, MVideoFullLight, MVideoWithAllFiles, MVideoWithFile } from '@server/types/models/index.js'import { move, remove } from 'fs-extra/esm'diff --git a/server/core/models/video/formatter/video-activity-pub-format.ts b/server/core/models/video/formatter/video-activity-pub-format.tsindex f32ac7e576..65367e6053 100644--- a/server/core/models/video/formatter/video-activity-pub-format.ts+++ b/server/core/models/video/formatter/video-activity-pub-format.ts@@ -13,7 +13,7 @@ import {} from '@peertube/peertube-models'import { getAPPublicValue } from '@server/helpers/activity-pub-utils.js'import { isArray } from '@server/helpers/custom-validators/misc.js'-import { generateMagnetUri } from '@server/helpers/webtorrent.js'+import { generateMagnetUri } from '@server/lib/webtorrent.js'import { getActivityStreamDuration } from '@server/lib/activitypub/activity.js'import { getLocalVideoFileMetadataUrl } from '@server/lib/video-urls.js'import { WEBSERVER } from '../../../initializers/constants.js'diff --git a/server/core/models/video/formatter/video-api-format.ts b/server/core/models/video/formatter/video-api-format.tsindex 404f9b7090..8b67e44309 100644--- a/server/core/models/video/formatter/video-api-format.ts+++ b/server/core/models/video/formatter/video-api-format.ts@@ -9,7 +9,7 @@ import {VideoStreamingPlaylist} from '@peertube/peertube-models'import { uuidToShort } from '@peertube/peertube-node-utils'-import { generateMagnetUri } from '@server/helpers/webtorrent.js'+import { generateMagnetUri } from '@server/lib/webtorrent.js'import { tracer } from '@server/lib/opentelemetry/tracing.js'import { getHLSResolutionPlaylistFilename } from '@server/lib/paths.js'import { getLocalVideoFileMetadataUrl } from '@server/lib/video-urls.js'diff --git a/server/scripts/migrations/peertube-5.0.ts b/server/scripts/migrations/peertube-5.0.tsindex 72f241bc22..55808ce477 100644--- a/server/scripts/migrations/peertube-5.0.ts+++ b/server/scripts/migrations/peertube-5.0.ts@@ -1,6 +1,6 @@import { ensureDir } from 'fs-extra/esm'import { Op } from 'sequelize'-import { updateTorrentMetadata } from '@server/helpers/webtorrent.js'+import { updateTorrentMetadata } from '@server/lib/webtorrent.js'import { DIRECTORIES } from '@server/initializers/constants.js'import { moveFilesIfPrivacyChanged } from '@server/lib/video-privacy.js'import { VideoModel } from '@server/models/video/video.js'diff --git a/server/scripts/update-host.ts b/server/scripts/update-host.tsindex 47b3362d3b..d4a33855d8 100755--- a/server/scripts/update-host.ts+++ b/server/scripts/update-host.ts@@ -1,4 +1,4 @@-import { updateTorrentMetadata } from '@server/helpers/webtorrent.js'+import { updateTorrentMetadata } from '@server/lib/webtorrent.js'import { getServerActor } from '@server/models/application/application.js'import { WEBSERVER } from '@server/initializers/constants.js'import { initDatabaseModels } from '@server/initializers/database.js'