aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/controllers/api/bulk.ts6
-rw-r--r--server/controllers/api/config.ts2
-rw-r--r--server/controllers/api/custom-page.ts3
-rw-r--r--server/controllers/api/overviews.ts10
-rw-r--r--server/controllers/api/plugins.ts2
-rw-r--r--server/controllers/api/search/search-video-channels.ts3
-rw-r--r--server/controllers/api/search/search-video-playlists.ts5
-rw-r--r--server/controllers/api/search/search-videos.ts3
-rw-r--r--server/controllers/api/server/contact.ts8
-rw-r--r--server/controllers/api/server/index.ts8
-rw-r--r--server/controllers/api/server/logs.ts12
-rw-r--r--server/controllers/api/users/me.ts2
-rw-r--r--server/controllers/api/users/my-blocklist.ts10
-rw-r--r--server/controllers/api/users/my-history.ts6
-rw-r--r--server/controllers/api/users/my-video-playlists.ts2
-rw-r--r--server/controllers/api/videos/blacklist.ts2
-rw-r--r--server/controllers/api/videos/comment.ts2
-rw-r--r--server/controllers/api/videos/ownership.ts14
-rw-r--r--server/controllers/api/videos/rate.ts4
-rw-r--r--server/controllers/api/videos/watching.ts2
-rw-r--r--server/controllers/download.ts3
-rw-r--r--server/middlewares/cache.ts2
-rw-r--r--server/middlewares/servers.ts2
-rw-r--r--server/middlewares/user-right.ts2
-rw-r--r--server/middlewares/validators/activitypub/activity.ts4
-rw-r--r--server/middlewares/validators/bulk.ts3
-rw-r--r--server/middlewares/validators/feeds.ts1
-rw-r--r--server/middlewares/validators/shared/videos.ts3
-rw-r--r--server/middlewares/validators/videos/video-live.ts3
-rw-r--r--server/middlewares/validators/videos/video-ownership-changes.ts10
-rw-r--r--server/tests/api/activitypub/cleaner.ts2
-rw-r--r--server/tests/api/activitypub/client.ts5
-rw-r--r--server/tests/api/activitypub/fetch.ts2
-rw-r--r--server/tests/api/activitypub/refresher.ts5
-rw-r--r--server/tests/api/check-params/abuses.ts5
-rw-r--r--server/tests/api/check-params/accounts.ts2
-rw-r--r--server/tests/api/check-params/config.ts3
-rw-r--r--server/tests/api/check-params/contact-form.ts2
-rw-r--r--server/tests/api/check-params/live.ts5
-rw-r--r--server/tests/api/check-params/plugins.ts3
-rw-r--r--server/tests/api/check-params/search.ts2
-rw-r--r--server/tests/api/check-params/services.ts3
-rw-r--r--server/tests/api/check-params/user-notifications.ts3
-rw-r--r--server/tests/api/check-params/users.ts3
-rw-r--r--server/tests/api/check-params/video-blacklist.ts5
-rw-r--r--server/tests/api/check-params/video-captions.ts3
-rw-r--r--server/tests/api/check-params/video-channels.ts3
-rw-r--r--server/tests/api/check-params/video-comments.ts3
-rw-r--r--server/tests/api/check-params/video-imports.ts3
-rw-r--r--server/tests/api/check-params/video-playlists.ts4
-rw-r--r--server/tests/api/check-params/videos-filter.ts3
-rw-r--r--server/tests/api/check-params/videos-history.ts2
-rw-r--r--server/tests/api/live/live-constraints.ts2
-rw-r--r--server/tests/api/live/live-permanent.ts2
-rw-r--r--server/tests/api/live/live-save-replay.ts5
-rw-r--r--server/tests/api/live/live-socket-messages.ts2
-rw-r--r--server/tests/api/live/live-views.ts2
-rw-r--r--server/tests/api/live/live.ts15
-rw-r--r--server/tests/api/moderation/blocklist-notification.ts2
-rw-r--r--server/tests/api/moderation/blocklist.ts2
-rw-r--r--server/tests/api/notifications/admin-notifications.ts2
-rw-r--r--server/tests/api/notifications/comments-notifications.ts2
-rw-r--r--server/tests/api/notifications/moderation-notifications.ts2
-rw-r--r--server/tests/api/notifications/notifications-api.ts2
-rw-r--r--server/tests/api/redundancy/manage-redundancy.ts4
-rw-r--r--server/tests/api/redundancy/redundancy-constraints.ts9
-rw-r--r--server/tests/api/redundancy/redundancy.ts7
-rw-r--r--server/tests/api/search/search-activitypub-video-channels.ts2
-rw-r--r--server/tests/api/search/search-activitypub-video-playlists.ts2
-rw-r--r--server/tests/api/search/search-activitypub-videos.ts2
-rw-r--r--server/tests/api/search/search-channels.ts2
-rw-r--r--server/tests/api/search/search-index.ts2
-rw-r--r--server/tests/api/search/search-playlists.ts2
-rw-r--r--server/tests/api/search/search-videos.ts2
-rw-r--r--server/tests/api/server/bulk.ts2
-rw-r--r--server/tests/api/server/config.ts3
-rw-r--r--server/tests/api/server/contact-form.ts2
-rw-r--r--server/tests/api/server/email.ts2
-rw-r--r--server/tests/api/server/follow-constraints.ts13
-rw-r--r--server/tests/api/server/follows.ts2
-rw-r--r--server/tests/api/server/handle-down.ts3
-rw-r--r--server/tests/api/server/homepage.ts2
-rw-r--r--server/tests/api/server/jobs.ts2
-rw-r--r--server/tests/api/server/plugins.ts5
-rw-r--r--server/tests/api/server/reverse-proxy.ts2
-rw-r--r--server/tests/api/server/stats.ts2
-rw-r--r--server/tests/api/users/user-subscriptions.ts5
-rw-r--r--server/tests/api/users/users-multiple-servers.ts2
-rw-r--r--server/tests/api/users/users-verification.ts2
-rw-r--r--server/tests/api/users/users.ts3
-rw-r--r--server/tests/api/videos/audio-only.ts2
-rw-r--r--server/tests/api/videos/multiple-servers.ts5
-rw-r--r--server/tests/api/videos/resumable-upload.ts3
-rw-r--r--server/tests/api/videos/video-captions.ts2
-rw-r--r--server/tests/api/videos/video-change-ownership.ts5
-rw-r--r--server/tests/api/videos/video-channels.ts2
-rw-r--r--server/tests/api/videos/video-comments.ts2
-rw-r--r--server/tests/api/videos/video-description.ts2
-rw-r--r--server/tests/api/videos/video-hls.ts5
-rw-r--r--server/tests/api/videos/video-nsfw.ts9
-rw-r--r--server/tests/api/videos/video-playlist-thumbnails.ts2
-rw-r--r--server/tests/api/videos/video-playlists.ts6
-rw-r--r--server/tests/api/videos/video-privacy.ts7
-rw-r--r--server/tests/api/videos/video-schedule-update.ts2
-rw-r--r--server/tests/api/videos/video-transcoder.ts5
-rw-r--r--server/tests/api/videos/videos-filter.ts5
-rw-r--r--server/tests/api/videos/videos-history.ts3
-rw-r--r--server/tests/api/videos/videos-views-cleaner.ts2
-rw-r--r--server/tests/cli/create-import-video-file-job.ts2
-rw-r--r--server/tests/cli/create-transcoding-job.ts2
-rw-r--r--server/tests/cli/optimize-old-videos.ts2
-rw-r--r--server/tests/cli/plugins.ts2
-rw-r--r--server/tests/cli/prune-storage.ts5
-rw-r--r--server/tests/cli/regenerate-thumbnails.ts5
-rw-r--r--server/tests/client.ts5
-rw-r--r--server/tests/external-plugins/auth-ldap.ts2
-rw-r--r--server/tests/external-plugins/auto-block-videos.ts2
-rw-r--r--server/tests/external-plugins/auto-mute.ts4
-rw-r--r--server/tests/feeds/feeds.ts5
-rw-r--r--server/tests/helpers/comment-model.ts2
-rw-r--r--server/tests/helpers/core-utils.ts4
-rw-r--r--server/tests/helpers/image.ts2
-rw-r--r--server/tests/misc-endpoints.ts3
-rw-r--r--server/tests/plugins/action-hooks.ts2
-rw-r--r--server/tests/plugins/external-auth.ts7
-rw-r--r--server/tests/plugins/filter-hooks.ts3
-rw-r--r--server/tests/plugins/html-injection.ts2
-rw-r--r--server/tests/plugins/id-and-pass-auth.ts5
-rw-r--r--server/tests/plugins/plugin-helpers.ts6
-rw-r--r--server/tests/plugins/plugin-router.ts4
-rw-r--r--server/tests/plugins/plugin-storage.ts2
-rw-r--r--server/tests/plugins/plugin-transcoding.ts2
-rw-r--r--server/tests/plugins/plugin-unloading.ts2
-rw-r--r--server/tests/plugins/video-constants.ts5
-rw-r--r--server/tools/peertube-redundancy.ts3
-rw-r--r--shared/extra-utils/custom-pages/custom-pages-command.ts3
-rw-r--r--shared/extra-utils/miscs/generate.ts2
-rw-r--r--shared/extra-utils/moderation/abuses-command.ts4
-rw-r--r--shared/extra-utils/overviews/overviews-command.ts3
-rw-r--r--shared/extra-utils/requests/activitypub.ts2
-rw-r--r--shared/extra-utils/search/search-command.ts2
-rw-r--r--shared/extra-utils/server/config-command.ts2
-rw-r--r--shared/extra-utils/server/debug-command.ts3
-rw-r--r--shared/extra-utils/server/follows-command.ts3
-rw-r--r--shared/extra-utils/server/plugins-command.ts2
-rw-r--r--shared/extra-utils/server/redundancy-command.ts3
-rw-r--r--shared/extra-utils/server/stats-command.ts3
-rw-r--r--shared/extra-utils/users/accounts-command.ts3
-rw-r--r--shared/extra-utils/users/blocklist-command.ts3
-rw-r--r--shared/extra-utils/users/login-command.ts3
-rw-r--r--shared/extra-utils/users/notifications-command.ts3
-rw-r--r--shared/extra-utils/users/subscriptions-command.ts3
-rw-r--r--shared/extra-utils/users/users-command.ts2
-rw-r--r--shared/extra-utils/videos/blacklist-command.ts3
-rw-r--r--shared/extra-utils/videos/captions-command.ts3
-rw-r--r--shared/extra-utils/videos/change-ownership-command.ts3
-rw-r--r--shared/extra-utils/videos/channels-command.ts3
-rw-r--r--shared/extra-utils/videos/comments-command.ts3
-rw-r--r--shared/extra-utils/videos/history-command.ts3
-rw-r--r--shared/extra-utils/videos/imports-command.ts3
-rw-r--r--shared/extra-utils/videos/live-command.ts3
-rw-r--r--shared/extra-utils/videos/playlists-command.ts2
-rw-r--r--shared/extra-utils/videos/streaming-playlists.ts3
-rw-r--r--shared/extra-utils/videos/videos-command.ts15
-rw-r--r--shared/extra-utils/videos/videos.ts2
165 files changed, 265 insertions, 325 deletions
diff --git a/server/controllers/api/bulk.ts b/server/controllers/api/bulk.ts
index 10d83571d..62121ece5 100644
--- a/server/controllers/api/bulk.ts
+++ b/server/controllers/api/bulk.ts
@@ -1,10 +1,10 @@
1import * as express from 'express' 1import * as express from 'express'
2import { asyncMiddleware, authenticate } from '../../middlewares' 2import { removeComment } from '@server/lib/video-comment'
3import { bulkRemoveCommentsOfValidator } from '@server/middlewares/validators/bulk' 3import { bulkRemoveCommentsOfValidator } from '@server/middlewares/validators/bulk'
4import { VideoCommentModel } from '@server/models/video/video-comment' 4import { VideoCommentModel } from '@server/models/video/video-comment'
5import { removeComment } from '@server/lib/video-comment'
6import { BulkRemoveCommentsOfBody } from '@shared/models/bulk/bulk-remove-comments-of-body.model'
7import { HttpStatusCode } from '@shared/models' 5import { HttpStatusCode } from '@shared/models'
6import { BulkRemoveCommentsOfBody } from '@shared/models/bulk/bulk-remove-comments-of-body.model'
7import { asyncMiddleware, authenticate } from '../../middlewares'
8 8
9const bulkRouter = express.Router() 9const bulkRouter = express.Router()
10 10
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts
index 9bd8c21c5..ee733a38c 100644
--- a/server/controllers/api/config.ts
+++ b/server/controllers/api/config.ts
@@ -1,8 +1,8 @@
1import { ServerConfigManager } from '@server/lib/server-config-manager'
2import * as express from 'express' 1import * as express from 'express'
3import { remove, writeJSON } from 'fs-extra' 2import { remove, writeJSON } from 'fs-extra'
4import { snakeCase } from 'lodash' 3import { snakeCase } from 'lodash'
5import validator from 'validator' 4import validator from 'validator'
5import { ServerConfigManager } from '@server/lib/server-config-manager'
6import { UserRight } from '../../../shared' 6import { UserRight } from '../../../shared'
7import { About } from '../../../shared/models/server/about.model' 7import { About } from '../../../shared/models/server/about.model'
8import { CustomConfig } from '../../../shared/models/server/custom-config.model' 8import { CustomConfig } from '../../../shared/models/server/custom-config.model'
diff --git a/server/controllers/api/custom-page.ts b/server/controllers/api/custom-page.ts
index cc1aa8427..68d8c2ea4 100644
--- a/server/controllers/api/custom-page.ts
+++ b/server/controllers/api/custom-page.ts
@@ -1,8 +1,7 @@
1import * as express from 'express' 1import * as express from 'express'
2import { ServerConfigManager } from '@server/lib/server-config-manager' 2import { ServerConfigManager } from '@server/lib/server-config-manager'
3import { ActorCustomPageModel } from '@server/models/account/actor-custom-page' 3import { ActorCustomPageModel } from '@server/models/account/actor-custom-page'
4import { HttpStatusCode } from '@shared/models' 4import { HttpStatusCode, UserRight } from '@shared/models'
5import { UserRight } from '@shared/models'
6import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../middlewares' 5import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../middlewares'
7 6
8const customPageRouter = express.Router() 7const customPageRouter = express.Router()
diff --git a/server/controllers/api/overviews.ts b/server/controllers/api/overviews.ts
index ad879aad6..aaa341d54 100644
--- a/server/controllers/api/overviews.ts
+++ b/server/controllers/api/overviews.ts
@@ -1,12 +1,12 @@
1import * as express from 'express' 1import * as express from 'express'
2import * as memoizee from 'memoizee'
3import { logger } from '@server/helpers/logger'
4import { CategoryOverview, ChannelOverview, TagOverview, VideosOverview } from '../../../shared/models/overviews'
2import { buildNSFWFilter } from '../../helpers/express-utils' 5import { buildNSFWFilter } from '../../helpers/express-utils'
3import { VideoModel } from '../../models/video/video' 6import { MEMOIZE_TTL, OVERVIEWS } from '../../initializers/constants'
4import { asyncMiddleware, optionalAuthenticate, videosOverviewValidator } from '../../middlewares' 7import { asyncMiddleware, optionalAuthenticate, videosOverviewValidator } from '../../middlewares'
5import { TagModel } from '../../models/video/tag' 8import { TagModel } from '../../models/video/tag'
6import { CategoryOverview, ChannelOverview, TagOverview, VideosOverview } from '../../../shared/models/overviews' 9import { VideoModel } from '../../models/video/video'
7import { MEMOIZE_TTL, OVERVIEWS } from '../../initializers/constants'
8import * as memoizee from 'memoizee'
9import { logger } from '@server/helpers/logger'
10 10
11const overviewsRouter = express.Router() 11const overviewsRouter = express.Router()
12 12
diff --git a/server/controllers/api/plugins.ts b/server/controllers/api/plugins.ts
index 4b213c246..3a9ef34e8 100644
--- a/server/controllers/api/plugins.ts
+++ b/server/controllers/api/plugins.ts
@@ -23,8 +23,8 @@ import {
23 updatePluginSettingsValidator 23 updatePluginSettingsValidator
24} from '@server/middlewares/validators/plugins' 24} from '@server/middlewares/validators/plugins'
25import { PluginModel } from '@server/models/server/plugin' 25import { PluginModel } from '@server/models/server/plugin'
26import { HttpStatusCode } from '@shared/models'
27import { 26import {
27 HttpStatusCode,
28 InstallOrUpdatePlugin, 28 InstallOrUpdatePlugin,
29 ManagePlugin, 29 ManagePlugin,
30 PeertubePluginIndexList, 30 PeertubePluginIndexList,
diff --git a/server/controllers/api/search/search-video-channels.ts b/server/controllers/api/search/search-video-channels.ts
index fe9178e69..c8f0a0a0b 100644
--- a/server/controllers/api/search/search-video-channels.ts
+++ b/server/controllers/api/search/search-video-channels.ts
@@ -6,8 +6,7 @@ import { WEBSERVER } from '@server/initializers/constants'
6import { Hooks } from '@server/lib/plugins/hooks' 6import { Hooks } from '@server/lib/plugins/hooks'
7import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search' 7import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search'
8import { getServerActor } from '@server/models/application/application' 8import { getServerActor } from '@server/models/application/application'
9import { HttpStatusCode } from '@shared/models' 9import { HttpStatusCode, ResultList, VideoChannel } from '@shared/models'
10import { ResultList, VideoChannel } from '@shared/models'
11import { VideoChannelsSearchQuery } from '../../../../shared/models/search' 10import { VideoChannelsSearchQuery } from '../../../../shared/models/search'
12import { isUserAbleToSearchRemoteURI } from '../../../helpers/express-utils' 11import { isUserAbleToSearchRemoteURI } from '../../../helpers/express-utils'
13import { logger } from '../../../helpers/logger' 12import { logger } from '../../../helpers/logger'
diff --git a/server/controllers/api/search/search-video-playlists.ts b/server/controllers/api/search/search-video-playlists.ts
index a0e2c1747..f55b1fba3 100644
--- a/server/controllers/api/search/search-video-playlists.ts
+++ b/server/controllers/api/search/search-video-playlists.ts
@@ -5,14 +5,14 @@ import { logger } from '@server/helpers/logger'
5import { doJSONRequest } from '@server/helpers/requests' 5import { doJSONRequest } from '@server/helpers/requests'
6import { getFormattedObjects } from '@server/helpers/utils' 6import { getFormattedObjects } from '@server/helpers/utils'
7import { CONFIG } from '@server/initializers/config' 7import { CONFIG } from '@server/initializers/config'
8import { WEBSERVER } from '@server/initializers/constants'
8import { getOrCreateAPVideoPlaylist } from '@server/lib/activitypub/playlists/get' 9import { getOrCreateAPVideoPlaylist } from '@server/lib/activitypub/playlists/get'
9import { Hooks } from '@server/lib/plugins/hooks' 10import { Hooks } from '@server/lib/plugins/hooks'
10import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search' 11import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search'
11import { getServerActor } from '@server/models/application/application' 12import { getServerActor } from '@server/models/application/application'
12import { VideoPlaylistModel } from '@server/models/video/video-playlist' 13import { VideoPlaylistModel } from '@server/models/video/video-playlist'
13import { MVideoPlaylistFullSummary } from '@server/types/models' 14import { MVideoPlaylistFullSummary } from '@server/types/models'
14import { HttpStatusCode } from '@shared/models' 15import { HttpStatusCode, ResultList, VideoPlaylist, VideoPlaylistsSearchQuery } from '@shared/models'
15import { ResultList, VideoPlaylist, VideoPlaylistsSearchQuery } from '@shared/models'
16import { 16import {
17 asyncMiddleware, 17 asyncMiddleware,
18 openapiOperationDoc, 18 openapiOperationDoc,
@@ -23,7 +23,6 @@ import {
23 videoPlaylistsListSearchValidator, 23 videoPlaylistsListSearchValidator,
24 videoPlaylistsSearchSortValidator 24 videoPlaylistsSearchSortValidator
25} from '../../../middlewares' 25} from '../../../middlewares'
26import { WEBSERVER } from '@server/initializers/constants'
27 26
28const searchPlaylistsRouter = express.Router() 27const searchPlaylistsRouter = express.Router()
29 28
diff --git a/server/controllers/api/search/search-videos.ts b/server/controllers/api/search/search-videos.ts
index 0e6fd9c72..a4153f3f8 100644
--- a/server/controllers/api/search/search-videos.ts
+++ b/server/controllers/api/search/search-videos.ts
@@ -6,8 +6,7 @@ import { WEBSERVER } from '@server/initializers/constants'
6import { getOrCreateAPVideo } from '@server/lib/activitypub/videos' 6import { getOrCreateAPVideo } from '@server/lib/activitypub/videos'
7import { Hooks } from '@server/lib/plugins/hooks' 7import { Hooks } from '@server/lib/plugins/hooks'
8import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search' 8import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search'
9import { HttpStatusCode } from '@shared/models' 9import { HttpStatusCode, ResultList, Video } from '@shared/models'
10import { ResultList, Video } from '@shared/models'
11import { VideosSearchQuery } from '../../../../shared/models/search' 10import { VideosSearchQuery } from '../../../../shared/models/search'
12import { buildNSFWFilter, isUserAbleToSearchRemoteURI } from '../../../helpers/express-utils' 11import { buildNSFWFilter, isUserAbleToSearchRemoteURI } from '../../../helpers/express-utils'
13import { logger } from '../../../helpers/logger' 12import { logger } from '../../../helpers/logger'
diff --git a/server/controllers/api/server/contact.ts b/server/controllers/api/server/contact.ts
index ae36dd599..b315e99cf 100644
--- a/server/controllers/api/server/contact.ts
+++ b/server/controllers/api/server/contact.ts
@@ -1,9 +1,9 @@
1import * as express from 'express' 1import * as express from 'express'
2import { asyncMiddleware, contactAdministratorValidator } from '../../../middlewares'
3import { Redis } from '../../../lib/redis'
4import { Emailer } from '../../../lib/emailer'
5import { ContactForm } from '../../../../shared/models/server'
6import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' 2import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
3import { ContactForm } from '../../../../shared/models/server'
4import { Emailer } from '../../../lib/emailer'
5import { Redis } from '../../../lib/redis'
6import { asyncMiddleware, contactAdministratorValidator } from '../../../middlewares'
7 7
8const contactRouter = express.Router() 8const contactRouter = express.Router()
9 9
diff --git a/server/controllers/api/server/index.ts b/server/controllers/api/server/index.ts
index 6b8793a19..32fefefc0 100644
--- a/server/controllers/api/server/index.ts
+++ b/server/controllers/api/server/index.ts
@@ -1,11 +1,11 @@
1import * as express from 'express' 1import * as express from 'express'
2import { contactRouter } from './contact'
3import { debugRouter } from './debug'
2import { serverFollowsRouter } from './follows' 4import { serverFollowsRouter } from './follows'
3import { statsRouter } from './stats' 5import { logsRouter } from './logs'
4import { serverRedundancyRouter } from './redundancy' 6import { serverRedundancyRouter } from './redundancy'
5import { serverBlocklistRouter } from './server-blocklist' 7import { serverBlocklistRouter } from './server-blocklist'
6import { contactRouter } from './contact' 8import { statsRouter } from './stats'
7import { logsRouter } from './logs'
8import { debugRouter } from './debug'
9 9
10const serverRouter = express.Router() 10const serverRouter = express.Router()
11 11
diff --git a/server/controllers/api/server/logs.ts b/server/controllers/api/server/logs.ts
index 4b543d686..f78607d35 100644
--- a/server/controllers/api/server/logs.ts
+++ b/server/controllers/api/server/logs.ts
@@ -1,14 +1,14 @@
1import * as express from 'express' 1import * as express from 'express'
2import { UserRight } from '../../../../shared/models/users'
3import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../../middlewares'
4import { mtimeSortFilesDesc } from '../../../../shared/core-utils/logs/logs'
5import { readdir, readFile } from 'fs-extra' 2import { readdir, readFile } from 'fs-extra'
6import { AUDIT_LOG_FILENAME, MAX_LOGS_OUTPUT_CHARACTERS, LOG_FILENAME } from '../../../initializers/constants'
7import { join } from 'path' 3import { join } from 'path'
8import { getAuditLogsValidator, getLogsValidator } from '../../../middlewares/validators/logs' 4import { logger } from '@server/helpers/logger'
5import { mtimeSortFilesDesc } from '../../../../shared/core-utils/logs/logs'
9import { LogLevel } from '../../../../shared/models/server/log-level.type' 6import { LogLevel } from '../../../../shared/models/server/log-level.type'
7import { UserRight } from '../../../../shared/models/users'
10import { CONFIG } from '../../../initializers/config' 8import { CONFIG } from '../../../initializers/config'
11import { logger } from '@server/helpers/logger' 9import { AUDIT_LOG_FILENAME, LOG_FILENAME, MAX_LOGS_OUTPUT_CHARACTERS } from '../../../initializers/constants'
10import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../../middlewares'
11import { getAuditLogsValidator, getLogsValidator } from '../../../middlewares/validators/logs'
12 12
13const logsRouter = express.Router() 13const logsRouter = express.Router()
14 14
diff --git a/server/controllers/api/users/me.ts b/server/controllers/api/users/me.ts
index c9610c59f..ac6faca9c 100644
--- a/server/controllers/api/users/me.ts
+++ b/server/controllers/api/users/me.ts
@@ -2,6 +2,7 @@ import 'multer'
2import * as express from 'express' 2import * as express from 'express'
3import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '@server/helpers/audit-logger' 3import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '@server/helpers/audit-logger'
4import { Hooks } from '@server/lib/plugins/hooks' 4import { Hooks } from '@server/lib/plugins/hooks'
5import { AttributesOnly } from '@shared/core-utils'
5import { ActorImageType, UserUpdateMe, UserVideoRate as FormattedUserVideoRate } from '../../../../shared' 6import { ActorImageType, UserUpdateMe, UserVideoRate as FormattedUserVideoRate } from '../../../../shared'
6import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' 7import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
7import { UserVideoQuota } from '../../../../shared/models/users/user-video-quota.model' 8import { UserVideoQuota } from '../../../../shared/models/users/user-video-quota.model'
@@ -31,7 +32,6 @@ import { AccountVideoRateModel } from '../../../models/account/account-video-rat
31import { UserModel } from '../../../models/user/user' 32import { UserModel } from '../../../models/user/user'
32import { VideoModel } from '../../../models/video/video' 33import { VideoModel } from '../../../models/video/video'
33import { VideoImportModel } from '../../../models/video/video-import' 34import { VideoImportModel } from '../../../models/video/video-import'
34import { AttributesOnly } from '@shared/core-utils'
35 35
36const auditLogger = auditLoggerFactory('users') 36const auditLogger = auditLoggerFactory('users')
37 37
diff --git a/server/controllers/api/users/my-blocklist.ts b/server/controllers/api/users/my-blocklist.ts
index fe11b6e77..24fff83e3 100644
--- a/server/controllers/api/users/my-blocklist.ts
+++ b/server/controllers/api/users/my-blocklist.ts
@@ -1,6 +1,10 @@
1import * as express from 'express'
2import 'multer' 1import 'multer'
2import * as express from 'express'
3import { logger } from '@server/helpers/logger'
4import { UserNotificationModel } from '@server/models/user/user-notification'
5import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
3import { getFormattedObjects } from '../../../helpers/utils' 6import { getFormattedObjects } from '../../../helpers/utils'
7import { addAccountInBlocklist, addServerInBlocklist, removeAccountFromBlocklist, removeServerFromBlocklist } from '../../../lib/blocklist'
4import { 8import {
5 asyncMiddleware, 9 asyncMiddleware,
6 asyncRetryTransactionMiddleware, 10 asyncRetryTransactionMiddleware,
@@ -18,11 +22,7 @@ import {
18 unblockServerByAccountValidator 22 unblockServerByAccountValidator
19} from '../../../middlewares/validators' 23} from '../../../middlewares/validators'
20import { AccountBlocklistModel } from '../../../models/account/account-blocklist' 24import { AccountBlocklistModel } from '../../../models/account/account-blocklist'
21import { addAccountInBlocklist, addServerInBlocklist, removeAccountFromBlocklist, removeServerFromBlocklist } from '../../../lib/blocklist'
22import { ServerBlocklistModel } from '../../../models/server/server-blocklist' 25import { ServerBlocklistModel } from '../../../models/server/server-blocklist'
23import { UserNotificationModel } from '@server/models/user/user-notification'
24import { logger } from '@server/helpers/logger'
25import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
26 26
27const myBlocklistRouter = express.Router() 27const myBlocklistRouter = express.Router()
28 28
diff --git a/server/controllers/api/users/my-history.ts b/server/controllers/api/users/my-history.ts
index 85e04925e..a6e723103 100644
--- a/server/controllers/api/users/my-history.ts
+++ b/server/controllers/api/users/my-history.ts
@@ -1,4 +1,7 @@
1import * as express from 'express' 1import * as express from 'express'
2import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
3import { getFormattedObjects } from '../../../helpers/utils'
4import { sequelizeTypescript } from '../../../initializers/database'
2import { 5import {
3 asyncMiddleware, 6 asyncMiddleware,
4 asyncRetryTransactionMiddleware, 7 asyncRetryTransactionMiddleware,
@@ -8,10 +11,7 @@ import {
8 userHistoryListValidator, 11 userHistoryListValidator,
9 userHistoryRemoveValidator 12 userHistoryRemoveValidator
10} from '../../../middlewares' 13} from '../../../middlewares'
11import { getFormattedObjects } from '../../../helpers/utils'
12import { UserVideoHistoryModel } from '../../../models/user/user-video-history' 14import { UserVideoHistoryModel } from '../../../models/user/user-video-history'
13import { sequelizeTypescript } from '../../../initializers/database'
14import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
15 15
16const myVideosHistoryRouter = express.Router() 16const myVideosHistoryRouter = express.Router()
17 17
diff --git a/server/controllers/api/users/my-video-playlists.ts b/server/controllers/api/users/my-video-playlists.ts
index d0bd99463..76e741ba5 100644
--- a/server/controllers/api/users/my-video-playlists.ts
+++ b/server/controllers/api/users/my-video-playlists.ts
@@ -1,8 +1,8 @@
1import * as express from 'express' 1import * as express from 'express'
2import { VideosExistInPlaylists } from '../../../../shared/models/videos/playlist/video-exist-in-playlist.model'
2import { asyncMiddleware, authenticate } from '../../../middlewares' 3import { asyncMiddleware, authenticate } from '../../../middlewares'
3import { doVideosInPlaylistExistValidator } from '../../../middlewares/validators/videos/video-playlists' 4import { doVideosInPlaylistExistValidator } from '../../../middlewares/validators/videos/video-playlists'
4import { VideoPlaylistModel } from '../../../models/video/video-playlist' 5import { VideoPlaylistModel } from '../../../models/video/video-playlist'
5import { VideosExistInPlaylists } from '../../../../shared/models/videos/playlist/video-exist-in-playlist.model'
6 6
7const myVideoPlaylistsRouter = express.Router() 7const myVideoPlaylistsRouter = express.Router()
8 8
diff --git a/server/controllers/api/videos/blacklist.ts b/server/controllers/api/videos/blacklist.ts
index a7f5f53d8..6bc768471 100644
--- a/server/controllers/api/videos/blacklist.ts
+++ b/server/controllers/api/videos/blacklist.ts
@@ -1,6 +1,7 @@
1import * as express from 'express' 1import * as express from 'express'
2import { blacklistVideo, unblacklistVideo } from '@server/lib/video-blacklist' 2import { blacklistVideo, unblacklistVideo } from '@server/lib/video-blacklist'
3import { UserRight, VideoBlacklistCreate } from '../../../../shared' 3import { UserRight, VideoBlacklistCreate } from '../../../../shared'
4import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
4import { logger } from '../../../helpers/logger' 5import { logger } from '../../../helpers/logger'
5import { getFormattedObjects } from '../../../helpers/utils' 6import { getFormattedObjects } from '../../../helpers/utils'
6import { sequelizeTypescript } from '../../../initializers/database' 7import { sequelizeTypescript } from '../../../initializers/database'
@@ -19,7 +20,6 @@ import {
19 videosBlacklistUpdateValidator 20 videosBlacklistUpdateValidator
20} from '../../../middlewares' 21} from '../../../middlewares'
21import { VideoBlacklistModel } from '../../../models/video/video-blacklist' 22import { VideoBlacklistModel } from '../../../models/video/video-blacklist'
22import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
23 23
24const blacklistRouter = express.Router() 24const blacklistRouter = express.Router()
25 25
diff --git a/server/controllers/api/videos/comment.ts b/server/controllers/api/videos/comment.ts
index 90b633bb5..cb696f652 100644
--- a/server/controllers/api/videos/comment.ts
+++ b/server/controllers/api/videos/comment.ts
@@ -1,6 +1,6 @@
1import * as express from 'express' 1import * as express from 'express'
2import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
3import { ResultList, ThreadsResultList, UserRight, VideoCommentCreate } from '../../../../shared/models' 2import { ResultList, ThreadsResultList, UserRight, VideoCommentCreate } from '../../../../shared/models'
3import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
4import { VideoCommentThreads } from '../../../../shared/models/videos/comment/video-comment.model' 4import { VideoCommentThreads } from '../../../../shared/models/videos/comment/video-comment.model'
5import { auditLoggerFactory, CommentAuditView, getAuditIdFromRes } from '../../../helpers/audit-logger' 5import { auditLoggerFactory, CommentAuditView, getAuditIdFromRes } from '../../../helpers/audit-logger'
6import { getFormattedObjects } from '../../../helpers/utils' 6import { getFormattedObjects } from '../../../helpers/utils'
diff --git a/server/controllers/api/videos/ownership.ts b/server/controllers/api/videos/ownership.ts
index e6c94a45a..f48acbc68 100644
--- a/server/controllers/api/videos/ownership.ts
+++ b/server/controllers/api/videos/ownership.ts
@@ -1,6 +1,12 @@
1import * as express from 'express' 1import * as express from 'express'
2import { MVideoFullLight } from '@server/types/models'
3import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
4import { VideoChangeOwnershipStatus, VideoState } from '../../../../shared/models/videos'
2import { logger } from '../../../helpers/logger' 5import { logger } from '../../../helpers/logger'
6import { getFormattedObjects } from '../../../helpers/utils'
3import { sequelizeTypescript } from '../../../initializers/database' 7import { sequelizeTypescript } from '../../../initializers/database'
8import { sendUpdateVideo } from '../../../lib/activitypub/send'
9import { changeVideoChannelShare } from '../../../lib/activitypub/share'
4import { 10import {
5 asyncMiddleware, 11 asyncMiddleware,
6 asyncRetryTransactionMiddleware, 12 asyncRetryTransactionMiddleware,
@@ -11,15 +17,9 @@ import {
11 videosChangeOwnershipValidator, 17 videosChangeOwnershipValidator,
12 videosTerminateChangeOwnershipValidator 18 videosTerminateChangeOwnershipValidator
13} from '../../../middlewares' 19} from '../../../middlewares'
20import { VideoModel } from '../../../models/video/video'
14import { VideoChangeOwnershipModel } from '../../../models/video/video-change-ownership' 21import { VideoChangeOwnershipModel } from '../../../models/video/video-change-ownership'
15import { VideoChangeOwnershipStatus, VideoState } from '../../../../shared/models/videos'
16import { VideoChannelModel } from '../../../models/video/video-channel' 22import { VideoChannelModel } from '../../../models/video/video-channel'
17import { getFormattedObjects } from '../../../helpers/utils'
18import { changeVideoChannelShare } from '../../../lib/activitypub/share'
19import { sendUpdateVideo } from '../../../lib/activitypub/send'
20import { VideoModel } from '../../../models/video/video'
21import { MVideoFullLight } from '@server/types/models'
22import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
23 23
24const ownershipVideoRouter = express.Router() 24const ownershipVideoRouter = express.Router()
25 25
diff --git a/server/controllers/api/videos/rate.ts b/server/controllers/api/videos/rate.ts
index 134c9e5ca..96f6cd886 100644
--- a/server/controllers/api/videos/rate.ts
+++ b/server/controllers/api/videos/rate.ts
@@ -1,13 +1,13 @@
1import * as express from 'express' 1import * as express from 'express'
2import { UserVideoRateUpdate } from '../../../../shared' 2import { UserVideoRateUpdate } from '../../../../shared'
3import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
3import { logger } from '../../../helpers/logger' 4import { logger } from '../../../helpers/logger'
4import { VIDEO_RATE_TYPES } from '../../../initializers/constants' 5import { VIDEO_RATE_TYPES } from '../../../initializers/constants'
6import { sequelizeTypescript } from '../../../initializers/database'
5import { getLocalRateUrl, sendVideoRateChange } from '../../../lib/activitypub/video-rates' 7import { getLocalRateUrl, sendVideoRateChange } from '../../../lib/activitypub/video-rates'
6import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videoUpdateRateValidator } from '../../../middlewares' 8import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videoUpdateRateValidator } from '../../../middlewares'
7import { AccountModel } from '../../../models/account/account' 9import { AccountModel } from '../../../models/account/account'
8import { AccountVideoRateModel } from '../../../models/account/account-video-rate' 10import { AccountVideoRateModel } from '../../../models/account/account-video-rate'
9import { sequelizeTypescript } from '../../../initializers/database'
10import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
11 11
12const rateVideoRouter = express.Router() 12const rateVideoRouter = express.Router()
13 13
diff --git a/server/controllers/api/videos/watching.ts b/server/controllers/api/videos/watching.ts
index 2899dbd9c..05c75e543 100644
--- a/server/controllers/api/videos/watching.ts
+++ b/server/controllers/api/videos/watching.ts
@@ -1,5 +1,6 @@
1import * as express from 'express' 1import * as express from 'express'
2import { UserWatchingVideo } from '../../../../shared' 2import { UserWatchingVideo } from '../../../../shared'
3import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
3import { 4import {
4 asyncMiddleware, 5 asyncMiddleware,
5 asyncRetryTransactionMiddleware, 6 asyncRetryTransactionMiddleware,
@@ -8,7 +9,6 @@ import {
8 videoWatchingValidator 9 videoWatchingValidator
9} from '../../../middlewares' 10} from '../../../middlewares'
10import { UserVideoHistoryModel } from '../../../models/user/user-video-history' 11import { UserVideoHistoryModel } from '../../../models/user/user-video-history'
11import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
12 12
13const watchingRouter = express.Router() 13const watchingRouter = express.Router()
14 14
diff --git a/server/controllers/download.ts b/server/controllers/download.ts
index 13bc66900..ddacc1b68 100644
--- a/server/controllers/download.ts
+++ b/server/controllers/download.ts
@@ -5,8 +5,7 @@ import { VideosTorrentCache } from '@server/lib/files-cache/videos-torrent-cache
5import { Hooks } from '@server/lib/plugins/hooks' 5import { Hooks } from '@server/lib/plugins/hooks'
6import { getVideoFilePath } from '@server/lib/video-paths' 6import { getVideoFilePath } from '@server/lib/video-paths'
7import { MStreamingPlaylist, MVideo, MVideoFile, MVideoFullLight } from '@server/types/models' 7import { MStreamingPlaylist, MVideo, MVideoFile, MVideoFullLight } from '@server/types/models'
8import { HttpStatusCode } from '@shared/models' 8import { HttpStatusCode, VideoStreamingPlaylistType } from '@shared/models'
9import { VideoStreamingPlaylistType } from '@shared/models'
10import { STATIC_DOWNLOAD_PATHS } from '../initializers/constants' 9import { STATIC_DOWNLOAD_PATHS } from '../initializers/constants'
11import { asyncMiddleware, videosDownloadValidator } from '../middlewares' 10import { asyncMiddleware, videosDownloadValidator } from '../middlewares'
12 11
diff --git a/server/middlewares/cache.ts b/server/middlewares/cache.ts
index 1ced06042..e508b22a6 100644
--- a/server/middlewares/cache.ts
+++ b/server/middlewares/cache.ts
@@ -1,6 +1,6 @@
1import { Redis } from '../lib/redis'
2import * as apicache from 'apicache' 1import * as apicache from 'apicache'
3import { HttpStatusCode } from '../../shared/models/http/http-error-codes' 2import { HttpStatusCode } from '../../shared/models/http/http-error-codes'
3import { Redis } from '../lib/redis'
4 4
5// Ensure Redis is initialized 5// Ensure Redis is initialized
6Redis.Instance.init() 6Redis.Instance.init()
diff --git a/server/middlewares/servers.ts b/server/middlewares/servers.ts
index 49a2241b3..cf70d901e 100644
--- a/server/middlewares/servers.ts
+++ b/server/middlewares/servers.ts
@@ -1,6 +1,6 @@
1import * as express from 'express' 1import * as express from 'express'
2import { getHostWithPort } from '../helpers/express-utils'
3import { HttpStatusCode } from '../../shared/models/http/http-error-codes' 2import { HttpStatusCode } from '../../shared/models/http/http-error-codes'
3import { getHostWithPort } from '../helpers/express-utils'
4 4
5function setBodyHostsPort (req: express.Request, res: express.Response, next: express.NextFunction) { 5function setBodyHostsPort (req: express.Request, res: express.Response, next: express.NextFunction) {
6 if (!req.body.hosts) return next() 6 if (!req.body.hosts) return next()
diff --git a/server/middlewares/user-right.ts b/server/middlewares/user-right.ts
index 87a1766cf..c8c694f05 100644
--- a/server/middlewares/user-right.ts
+++ b/server/middlewares/user-right.ts
@@ -1,7 +1,7 @@
1import * as express from 'express' 1import * as express from 'express'
2import { UserRight } from '../../shared' 2import { UserRight } from '../../shared'
3import { logger } from '../helpers/logger'
4import { HttpStatusCode } from '../../shared/models/http/http-error-codes' 3import { HttpStatusCode } from '../../shared/models/http/http-error-codes'
4import { logger } from '../helpers/logger'
5 5
6function ensureUserHasRight (userRight: UserRight) { 6function ensureUserHasRight (userRight: UserRight) {
7 return function (req: express.Request, res: express.Response, next: express.NextFunction) { 7 return function (req: express.Request, res: express.Response, next: express.NextFunction) {
diff --git a/server/middlewares/validators/activitypub/activity.ts b/server/middlewares/validators/activitypub/activity.ts
index d65a8e455..d24e4427b 100644
--- a/server/middlewares/validators/activitypub/activity.ts
+++ b/server/middlewares/validators/activitypub/activity.ts
@@ -1,8 +1,8 @@
1import * as express from 'express' 1import * as express from 'express'
2import { isRootActivityValid } from '../../../helpers/custom-validators/activitypub/activity'
3import { logger } from '../../../helpers/logger'
4import { getServerActor } from '@server/models/application/application' 2import { getServerActor } from '@server/models/application/application'
5import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' 3import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
4import { isRootActivityValid } from '../../../helpers/custom-validators/activitypub/activity'
5import { logger } from '../../../helpers/logger'
6 6
7async function activityPubValidator (req: express.Request, res: express.Response, next: express.NextFunction) { 7async function activityPubValidator (req: express.Request, res: express.Response, next: express.NextFunction) {
8 logger.debug('Checking activity pub parameters') 8 logger.debug('Checking activity pub parameters')
diff --git a/server/middlewares/validators/bulk.ts b/server/middlewares/validators/bulk.ts
index 4057b1e01..6fec58149 100644
--- a/server/middlewares/validators/bulk.ts
+++ b/server/middlewares/validators/bulk.ts
@@ -1,8 +1,7 @@
1import * as express from 'express' 1import * as express from 'express'
2import { body } from 'express-validator' 2import { body } from 'express-validator'
3import { isBulkRemoveCommentsOfScopeValid } from '@server/helpers/custom-validators/bulk' 3import { isBulkRemoveCommentsOfScopeValid } from '@server/helpers/custom-validators/bulk'
4import { HttpStatusCode } from '@shared/models' 4import { HttpStatusCode, UserRight } from '@shared/models'
5import { UserRight } from '@shared/models'
6import { BulkRemoveCommentsOfBody } from '@shared/models/bulk/bulk-remove-comments-of-body.model' 5import { BulkRemoveCommentsOfBody } from '@shared/models/bulk/bulk-remove-comments-of-body.model'
7import { logger } from '../../helpers/logger' 6import { logger } from '../../helpers/logger'
8import { areValidationErrors, doesAccountNameWithHostExist } from './shared' 7import { areValidationErrors, doesAccountNameWithHostExist } from './shared'
diff --git a/server/middlewares/validators/feeds.ts b/server/middlewares/validators/feeds.ts
index 1a5a8ffa0..d29bebf64 100644
--- a/server/middlewares/validators/feeds.ts
+++ b/server/middlewares/validators/feeds.ts
@@ -1,6 +1,5 @@
1import * as express from 'express' 1import * as express from 'express'
2import { param, query } from 'express-validator' 2import { param, query } from 'express-validator'
3
4import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' 3import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'
5import { isValidRSSFeed } from '../../helpers/custom-validators/feeds' 4import { isValidRSSFeed } from '../../helpers/custom-validators/feeds'
6import { exists, isIdOrUUIDValid, isIdValid, toCompleteUUID } from '../../helpers/custom-validators/misc' 5import { exists, isIdOrUUIDValid, isIdValid, toCompleteUUID } from '../../helpers/custom-validators/misc'
diff --git a/server/middlewares/validators/shared/videos.ts b/server/middlewares/validators/shared/videos.ts
index 7f42a4893..71b81654f 100644
--- a/server/middlewares/validators/shared/videos.ts
+++ b/server/middlewares/validators/shared/videos.ts
@@ -12,8 +12,7 @@ import {
12 MVideoImmutable, 12 MVideoImmutable,
13 MVideoThumbnail 13 MVideoThumbnail
14} from '@server/types/models' 14} from '@server/types/models'
15import { HttpStatusCode } from '@shared/models' 15import { HttpStatusCode, UserRight } from '@shared/models'
16import { UserRight } from '@shared/models'
17 16
18async function doesVideoExist (id: number | string, res: Response, fetchType: VideoLoadType = 'all') { 17async function doesVideoExist (id: number | string, res: Response, fetchType: VideoLoadType = 'all') {
19 const userId = res.locals.oauth ? res.locals.oauth.token.User.id : undefined 18 const userId = res.locals.oauth ? res.locals.oauth.token.User.id : undefined
diff --git a/server/middlewares/validators/videos/video-live.ts b/server/middlewares/validators/videos/video-live.ts
index 5c8a4269d..97e8b4510 100644
--- a/server/middlewares/validators/videos/video-live.ts
+++ b/server/middlewares/validators/videos/video-live.ts
@@ -5,8 +5,7 @@ import { isLocalLiveVideoAccepted } from '@server/lib/moderation'
5import { Hooks } from '@server/lib/plugins/hooks' 5import { Hooks } from '@server/lib/plugins/hooks'
6import { VideoModel } from '@server/models/video/video' 6import { VideoModel } from '@server/models/video/video'
7import { VideoLiveModel } from '@server/models/video/video-live' 7import { VideoLiveModel } from '@server/models/video/video-live'
8import { HttpStatusCode } from '@shared/models' 8import { HttpStatusCode, ServerErrorCode, UserRight, VideoState } from '@shared/models'
9import { ServerErrorCode, UserRight, VideoState } from '@shared/models'
10import { isBooleanValid, isIdValid, toBooleanOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc' 9import { isBooleanValid, isIdValid, toBooleanOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc'
11import { isVideoNameValid } from '../../../helpers/custom-validators/videos' 10import { isVideoNameValid } from '../../../helpers/custom-validators/videos'
12import { cleanUpReqFiles } from '../../../helpers/express-utils' 11import { cleanUpReqFiles } from '../../../helpers/express-utils'
diff --git a/server/middlewares/validators/videos/video-ownership-changes.ts b/server/middlewares/validators/videos/video-ownership-changes.ts
index 06f86a4c8..a7f0b72c3 100644
--- a/server/middlewares/validators/videos/video-ownership-changes.ts
+++ b/server/middlewares/validators/videos/video-ownership-changes.ts
@@ -6,8 +6,14 @@ import { logger } from '@server/helpers/logger'
6import { isAbleToUploadVideo } from '@server/lib/user' 6import { isAbleToUploadVideo } from '@server/lib/user'
7import { AccountModel } from '@server/models/account/account' 7import { AccountModel } from '@server/models/account/account'
8import { MVideoWithAllFiles } from '@server/types/models' 8import { MVideoWithAllFiles } from '@server/types/models'
9import { HttpStatusCode } from '@shared/models' 9import {
10import { ServerErrorCode, UserRight, VideoChangeOwnershipAccept, VideoChangeOwnershipStatus, VideoState } from '@shared/models' 10 HttpStatusCode,
11 ServerErrorCode,
12 UserRight,
13 VideoChangeOwnershipAccept,
14 VideoChangeOwnershipStatus,
15 VideoState
16} from '@shared/models'
11import { 17import {
12 areValidationErrors, 18 areValidationErrors,
13 checkUserCanManageVideo, 19 checkUserCanManageVideo,
diff --git a/server/tests/api/activitypub/cleaner.ts b/server/tests/api/activitypub/cleaner.ts
index a5ce449f3..51cf6e599 100644
--- a/server/tests/api/activitypub/cleaner.ts
+++ b/server/tests/api/activitypub/cleaner.ts
@@ -4,8 +4,8 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 doubleFollow,
8 createMultipleServers, 7 createMultipleServers,
8 doubleFollow,
9 PeerTubeServer, 9 PeerTubeServer,
10 setAccessTokensToServers, 10 setAccessTokensToServers,
11 wait, 11 wait,
diff --git a/server/tests/api/activitypub/client.ts b/server/tests/api/activitypub/client.ts
index 53cc40663..c3e4b7f74 100644
--- a/server/tests/api/activitypub/client.ts
+++ b/server/tests/api/activitypub/client.ts
@@ -2,17 +2,16 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/models'
6import { 5import {
7 cleanupTests, 6 cleanupTests,
8 doubleFollow,
9 createMultipleServers, 7 createMultipleServers,
8 doubleFollow,
10 makeActivityPubGetRequest, 9 makeActivityPubGetRequest,
11 PeerTubeServer, 10 PeerTubeServer,
12 setAccessTokensToServers, 11 setAccessTokensToServers,
13 setDefaultVideoChannel 12 setDefaultVideoChannel
14} from '@shared/extra-utils' 13} from '@shared/extra-utils'
15import { VideoPlaylistPrivacy } from '@shared/models' 14import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models'
16 15
17const expect = chai.expect 16const expect = chai.expect
18 17
diff --git a/server/tests/api/activitypub/fetch.ts b/server/tests/api/activitypub/fetch.ts
index ddfe6cfe0..422a75d6e 100644
--- a/server/tests/api/activitypub/fetch.ts
+++ b/server/tests/api/activitypub/fetch.ts
@@ -2,7 +2,7 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' 5import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
6 6
7const expect = chai.expect 7const expect = chai.expect
8 8
diff --git a/server/tests/api/activitypub/refresher.ts b/server/tests/api/activitypub/refresher.ts
index a0b72c7e6..81fee0044 100644
--- a/server/tests/api/activitypub/refresher.ts
+++ b/server/tests/api/activitypub/refresher.ts
@@ -1,11 +1,10 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import 'mocha' 3import 'mocha'
4import { HttpStatusCode } from '@shared/models'
5import { 4import {
6 cleanupTests, 5 cleanupTests,
7 doubleFollow,
8 createMultipleServers, 6 createMultipleServers,
7 doubleFollow,
9 killallServers, 8 killallServers,
10 PeerTubeServer, 9 PeerTubeServer,
11 setAccessTokensToServers, 10 setAccessTokensToServers,
@@ -13,7 +12,7 @@ import {
13 wait, 12 wait,
14 waitJobs 13 waitJobs
15} from '@shared/extra-utils' 14} from '@shared/extra-utils'
16import { VideoPlaylistPrivacy } from '@shared/models' 15import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models'
17 16
18describe('Test AP refresher', function () { 17describe('Test AP refresher', function () {
19 let servers: PeerTubeServer[] = [] 18 let servers: PeerTubeServer[] = []
diff --git a/server/tests/api/check-params/abuses.ts b/server/tests/api/check-params/abuses.ts
index 87d93195c..72f2cbd8f 100644
--- a/server/tests/api/check-params/abuses.ts
+++ b/server/tests/api/check-params/abuses.ts
@@ -1,22 +1,21 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import 'mocha' 3import 'mocha'
4import { HttpStatusCode } from '@shared/models'
5import { 4import {
6 AbusesCommand, 5 AbusesCommand,
7 checkBadCountPagination, 6 checkBadCountPagination,
8 checkBadSortPagination, 7 checkBadSortPagination,
9 checkBadStartPagination, 8 checkBadStartPagination,
10 cleanupTests, 9 cleanupTests,
11 doubleFollow,
12 createSingleServer, 10 createSingleServer,
11 doubleFollow,
13 makeGetRequest, 12 makeGetRequest,
14 makePostBodyRequest, 13 makePostBodyRequest,
15 PeerTubeServer, 14 PeerTubeServer,
16 setAccessTokensToServers, 15 setAccessTokensToServers,
17 waitJobs 16 waitJobs
18} from '@shared/extra-utils' 17} from '@shared/extra-utils'
19import { AbuseCreate, AbuseState } from '@shared/models' 18import { AbuseCreate, AbuseState, HttpStatusCode } from '@shared/models'
20 19
21describe('Test abuses API validators', function () { 20describe('Test abuses API validators', function () {
22 const basePath = '/api/v1/abuses/' 21 const basePath = '/api/v1/abuses/'
diff --git a/server/tests/api/check-params/accounts.ts b/server/tests/api/check-params/accounts.ts
index 0cae485d9..141d869b7 100644
--- a/server/tests/api/check-params/accounts.ts
+++ b/server/tests/api/check-params/accounts.ts
@@ -1,7 +1,6 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import 'mocha' 3import 'mocha'
4import { HttpStatusCode } from '@shared/models'
5import { 4import {
6 checkBadCountPagination, 5 checkBadCountPagination,
7 checkBadSortPagination, 6 checkBadSortPagination,
@@ -10,6 +9,7 @@ import {
10 createSingleServer, 9 createSingleServer,
11 PeerTubeServer 10 PeerTubeServer
12} from '@shared/extra-utils' 11} from '@shared/extra-utils'
12import { HttpStatusCode } from '@shared/models'
13 13
14describe('Test accounts API validators', function () { 14describe('Test accounts API validators', function () {
15 const path = '/api/v1/accounts/' 15 const path = '/api/v1/accounts/'
diff --git a/server/tests/api/check-params/config.ts b/server/tests/api/check-params/config.ts
index c3438917e..87cb2287e 100644
--- a/server/tests/api/check-params/config.ts
+++ b/server/tests/api/check-params/config.ts
@@ -2,7 +2,6 @@
2 2
3import 'mocha' 3import 'mocha'
4import { omit } from 'lodash' 4import { omit } from 'lodash'
5import { HttpStatusCode } from '@shared/models'
6import { 5import {
7 cleanupTests, 6 cleanupTests,
8 createSingleServer, 7 createSingleServer,
@@ -12,7 +11,7 @@ import {
12 PeerTubeServer, 11 PeerTubeServer,
13 setAccessTokensToServers 12 setAccessTokensToServers
14} from '@shared/extra-utils' 13} from '@shared/extra-utils'
15import { CustomConfig } from '@shared/models' 14import { CustomConfig, HttpStatusCode } from '@shared/models'
16 15
17describe('Test config API validators', function () { 16describe('Test config API validators', function () {
18 const path = '/api/v1/config/custom' 17 const path = '/api/v1/config/custom'
diff --git a/server/tests/api/check-params/contact-form.ts b/server/tests/api/check-params/contact-form.ts
index 8e755c69b..1df9993da 100644
--- a/server/tests/api/check-params/contact-form.ts
+++ b/server/tests/api/check-params/contact-form.ts
@@ -1,9 +1,9 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import 'mocha' 3import 'mocha'
4import { HttpStatusCode } from '@shared/models'
5import { cleanupTests, createSingleServer, killallServers, MockSmtpServer, PeerTubeServer } from '@shared/extra-utils' 4import { cleanupTests, createSingleServer, killallServers, MockSmtpServer, PeerTubeServer } from '@shared/extra-utils'
6import { ContactFormCommand } from '@shared/extra-utils/server' 5import { ContactFormCommand } from '@shared/extra-utils/server'
6import { HttpStatusCode } from '@shared/models'
7 7
8describe('Test contact form API validators', function () { 8describe('Test contact form API validators', function () {
9 let server: PeerTubeServer 9 let server: PeerTubeServer
diff --git a/server/tests/api/check-params/live.ts b/server/tests/api/check-params/live.ts
index 0ef86a538..700b4724d 100644
--- a/server/tests/api/check-params/live.ts
+++ b/server/tests/api/check-params/live.ts
@@ -2,7 +2,6 @@
2 2
3import 'mocha' 3import 'mocha'
4import { omit } from 'lodash' 4import { omit } from 'lodash'
5import { HttpStatusCode } from '@shared/models'
6import { 5import {
7 buildAbsoluteFixturePath, 6 buildAbsoluteFixturePath,
8 cleanupTests, 7 cleanupTests,
@@ -10,12 +9,12 @@ import {
10 LiveCommand, 9 LiveCommand,
11 makePostBodyRequest, 10 makePostBodyRequest,
12 makeUploadRequest, 11 makeUploadRequest,
13 sendRTMPStream,
14 PeerTubeServer, 12 PeerTubeServer,
13 sendRTMPStream,
15 setAccessTokensToServers, 14 setAccessTokensToServers,
16 stopFfmpeg 15 stopFfmpeg
17} from '@shared/extra-utils' 16} from '@shared/extra-utils'
18import { VideoCreateResult, VideoPrivacy } from '@shared/models' 17import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models'
19 18
20describe('Test video lives API validator', function () { 19describe('Test video lives API validator', function () {
21 const path = '/api/v1/videos/live' 20 const path = '/api/v1/videos/live'
diff --git a/server/tests/api/check-params/plugins.ts b/server/tests/api/check-params/plugins.ts
index d3dda7fce..33f84ecbc 100644
--- a/server/tests/api/check-params/plugins.ts
+++ b/server/tests/api/check-params/plugins.ts
@@ -1,7 +1,6 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import 'mocha' 3import 'mocha'
4import { HttpStatusCode } from '@shared/models'
5import { 4import {
6 checkBadCountPagination, 5 checkBadCountPagination,
7 checkBadSortPagination, 6 checkBadSortPagination,
@@ -14,7 +13,7 @@ import {
14 PeerTubeServer, 13 PeerTubeServer,
15 setAccessTokensToServers 14 setAccessTokensToServers
16} from '@shared/extra-utils' 15} from '@shared/extra-utils'
17import { PeerTubePlugin, PluginType } from '@shared/models' 16import { HttpStatusCode, PeerTubePlugin, PluginType } from '@shared/models'
18 17
19describe('Test server plugins API validators', function () { 18describe('Test server plugins API validators', function () {
20 let server: PeerTubeServer 19 let server: PeerTubeServer
diff --git a/server/tests/api/check-params/search.ts b/server/tests/api/check-params/search.ts
index b49169e38..a3da54e1f 100644
--- a/server/tests/api/check-params/search.ts
+++ b/server/tests/api/check-params/search.ts
@@ -1,7 +1,6 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import 'mocha' 3import 'mocha'
4import { HttpStatusCode } from '@shared/models'
5import { 4import {
6 checkBadCountPagination, 5 checkBadCountPagination,
7 checkBadSortPagination, 6 checkBadSortPagination,
@@ -12,6 +11,7 @@ import {
12 PeerTubeServer, 11 PeerTubeServer,
13 setAccessTokensToServers 12 setAccessTokensToServers
14} from '@shared/extra-utils' 13} from '@shared/extra-utils'
14import { HttpStatusCode } from '@shared/models'
15 15
16function updateSearchIndex (server: PeerTubeServer, enabled: boolean, disableLocalSearch = false) { 16function updateSearchIndex (server: PeerTubeServer, enabled: boolean, disableLocalSearch = false) {
17 return server.config.updateCustomSubConfig({ 17 return server.config.updateCustomSubConfig({
diff --git a/server/tests/api/check-params/services.ts b/server/tests/api/check-params/services.ts
index 973b25598..4c4a5cade 100644
--- a/server/tests/api/check-params/services.ts
+++ b/server/tests/api/check-params/services.ts
@@ -1,7 +1,6 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import 'mocha' 3import 'mocha'
4import { HttpStatusCode } from '@shared/models'
5import { 4import {
6 cleanupTests, 5 cleanupTests,
7 createSingleServer, 6 createSingleServer,
@@ -10,7 +9,7 @@ import {
10 setAccessTokensToServers, 9 setAccessTokensToServers,
11 setDefaultVideoChannel 10 setDefaultVideoChannel
12} from '@shared/extra-utils' 11} from '@shared/extra-utils'
13import { VideoPlaylistPrivacy } from '@shared/models' 12import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models'
14 13
15describe('Test services API validators', function () { 14describe('Test services API validators', function () {
16 let server: PeerTubeServer 15 let server: PeerTubeServer
diff --git a/server/tests/api/check-params/user-notifications.ts b/server/tests/api/check-params/user-notifications.ts
index 3b709ee5a..17edf5aa1 100644
--- a/server/tests/api/check-params/user-notifications.ts
+++ b/server/tests/api/check-params/user-notifications.ts
@@ -2,7 +2,6 @@
2 2
3import 'mocha' 3import 'mocha'
4import { io } from 'socket.io-client' 4import { io } from 'socket.io-client'
5import { HttpStatusCode } from '@shared/models'
6import { 5import {
7 checkBadCountPagination, 6 checkBadCountPagination,
8 checkBadSortPagination, 7 checkBadSortPagination,
@@ -16,7 +15,7 @@ import {
16 setAccessTokensToServers, 15 setAccessTokensToServers,
17 wait 16 wait
18} from '@shared/extra-utils' 17} from '@shared/extra-utils'
19import { UserNotificationSetting, UserNotificationSettingValue } from '@shared/models' 18import { HttpStatusCode, UserNotificationSetting, UserNotificationSettingValue } from '@shared/models'
20 19
21describe('Test user notifications API validators', function () { 20describe('Test user notifications API validators', function () {
22 let server: PeerTubeServer 21 let server: PeerTubeServer
diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts
index 34fe309f9..9d8f933db 100644
--- a/server/tests/api/check-params/users.ts
+++ b/server/tests/api/check-params/users.ts
@@ -2,7 +2,6 @@
2 2
3import 'mocha' 3import 'mocha'
4import { omit } from 'lodash' 4import { omit } from 'lodash'
5import { HttpStatusCode } from '@shared/models'
6import { 5import {
7 buildAbsoluteFixturePath, 6 buildAbsoluteFixturePath,
8 checkBadCountPagination, 7 checkBadCountPagination,
@@ -20,7 +19,7 @@ import {
20 setAccessTokensToServers, 19 setAccessTokensToServers,
21 UsersCommand 20 UsersCommand
22} from '@shared/extra-utils' 21} from '@shared/extra-utils'
23import { UserAdminFlag, UserRole, VideoCreateResult } from '@shared/models' 22import { HttpStatusCode, UserAdminFlag, UserRole, VideoCreateResult } from '@shared/models'
24 23
25describe('Test users API validators', function () { 24describe('Test users API validators', function () {
26 const path = '/api/v1/users/' 25 const path = '/api/v1/users/'
diff --git a/server/tests/api/check-params/video-blacklist.ts b/server/tests/api/check-params/video-blacklist.ts
index 2072df4b6..d28c6a952 100644
--- a/server/tests/api/check-params/video-blacklist.ts
+++ b/server/tests/api/check-params/video-blacklist.ts
@@ -2,22 +2,21 @@
2 2
3import 'mocha' 3import 'mocha'
4import { expect } from 'chai' 4import { expect } from 'chai'
5import { HttpStatusCode } from '@shared/models'
6import { 5import {
7 BlacklistCommand, 6 BlacklistCommand,
8 checkBadCountPagination, 7 checkBadCountPagination,
9 checkBadSortPagination, 8 checkBadSortPagination,
10 checkBadStartPagination, 9 checkBadStartPagination,
11 cleanupTests, 10 cleanupTests,
12 doubleFollow,
13 createMultipleServers, 11 createMultipleServers,
12 doubleFollow,
14 makePostBodyRequest, 13 makePostBodyRequest,
15 makePutBodyRequest, 14 makePutBodyRequest,
16 PeerTubeServer, 15 PeerTubeServer,
17 setAccessTokensToServers, 16 setAccessTokensToServers,
18 waitJobs 17 waitJobs
19} from '@shared/extra-utils' 18} from '@shared/extra-utils'
20import { VideoBlacklistType } from '@shared/models' 19import { HttpStatusCode, VideoBlacklistType } from '@shared/models'
21 20
22describe('Test video blacklist API validators', function () { 21describe('Test video blacklist API validators', function () {
23 let servers: PeerTubeServer[] 22 let servers: PeerTubeServer[]
diff --git a/server/tests/api/check-params/video-captions.ts b/server/tests/api/check-params/video-captions.ts
index 1b3d1aa95..5aaeb27fe 100644
--- a/server/tests/api/check-params/video-captions.ts
+++ b/server/tests/api/check-params/video-captions.ts
@@ -1,7 +1,6 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import 'mocha' 3import 'mocha'
4import { HttpStatusCode } from '@shared/models'
5import { 4import {
6 buildAbsoluteFixturePath, 5 buildAbsoluteFixturePath,
7 cleanupTests, 6 cleanupTests,
@@ -12,7 +11,7 @@ import {
12 PeerTubeServer, 11 PeerTubeServer,
13 setAccessTokensToServers 12 setAccessTokensToServers
14} from '@shared/extra-utils' 13} from '@shared/extra-utils'
15import { VideoCreateResult } from '@shared/models' 14import { HttpStatusCode, VideoCreateResult } from '@shared/models'
16 15
17describe('Test video captions API validator', function () { 16describe('Test video captions API validator', function () {
18 const path = '/api/v1/videos/' 17 const path = '/api/v1/videos/'
diff --git a/server/tests/api/check-params/video-channels.ts b/server/tests/api/check-params/video-channels.ts
index bbe42e43d..2e63916d4 100644
--- a/server/tests/api/check-params/video-channels.ts
+++ b/server/tests/api/check-params/video-channels.ts
@@ -3,7 +3,6 @@
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { omit } from 'lodash' 5import { omit } from 'lodash'
6import { HttpStatusCode } from '@shared/models'
7import { 6import {
8 buildAbsoluteFixturePath, 7 buildAbsoluteFixturePath,
9 ChannelsCommand, 8 ChannelsCommand,
@@ -19,7 +18,7 @@ import {
19 PeerTubeServer, 18 PeerTubeServer,
20 setAccessTokensToServers 19 setAccessTokensToServers
21} from '@shared/extra-utils' 20} from '@shared/extra-utils'
22import { VideoChannelUpdate } from '@shared/models' 21import { HttpStatusCode, VideoChannelUpdate } from '@shared/models'
23 22
24const expect = chai.expect 23const expect = chai.expect
25 24
diff --git a/server/tests/api/check-params/video-comments.ts b/server/tests/api/check-params/video-comments.ts
index bfd9e0172..2d9ee1e0d 100644
--- a/server/tests/api/check-params/video-comments.ts
+++ b/server/tests/api/check-params/video-comments.ts
@@ -2,7 +2,6 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/models'
6import { 5import {
7 checkBadCountPagination, 6 checkBadCountPagination,
8 checkBadSortPagination, 7 checkBadSortPagination,
@@ -15,7 +14,7 @@ import {
15 PeerTubeServer, 14 PeerTubeServer,
16 setAccessTokensToServers 15 setAccessTokensToServers
17} from '@shared/extra-utils' 16} from '@shared/extra-utils'
18import { VideoCreateResult } from '@shared/models' 17import { HttpStatusCode, VideoCreateResult } from '@shared/models'
19 18
20const expect = chai.expect 19const expect = chai.expect
21 20
diff --git a/server/tests/api/check-params/video-imports.ts b/server/tests/api/check-params/video-imports.ts
index 957556c9b..d6d745488 100644
--- a/server/tests/api/check-params/video-imports.ts
+++ b/server/tests/api/check-params/video-imports.ts
@@ -2,7 +2,6 @@
2 2
3import 'mocha' 3import 'mocha'
4import { omit } from 'lodash' 4import { omit } from 'lodash'
5import { HttpStatusCode } from '@shared/models'
6import { 5import {
7 buildAbsoluteFixturePath, 6 buildAbsoluteFixturePath,
8 checkBadCountPagination, 7 checkBadCountPagination,
@@ -17,7 +16,7 @@ import {
17 PeerTubeServer, 16 PeerTubeServer,
18 setAccessTokensToServers 17 setAccessTokensToServers
19} from '@shared/extra-utils' 18} from '@shared/extra-utils'
20import { VideoPrivacy } from '@shared/models' 19import { HttpStatusCode, VideoPrivacy } from '@shared/models'
21 20
22describe('Test video imports API validator', function () { 21describe('Test video imports API validator', function () {
23 const path = '/api/v1/videos/imports' 22 const path = '/api/v1/videos/imports'
diff --git a/server/tests/api/check-params/video-playlists.ts b/server/tests/api/check-params/video-playlists.ts
index 7dcb4935a..e4d541b48 100644
--- a/server/tests/api/check-params/video-playlists.ts
+++ b/server/tests/api/check-params/video-playlists.ts
@@ -1,7 +1,6 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import 'mocha' 3import 'mocha'
4import { HttpStatusCode } from '@shared/models'
5import { 4import {
6 checkBadCountPagination, 5 checkBadCountPagination,
7 checkBadSortPagination, 6 checkBadSortPagination,
@@ -9,12 +8,13 @@ import {
9 cleanupTests, 8 cleanupTests,
10 createSingleServer, 9 createSingleServer,
11 makeGetRequest, 10 makeGetRequest,
12 PlaylistsCommand,
13 PeerTubeServer, 11 PeerTubeServer,
12 PlaylistsCommand,
14 setAccessTokensToServers, 13 setAccessTokensToServers,
15 setDefaultVideoChannel 14 setDefaultVideoChannel
16} from '@shared/extra-utils' 15} from '@shared/extra-utils'
17import { 16import {
17 HttpStatusCode,
18 VideoPlaylistCreate, 18 VideoPlaylistCreate,
19 VideoPlaylistCreateResult, 19 VideoPlaylistCreateResult,
20 VideoPlaylistElementCreate, 20 VideoPlaylistElementCreate,
diff --git a/server/tests/api/check-params/videos-filter.ts b/server/tests/api/check-params/videos-filter.ts
index c2c69904f..d08570bbe 100644
--- a/server/tests/api/check-params/videos-filter.ts
+++ b/server/tests/api/check-params/videos-filter.ts
@@ -1,7 +1,6 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import 'mocha' 3import 'mocha'
4import { HttpStatusCode } from '@shared/models'
5import { 4import {
6 cleanupTests, 5 cleanupTests,
7 createSingleServer, 6 createSingleServer,
@@ -10,7 +9,7 @@ import {
10 setAccessTokensToServers, 9 setAccessTokensToServers,
11 setDefaultVideoChannel 10 setDefaultVideoChannel
12} from '@shared/extra-utils' 11} from '@shared/extra-utils'
13import { UserRole } from '@shared/models' 12import { HttpStatusCode, UserRole } from '@shared/models'
14 13
15async function testEndpoints (server: PeerTubeServer, token: string, filter: string, expectedStatus: HttpStatusCode) { 14async function testEndpoints (server: PeerTubeServer, token: string, filter: string, expectedStatus: HttpStatusCode) {
16 const paths = [ 15 const paths = [
diff --git a/server/tests/api/check-params/videos-history.ts b/server/tests/api/check-params/videos-history.ts
index 7283a4d28..c3c309ed2 100644
--- a/server/tests/api/check-params/videos-history.ts
+++ b/server/tests/api/check-params/videos-history.ts
@@ -1,7 +1,6 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import 'mocha' 3import 'mocha'
4import { HttpStatusCode } from '@shared/models'
5import { 4import {
6 checkBadCountPagination, 5 checkBadCountPagination,
7 checkBadStartPagination, 6 checkBadStartPagination,
@@ -13,6 +12,7 @@ import {
13 PeerTubeServer, 12 PeerTubeServer,
14 setAccessTokensToServers 13 setAccessTokensToServers
15} from '@shared/extra-utils' 14} from '@shared/extra-utils'
15import { HttpStatusCode } from '@shared/models'
16 16
17describe('Test videos history API validator', function () { 17describe('Test videos history API validator', function () {
18 const myHistoryPath = '/api/v1/users/me/history/videos' 18 const myHistoryPath = '/api/v1/users/me/history/videos'
diff --git a/server/tests/api/live/live-constraints.ts b/server/tests/api/live/live-constraints.ts
index a00833569..20346113d 100644
--- a/server/tests/api/live/live-constraints.ts
+++ b/server/tests/api/live/live-constraints.ts
@@ -7,8 +7,8 @@ import {
7 checkLiveCleanup, 7 checkLiveCleanup,
8 cleanupTests, 8 cleanupTests,
9 ConfigCommand, 9 ConfigCommand,
10 doubleFollow,
11 createMultipleServers, 10 createMultipleServers,
11 doubleFollow,
12 PeerTubeServer, 12 PeerTubeServer,
13 setAccessTokensToServers, 13 setAccessTokensToServers,
14 setDefaultVideoChannel, 14 setDefaultVideoChannel,
diff --git a/server/tests/api/live/live-permanent.ts b/server/tests/api/live/live-permanent.ts
index 30d499e20..f07d4cfec 100644
--- a/server/tests/api/live/live-permanent.ts
+++ b/server/tests/api/live/live-permanent.ts
@@ -6,8 +6,8 @@ import { LiveVideoCreate, VideoPrivacy, VideoState } from '@shared/models'
6import { 6import {
7 cleanupTests, 7 cleanupTests,
8 ConfigCommand, 8 ConfigCommand,
9 doubleFollow,
10 createMultipleServers, 9 createMultipleServers,
10 doubleFollow,
11 PeerTubeServer, 11 PeerTubeServer,
12 setAccessTokensToServers, 12 setAccessTokensToServers,
13 setDefaultVideoChannel, 13 setDefaultVideoChannel,
diff --git a/server/tests/api/live/live-save-replay.ts b/server/tests/api/live/live-save-replay.ts
index 095c51b97..bd15396ec 100644
--- a/server/tests/api/live/live-save-replay.ts
+++ b/server/tests/api/live/live-save-replay.ts
@@ -3,13 +3,12 @@
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { FfmpegCommand } from 'fluent-ffmpeg' 5import { FfmpegCommand } from 'fluent-ffmpeg'
6import { HttpStatusCode } from '@shared/models'
7import { 6import {
8 checkLiveCleanup, 7 checkLiveCleanup,
9 cleanupTests, 8 cleanupTests,
10 ConfigCommand, 9 ConfigCommand,
11 doubleFollow,
12 createMultipleServers, 10 createMultipleServers,
11 doubleFollow,
13 PeerTubeServer, 12 PeerTubeServer,
14 setAccessTokensToServers, 13 setAccessTokensToServers,
15 setDefaultVideoChannel, 14 setDefaultVideoChannel,
@@ -18,7 +17,7 @@ import {
18 wait, 17 wait,
19 waitJobs 18 waitJobs
20} from '@shared/extra-utils' 19} from '@shared/extra-utils'
21import { LiveVideoCreate, VideoPrivacy, VideoState } from '@shared/models' 20import { HttpStatusCode, LiveVideoCreate, VideoPrivacy, VideoState } from '@shared/models'
22 21
23const expect = chai.expect 22const expect = chai.expect
24 23
diff --git a/server/tests/api/live/live-socket-messages.ts b/server/tests/api/live/live-socket-messages.ts
index 3808964d1..2a1f9f108 100644
--- a/server/tests/api/live/live-socket-messages.ts
+++ b/server/tests/api/live/live-socket-messages.ts
@@ -5,8 +5,8 @@ import * as chai from 'chai'
5import { VideoPrivacy, VideoState } from '@shared/models' 5import { VideoPrivacy, VideoState } from '@shared/models'
6import { 6import {
7 cleanupTests, 7 cleanupTests,
8 doubleFollow,
9 createMultipleServers, 8 createMultipleServers,
9 doubleFollow,
10 PeerTubeServer, 10 PeerTubeServer,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 setDefaultVideoChannel, 12 setDefaultVideoChannel,
diff --git a/server/tests/api/live/live-views.ts b/server/tests/api/live/live-views.ts
index 4a137b185..5e3a79c64 100644
--- a/server/tests/api/live/live-views.ts
+++ b/server/tests/api/live/live-views.ts
@@ -6,8 +6,8 @@ import { FfmpegCommand } from 'fluent-ffmpeg'
6import { VideoPrivacy } from '@shared/models' 6import { VideoPrivacy } from '@shared/models'
7import { 7import {
8 cleanupTests, 8 cleanupTests,
9 doubleFollow,
10 createMultipleServers, 9 createMultipleServers,
10 doubleFollow,
11 PeerTubeServer, 11 PeerTubeServer,
12 setAccessTokensToServers, 12 setAccessTokensToServers,
13 setDefaultVideoChannel, 13 setDefaultVideoChannel,
diff --git a/server/tests/api/live/live.ts b/server/tests/api/live/live.ts
index 88995910c..4676a840a 100644
--- a/server/tests/api/live/live.ts
+++ b/server/tests/api/live/live.ts
@@ -4,19 +4,18 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { join } from 'path' 5import { join } from 'path'
6import { ffprobePromise, getVideoStreamFromFile } from '@server/helpers/ffprobe-utils' 6import { ffprobePromise, getVideoStreamFromFile } from '@server/helpers/ffprobe-utils'
7import { HttpStatusCode } from '@shared/models'
8import { 7import {
9 checkLiveCleanup, 8 checkLiveCleanup,
10 checkLiveSegmentHash, 9 checkLiveSegmentHash,
11 checkResolutionsInMasterPlaylist, 10 checkResolutionsInMasterPlaylist,
12 cleanupTests, 11 cleanupTests,
13 doubleFollow,
14 createMultipleServers, 12 createMultipleServers,
13 doubleFollow,
15 killallServers, 14 killallServers,
16 LiveCommand, 15 LiveCommand,
17 makeRawRequest, 16 makeRawRequest,
18 sendRTMPStream,
19 PeerTubeServer, 17 PeerTubeServer,
18 sendRTMPStream,
20 setAccessTokensToServers, 19 setAccessTokensToServers,
21 setDefaultVideoChannel, 20 setDefaultVideoChannel,
22 stopFfmpeg, 21 stopFfmpeg,
@@ -26,7 +25,15 @@ import {
26 waitJobs, 25 waitJobs,
27 waitUntilLivePublishedOnAllServers 26 waitUntilLivePublishedOnAllServers
28} from '@shared/extra-utils' 27} from '@shared/extra-utils'
29import { LiveVideo, LiveVideoCreate, VideoDetails, VideoPrivacy, VideoState, VideoStreamingPlaylistType } from '@shared/models' 28import {
29 HttpStatusCode,
30 LiveVideo,
31 LiveVideoCreate,
32 VideoDetails,
33 VideoPrivacy,
34 VideoState,
35 VideoStreamingPlaylistType
36} from '@shared/models'
30 37
31const expect = chai.expect 38const expect = chai.expect
32 39
diff --git a/server/tests/api/moderation/blocklist-notification.ts b/server/tests/api/moderation/blocklist-notification.ts
index fdfbcbced..75b15c298 100644
--- a/server/tests/api/moderation/blocklist-notification.ts
+++ b/server/tests/api/moderation/blocklist-notification.ts
@@ -2,7 +2,7 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' 5import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
6import { UserNotificationType } from '@shared/models' 6import { UserNotificationType } from '@shared/models'
7 7
8const expect = chai.expect 8const expect = chai.expect
diff --git a/server/tests/api/moderation/blocklist.ts b/server/tests/api/moderation/blocklist.ts
index 593291e87..8ed5ad9e5 100644
--- a/server/tests/api/moderation/blocklist.ts
+++ b/server/tests/api/moderation/blocklist.ts
@@ -6,8 +6,8 @@ import {
6 BlocklistCommand, 6 BlocklistCommand,
7 cleanupTests, 7 cleanupTests,
8 CommentsCommand, 8 CommentsCommand,
9 doubleFollow,
10 createMultipleServers, 9 createMultipleServers,
10 doubleFollow,
11 PeerTubeServer, 11 PeerTubeServer,
12 setAccessTokensToServers, 12 setAccessTokensToServers,
13 waitJobs 13 waitJobs
diff --git a/server/tests/api/notifications/admin-notifications.ts b/server/tests/api/notifications/admin-notifications.ts
index d65551f0a..b36ba11a9 100644
--- a/server/tests/api/notifications/admin-notifications.ts
+++ b/server/tests/api/notifications/admin-notifications.ts
@@ -9,8 +9,8 @@ import {
9 cleanupTests, 9 cleanupTests,
10 MockJoinPeerTubeVersions, 10 MockJoinPeerTubeVersions,
11 MockSmtpServer, 11 MockSmtpServer,
12 prepareNotificationsTest,
13 PeerTubeServer, 12 PeerTubeServer,
13 prepareNotificationsTest,
14 wait 14 wait
15} from '@shared/extra-utils' 15} from '@shared/extra-utils'
16import { PluginType, UserNotification, UserNotificationType } from '@shared/models' 16import { PluginType, UserNotification, UserNotificationType } from '@shared/models'
diff --git a/server/tests/api/notifications/comments-notifications.ts b/server/tests/api/notifications/comments-notifications.ts
index d54819aaa..cbb46e510 100644
--- a/server/tests/api/notifications/comments-notifications.ts
+++ b/server/tests/api/notifications/comments-notifications.ts
@@ -8,8 +8,8 @@ import {
8 checkNewCommentOnMyVideo, 8 checkNewCommentOnMyVideo,
9 cleanupTests, 9 cleanupTests,
10 MockSmtpServer, 10 MockSmtpServer,
11 prepareNotificationsTest,
12 PeerTubeServer, 11 PeerTubeServer,
12 prepareNotificationsTest,
13 waitJobs 13 waitJobs
14} from '@shared/extra-utils' 14} from '@shared/extra-utils'
15import { UserNotification } from '@shared/models' 15import { UserNotification } from '@shared/models'
diff --git a/server/tests/api/notifications/moderation-notifications.ts b/server/tests/api/notifications/moderation-notifications.ts
index 3a294192b..6e8f8a2b4 100644
--- a/server/tests/api/notifications/moderation-notifications.ts
+++ b/server/tests/api/notifications/moderation-notifications.ts
@@ -19,8 +19,8 @@ import {
19 cleanupTests, 19 cleanupTests,
20 MockInstancesIndex, 20 MockInstancesIndex,
21 MockSmtpServer, 21 MockSmtpServer,
22 prepareNotificationsTest,
23 PeerTubeServer, 22 PeerTubeServer,
23 prepareNotificationsTest,
24 wait, 24 wait,
25 waitJobs 25 waitJobs
26} from '@shared/extra-utils' 26} from '@shared/extra-utils'
diff --git a/server/tests/api/notifications/notifications-api.ts b/server/tests/api/notifications/notifications-api.ts
index 178b20687..fa4b53db6 100644
--- a/server/tests/api/notifications/notifications-api.ts
+++ b/server/tests/api/notifications/notifications-api.ts
@@ -8,8 +8,8 @@ import {
8 cleanupTests, 8 cleanupTests,
9 getAllNotificationsSettings, 9 getAllNotificationsSettings,
10 MockSmtpServer, 10 MockSmtpServer,
11 prepareNotificationsTest,
12 PeerTubeServer, 11 PeerTubeServer,
12 prepareNotificationsTest,
13 waitJobs 13 waitJobs
14} from '@shared/extra-utils' 14} from '@shared/extra-utils'
15import { UserNotification, UserNotificationSettingValue } from '@shared/models' 15import { UserNotification, UserNotificationSettingValue } from '@shared/models'
diff --git a/server/tests/api/redundancy/manage-redundancy.ts b/server/tests/api/redundancy/manage-redundancy.ts
index aff64e2eb..5fd464ded 100644
--- a/server/tests/api/redundancy/manage-redundancy.ts
+++ b/server/tests/api/redundancy/manage-redundancy.ts
@@ -4,10 +4,10 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 doubleFollow,
8 createMultipleServers, 7 createMultipleServers,
9 RedundancyCommand, 8 doubleFollow,
10 PeerTubeServer, 9 PeerTubeServer,
10 RedundancyCommand,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 waitJobs 12 waitJobs
13} from '@shared/extra-utils' 13} from '@shared/extra-utils'
diff --git a/server/tests/api/redundancy/redundancy-constraints.ts b/server/tests/api/redundancy/redundancy-constraints.ts
index 71b93901e..25cd11658 100644
--- a/server/tests/api/redundancy/redundancy-constraints.ts
+++ b/server/tests/api/redundancy/redundancy-constraints.ts
@@ -2,14 +2,7 @@
2 2
3import 'mocha' 3import 'mocha'
4import { expect } from 'chai' 4import { expect } from 'chai'
5import { 5import { cleanupTests, createSingleServer, killallServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
6 cleanupTests,
7 createSingleServer,
8 killallServers,
9 PeerTubeServer,
10 setAccessTokensToServers,
11 waitJobs
12} from '@shared/extra-utils'
13import { VideoPrivacy } from '@shared/models' 6import { VideoPrivacy } from '@shared/models'
14 7
15describe('Test redundancy constraints', function () { 8describe('Test redundancy constraints', function () {
diff --git a/server/tests/api/redundancy/redundancy.ts b/server/tests/api/redundancy/redundancy.ts
index 921a48856..a6559d304 100644
--- a/server/tests/api/redundancy/redundancy.ts
+++ b/server/tests/api/redundancy/redundancy.ts
@@ -5,22 +5,21 @@ import * as chai from 'chai'
5import { readdir } from 'fs-extra' 5import { readdir } from 'fs-extra'
6import * as magnetUtil from 'magnet-uri' 6import * as magnetUtil from 'magnet-uri'
7import { join } from 'path' 7import { join } from 'path'
8import { HttpStatusCode } from '@shared/models'
9import { 8import {
10 checkSegmentHash, 9 checkSegmentHash,
11 checkVideoFilesWereRemoved, 10 checkVideoFilesWereRemoved,
12 cleanupTests, 11 cleanupTests,
13 doubleFollow,
14 createMultipleServers, 12 createMultipleServers,
13 doubleFollow,
15 killallServers, 14 killallServers,
16 makeGetRequest, 15 makeGetRequest,
17 root,
18 PeerTubeServer, 16 PeerTubeServer,
17 root,
19 setAccessTokensToServers, 18 setAccessTokensToServers,
20 wait, 19 wait,
21 waitJobs 20 waitJobs
22} from '@shared/extra-utils' 21} from '@shared/extra-utils'
23import { VideoPrivacy, VideoRedundancyStrategy, VideoRedundancyStrategyWithManual } from '@shared/models' 22import { HttpStatusCode, VideoPrivacy, VideoRedundancyStrategy, VideoRedundancyStrategyWithManual } from '@shared/models'
24 23
25const expect = chai.expect 24const expect = chai.expect
26 25
diff --git a/server/tests/api/search/search-activitypub-video-channels.ts b/server/tests/api/search/search-activitypub-video-channels.ts
index b33f28266..426cbc8e1 100644
--- a/server/tests/api/search/search-activitypub-video-channels.ts
+++ b/server/tests/api/search/search-activitypub-video-channels.ts
@@ -5,8 +5,8 @@ import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 createMultipleServers, 7 createMultipleServers,
8 SearchCommand,
9 PeerTubeServer, 8 PeerTubeServer,
9 SearchCommand,
10 setAccessTokensToServers, 10 setAccessTokensToServers,
11 wait, 11 wait,
12 waitJobs 12 waitJobs
diff --git a/server/tests/api/search/search-activitypub-video-playlists.ts b/server/tests/api/search/search-activitypub-video-playlists.ts
index ada2d3d6c..33ca7be12 100644
--- a/server/tests/api/search/search-activitypub-video-playlists.ts
+++ b/server/tests/api/search/search-activitypub-video-playlists.ts
@@ -5,8 +5,8 @@ import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 createMultipleServers, 7 createMultipleServers,
8 SearchCommand,
9 PeerTubeServer, 8 PeerTubeServer,
9 SearchCommand,
10 setAccessTokensToServers, 10 setAccessTokensToServers,
11 setDefaultVideoChannel, 11 setDefaultVideoChannel,
12 wait, 12 wait,
diff --git a/server/tests/api/search/search-activitypub-videos.ts b/server/tests/api/search/search-activitypub-videos.ts
index a015b72a7..b3cfcacca 100644
--- a/server/tests/api/search/search-activitypub-videos.ts
+++ b/server/tests/api/search/search-activitypub-videos.ts
@@ -5,8 +5,8 @@ import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 createMultipleServers, 7 createMultipleServers,
8 SearchCommand,
9 PeerTubeServer, 8 PeerTubeServer,
9 SearchCommand,
10 setAccessTokensToServers, 10 setAccessTokensToServers,
11 wait, 11 wait,
12 waitJobs 12 waitJobs
diff --git a/server/tests/api/search/search-channels.ts b/server/tests/api/search/search-channels.ts
index 07e00a214..4da2d0ece 100644
--- a/server/tests/api/search/search-channels.ts
+++ b/server/tests/api/search/search-channels.ts
@@ -2,7 +2,7 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { cleanupTests, createSingleServer, SearchCommand, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' 5import { cleanupTests, createSingleServer, PeerTubeServer, SearchCommand, setAccessTokensToServers } from '@shared/extra-utils'
6import { VideoChannel } from '@shared/models' 6import { VideoChannel } from '@shared/models'
7 7
8const expect = chai.expect 8const expect = chai.expect
diff --git a/server/tests/api/search/search-index.ts b/server/tests/api/search/search-index.ts
index 38edcf7c6..feb35411f 100644
--- a/server/tests/api/search/search-index.ts
+++ b/server/tests/api/search/search-index.ts
@@ -2,7 +2,7 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { cleanupTests, createSingleServer, SearchCommand, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' 5import { cleanupTests, createSingleServer, PeerTubeServer, SearchCommand, setAccessTokensToServers } from '@shared/extra-utils'
6import { BooleanBothQuery, VideoPlaylistPrivacy, VideoPlaylistType, VideosSearchQuery } from '@shared/models' 6import { BooleanBothQuery, VideoPlaylistPrivacy, VideoPlaylistType, VideosSearchQuery } from '@shared/models'
7 7
8const expect = chai.expect 8const expect = chai.expect
diff --git a/server/tests/api/search/search-playlists.ts b/server/tests/api/search/search-playlists.ts
index b29c2d127..22e9b8fca 100644
--- a/server/tests/api/search/search-playlists.ts
+++ b/server/tests/api/search/search-playlists.ts
@@ -5,8 +5,8 @@ import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 createSingleServer, 7 createSingleServer,
8 SearchCommand,
9 PeerTubeServer, 8 PeerTubeServer,
9 SearchCommand,
10 setAccessTokensToServers, 10 setAccessTokensToServers,
11 setDefaultVideoChannel 11 setDefaultVideoChannel
12} from '@shared/extra-utils' 12} from '@shared/extra-utils'
diff --git a/server/tests/api/search/search-videos.ts b/server/tests/api/search/search-videos.ts
index a9b0a4fcd..f834c7f36 100644
--- a/server/tests/api/search/search-videos.ts
+++ b/server/tests/api/search/search-videos.ts
@@ -5,8 +5,8 @@ import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 createSingleServer, 7 createSingleServer,
8 SearchCommand,
9 PeerTubeServer, 8 PeerTubeServer,
9 SearchCommand,
10 setAccessTokensToServers, 10 setAccessTokensToServers,
11 setDefaultVideoChannel, 11 setDefaultVideoChannel,
12 stopFfmpeg, 12 stopFfmpeg,
diff --git a/server/tests/api/server/bulk.ts b/server/tests/api/server/bulk.ts
index 5d8c87983..16cbcd5c3 100644
--- a/server/tests/api/server/bulk.ts
+++ b/server/tests/api/server/bulk.ts
@@ -5,8 +5,8 @@ import * as chai from 'chai'
5import { 5import {
6 BulkCommand, 6 BulkCommand,
7 cleanupTests, 7 cleanupTests,
8 doubleFollow,
9 createMultipleServers, 8 createMultipleServers,
9 doubleFollow,
10 PeerTubeServer, 10 PeerTubeServer,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 waitJobs 12 waitJobs
diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.ts
index a1c2f0f39..fd61e95df 100644
--- a/server/tests/api/server/config.ts
+++ b/server/tests/api/server/config.ts
@@ -2,7 +2,6 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/models'
6import { 5import {
7 cleanupTests, 6 cleanupTests,
8 createSingleServer, 7 createSingleServer,
@@ -12,7 +11,7 @@ import {
12 PeerTubeServer, 11 PeerTubeServer,
13 setAccessTokensToServers 12 setAccessTokensToServers
14} from '@shared/extra-utils' 13} from '@shared/extra-utils'
15import { CustomConfig } from '@shared/models' 14import { CustomConfig, HttpStatusCode } from '@shared/models'
16 15
17const expect = chai.expect 16const expect = chai.expect
18 17
diff --git a/server/tests/api/server/contact-form.ts b/server/tests/api/server/contact-form.ts
index fc5d0ad6a..c555661ad 100644
--- a/server/tests/api/server/contact-form.ts
+++ b/server/tests/api/server/contact-form.ts
@@ -2,7 +2,6 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/models'
6import { 5import {
7 cleanupTests, 6 cleanupTests,
8 ContactFormCommand, 7 ContactFormCommand,
@@ -13,6 +12,7 @@ import {
13 wait, 12 wait,
14 waitJobs 13 waitJobs
15} from '@shared/extra-utils' 14} from '@shared/extra-utils'
15import { HttpStatusCode } from '@shared/models'
16 16
17const expect = chai.expect 17const expect = chai.expect
18 18
diff --git a/server/tests/api/server/email.ts b/server/tests/api/server/email.ts
index 4c5b296ee..ae86b380f 100644
--- a/server/tests/api/server/email.ts
+++ b/server/tests/api/server/email.ts
@@ -2,8 +2,8 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/models'
6import { cleanupTests, createSingleServer, MockSmtpServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' 5import { cleanupTests, createSingleServer, MockSmtpServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
6import { HttpStatusCode } from '@shared/models'
7 7
8const expect = chai.expect 8const expect = chai.expect
9 9
diff --git a/server/tests/api/server/follow-constraints.ts b/server/tests/api/server/follow-constraints.ts
index bd7b215db..471f5d8d0 100644
--- a/server/tests/api/server/follow-constraints.ts
+++ b/server/tests/api/server/follow-constraints.ts
@@ -2,9 +2,8 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/models' 5import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils'
6import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' 6import { HttpStatusCode, PeerTubeProblemDocument, ServerErrorCode } from '@shared/models'
7import { PeerTubeProblemDocument, ServerErrorCode } from '@shared/models'
8 7
9const expect = chai.expect 8const expect = chai.expect
10 9
@@ -157,7 +156,7 @@ describe('Test follow constraints', function () {
157 156
158 it('Should list local account videos', async function () { 157 it('Should list local account videos', async function () {
159 const { total, data } = await servers[0].videos.listByAccount({ 158 const { total, data } = await servers[0].videos.listByAccount({
160 token: undefined, 159 token: null,
161 handle: 'root@localhost:' + servers[0].port 160 handle: 'root@localhost:' + servers[0].port
162 }) 161 })
163 162
@@ -167,7 +166,7 @@ describe('Test follow constraints', function () {
167 166
168 it('Should not list remote account videos', async function () { 167 it('Should not list remote account videos', async function () {
169 const { total, data } = await servers[0].videos.listByAccount({ 168 const { total, data } = await servers[0].videos.listByAccount({
170 token: undefined, 169 token: null,
171 handle: 'root@localhost:' + servers[1].port 170 handle: 'root@localhost:' + servers[1].port
172 }) 171 })
173 172
@@ -177,7 +176,7 @@ describe('Test follow constraints', function () {
177 176
178 it('Should list local channel videos', async function () { 177 it('Should list local channel videos', async function () {
179 const handle = 'root_channel@localhost:' + servers[0].port 178 const handle = 'root_channel@localhost:' + servers[0].port
180 const { total, data } = await servers[0].videos.listByChannel({ token: undefined, handle }) 179 const { total, data } = await servers[0].videos.listByChannel({ token: null, handle })
181 180
182 expect(total).to.equal(1) 181 expect(total).to.equal(1)
183 expect(data).to.have.lengthOf(1) 182 expect(data).to.have.lengthOf(1)
@@ -185,7 +184,7 @@ describe('Test follow constraints', function () {
185 184
186 it('Should not list remote channel videos', async function () { 185 it('Should not list remote channel videos', async function () {
187 const handle = 'root_channel@localhost:' + servers[1].port 186 const handle = 'root_channel@localhost:' + servers[1].port
188 const { total, data } = await servers[0].videos.listByChannel({ token: undefined, handle }) 187 const { total, data } = await servers[0].videos.listByChannel({ token: null, handle })
189 188
190 expect(total).to.equal(0) 189 expect(total).to.equal(0)
191 expect(data).to.have.lengthOf(0) 190 expect(data).to.have.lengthOf(0)
diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.ts
index 8856177b8..ff8f880a6 100644
--- a/server/tests/api/server/follows.ts
+++ b/server/tests/api/server/follows.ts
@@ -5,9 +5,9 @@ import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 completeVideoCheck, 7 completeVideoCheck,
8 createMultipleServers,
8 dateIsValid, 9 dateIsValid,
9 expectAccountFollows, 10 expectAccountFollows,
10 createMultipleServers,
11 FollowsCommand, 11 FollowsCommand,
12 PeerTubeServer, 12 PeerTubeServer,
13 setAccessTokensToServers, 13 setAccessTokensToServers,
diff --git a/server/tests/api/server/handle-down.ts b/server/tests/api/server/handle-down.ts
index d22e843e0..1f751c957 100644
--- a/server/tests/api/server/handle-down.ts
+++ b/server/tests/api/server/handle-down.ts
@@ -2,7 +2,6 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/models'
6import { 5import {
7 cleanupTests, 6 cleanupTests,
8 CommentsCommand, 7 CommentsCommand,
@@ -14,7 +13,7 @@ import {
14 wait, 13 wait,
15 waitJobs 14 waitJobs
16} from '@shared/extra-utils' 15} from '@shared/extra-utils'
17import { JobState, VideoCreateResult, VideoPrivacy } from '@shared/models' 16import { HttpStatusCode, JobState, VideoCreateResult, VideoPrivacy } from '@shared/models'
18 17
19const expect = chai.expect 18const expect = chai.expect
20 19
diff --git a/server/tests/api/server/homepage.ts b/server/tests/api/server/homepage.ts
index 7eae3df20..cb3ba5677 100644
--- a/server/tests/api/server/homepage.ts
+++ b/server/tests/api/server/homepage.ts
@@ -5,8 +5,8 @@ import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/models' 5import { HttpStatusCode } from '@shared/models'
6import { 6import {
7 cleanupTests, 7 cleanupTests,
8 CustomPagesCommand,
9 createSingleServer, 8 createSingleServer,
9 CustomPagesCommand,
10 killallServers, 10 killallServers,
11 PeerTubeServer, 11 PeerTubeServer,
12 setAccessTokensToServers 12 setAccessTokensToServers
diff --git a/server/tests/api/server/jobs.ts b/server/tests/api/server/jobs.ts
index 376cd10d0..c10c154c2 100644
--- a/server/tests/api/server/jobs.ts
+++ b/server/tests/api/server/jobs.ts
@@ -4,9 +4,9 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 createMultipleServers,
7 dateIsValid, 8 dateIsValid,
8 doubleFollow, 9 doubleFollow,
9 createMultipleServers,
10 PeerTubeServer, 10 PeerTubeServer,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 waitJobs 12 waitJobs
diff --git a/server/tests/api/server/plugins.ts b/server/tests/api/server/plugins.ts
index 334adfe9d..5f9f4ffdd 100644
--- a/server/tests/api/server/plugins.ts
+++ b/server/tests/api/server/plugins.ts
@@ -2,18 +2,17 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/models'
6import { 5import {
7 cleanupTests, 6 cleanupTests,
8 createSingleServer, 7 createSingleServer,
9 killallServers, 8 killallServers,
10 PluginsCommand,
11 PeerTubeServer, 9 PeerTubeServer,
10 PluginsCommand,
12 setAccessTokensToServers, 11 setAccessTokensToServers,
13 testHelloWorldRegisteredSettings, 12 testHelloWorldRegisteredSettings,
14 wait 13 wait
15} from '@shared/extra-utils' 14} from '@shared/extra-utils'
16import { PluginType } from '@shared/models' 15import { HttpStatusCode, PluginType } from '@shared/models'
17 16
18const expect = chai.expect 17const expect = chai.expect
19 18
diff --git a/server/tests/api/server/reverse-proxy.ts b/server/tests/api/server/reverse-proxy.ts
index 13b22bc0e..484f88d67 100644
--- a/server/tests/api/server/reverse-proxy.ts
+++ b/server/tests/api/server/reverse-proxy.ts
@@ -1,8 +1,8 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import { expect } from 'chai' 3import { expect } from 'chai'
4import { HttpStatusCode } from '@shared/models'
5import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, wait } from '@shared/extra-utils' 4import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, wait } from '@shared/extra-utils'
5import { HttpStatusCode } from '@shared/models'
6 6
7describe('Test application behind a reverse proxy', function () { 7describe('Test application behind a reverse proxy', function () {
8 let server: PeerTubeServer 8 let server: PeerTubeServer
diff --git a/server/tests/api/server/stats.ts b/server/tests/api/server/stats.ts
index f07d0fd39..942602b70 100644
--- a/server/tests/api/server/stats.ts
+++ b/server/tests/api/server/stats.ts
@@ -4,8 +4,8 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 doubleFollow,
8 createMultipleServers, 7 createMultipleServers,
8 doubleFollow,
9 PeerTubeServer, 9 PeerTubeServer,
10 setAccessTokensToServers, 10 setAccessTokensToServers,
11 wait, 11 wait,
diff --git a/server/tests/api/users/user-subscriptions.ts b/server/tests/api/users/user-subscriptions.ts
index d2bb9c387..565b4bd77 100644
--- a/server/tests/api/users/user-subscriptions.ts
+++ b/server/tests/api/users/user-subscriptions.ts
@@ -4,8 +4,8 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 doubleFollow,
8 createMultipleServers, 7 createMultipleServers,
8 doubleFollow,
9 PeerTubeServer, 9 PeerTubeServer,
10 setAccessTokensToServers, 10 setAccessTokensToServers,
11 SubscriptionsCommand, 11 SubscriptionsCommand,
@@ -67,7 +67,8 @@ describe('Test users subscriptions', function () {
67 67
68 await waitJobs(servers) 68 await waitJobs(servers)
69 69
70 const { uuid } = await servers[2].videos.upload({ attributes: { name: 'video server 3 added after follow' } }) 70 const attributes = { name: 'video server 3 added after follow' }
71 const { uuid } = await servers[2].videos.upload({ token: users[2].accessToken, attributes })
71 video3UUID = uuid 72 video3UUID = uuid
72 73
73 await waitJobs(servers) 74 await waitJobs(servers)
diff --git a/server/tests/api/users/users-multiple-servers.ts b/server/tests/api/users/users-multiple-servers.ts
index e304e5d67..225145957 100644
--- a/server/tests/api/users/users-multiple-servers.ts
+++ b/server/tests/api/users/users-multiple-servers.ts
@@ -7,8 +7,8 @@ import {
7 checkTmpIsEmpty, 7 checkTmpIsEmpty,
8 checkVideoFilesWereRemoved, 8 checkVideoFilesWereRemoved,
9 cleanupTests, 9 cleanupTests,
10 doubleFollow,
11 createMultipleServers, 10 createMultipleServers,
11 doubleFollow,
12 PeerTubeServer, 12 PeerTubeServer,
13 setAccessTokensToServers, 13 setAccessTokensToServers,
14 testImage, 14 testImage,
diff --git a/server/tests/api/users/users-verification.ts b/server/tests/api/users/users-verification.ts
index 56fc25048..f54463359 100644
--- a/server/tests/api/users/users-verification.ts
+++ b/server/tests/api/users/users-verification.ts
@@ -2,8 +2,8 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/models'
6import { cleanupTests, createSingleServer, MockSmtpServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' 5import { cleanupTests, createSingleServer, MockSmtpServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
6import { HttpStatusCode } from '@shared/models'
7 7
8const expect = chai.expect 8const expect = chai.expect
9 9
diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts
index be80c2616..066da88ee 100644
--- a/server/tests/api/users/users.ts
+++ b/server/tests/api/users/users.ts
@@ -2,7 +2,6 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/models'
6import { 5import {
7 cleanupTests, 6 cleanupTests,
8 createSingleServer, 7 createSingleServer,
@@ -13,7 +12,7 @@ import {
13 testImage, 12 testImage,
14 waitJobs 13 waitJobs
15} from '@shared/extra-utils' 14} from '@shared/extra-utils'
16import { AbuseState, OAuth2ErrorCode, UserAdminFlag, UserRole, Video, VideoPlaylistType } from '@shared/models' 15import { AbuseState, HttpStatusCode, OAuth2ErrorCode, UserAdminFlag, UserRole, Video, VideoPlaylistType } from '@shared/models'
17 16
18const expect = chai.expect 17const expect = chai.expect
19 18
diff --git a/server/tests/api/videos/audio-only.ts b/server/tests/api/videos/audio-only.ts
index b9bf96650..15c3ae6d6 100644
--- a/server/tests/api/videos/audio-only.ts
+++ b/server/tests/api/videos/audio-only.ts
@@ -4,7 +4,7 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { join } from 'path' 5import { join } from 'path'
6import { getAudioStream, getVideoStreamSize } from '@server/helpers/ffprobe-utils' 6import { getAudioStream, getVideoStreamSize } from '@server/helpers/ffprobe-utils'
7import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' 7import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
8 8
9const expect = chai.expect 9const expect = chai.expect
10 10
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts
index edf2773cd..d916abb09 100644
--- a/server/tests/api/videos/multiple-servers.ts
+++ b/server/tests/api/videos/multiple-servers.ts
@@ -3,16 +3,15 @@
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import * as request from 'supertest' 5import * as request from 'supertest'
6import { HttpStatusCode } from '@shared/models'
7import { 6import {
8 buildAbsoluteFixturePath, 7 buildAbsoluteFixturePath,
9 checkTmpIsEmpty, 8 checkTmpIsEmpty,
10 checkVideoFilesWereRemoved, 9 checkVideoFilesWereRemoved,
11 cleanupTests, 10 cleanupTests,
12 completeVideoCheck, 11 completeVideoCheck,
12 createMultipleServers,
13 dateIsValid, 13 dateIsValid,
14 doubleFollow, 14 doubleFollow,
15 createMultipleServers,
16 PeerTubeServer, 15 PeerTubeServer,
17 setAccessTokensToServers, 16 setAccessTokensToServers,
18 testImage, 17 testImage,
@@ -20,7 +19,7 @@ import {
20 waitJobs, 19 waitJobs,
21 webtorrentAdd 20 webtorrentAdd
22} from '@shared/extra-utils' 21} from '@shared/extra-utils'
23import { VideoCommentThreadTree, VideoPrivacy } from '@shared/models' 22import { HttpStatusCode, VideoCommentThreadTree, VideoPrivacy } from '@shared/models'
24 23
25const expect = chai.expect 24const expect = chai.expect
26 25
diff --git a/server/tests/api/videos/resumable-upload.ts b/server/tests/api/videos/resumable-upload.ts
index 0e62972c2..13e47c85e 100644
--- a/server/tests/api/videos/resumable-upload.ts
+++ b/server/tests/api/videos/resumable-upload.ts
@@ -4,7 +4,6 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { pathExists, readdir, stat } from 'fs-extra' 5import { pathExists, readdir, stat } from 'fs-extra'
6import { join } from 'path' 6import { join } from 'path'
7import { HttpStatusCode } from '@shared/models'
8import { 7import {
9 buildAbsoluteFixturePath, 8 buildAbsoluteFixturePath,
10 cleanupTests, 9 cleanupTests,
@@ -13,7 +12,7 @@ import {
13 setAccessTokensToServers, 12 setAccessTokensToServers,
14 setDefaultVideoChannel 13 setDefaultVideoChannel
15} from '@shared/extra-utils' 14} from '@shared/extra-utils'
16import { VideoPrivacy } from '@shared/models' 15import { HttpStatusCode, VideoPrivacy } from '@shared/models'
17 16
18const expect = chai.expect 17const expect = chai.expect
19 18
diff --git a/server/tests/api/videos/video-captions.ts b/server/tests/api/videos/video-captions.ts
index 6caba6aa6..e3d46e619 100644
--- a/server/tests/api/videos/video-captions.ts
+++ b/server/tests/api/videos/video-captions.ts
@@ -5,8 +5,8 @@ import * as chai from 'chai'
5import { 5import {
6 checkVideoFilesWereRemoved, 6 checkVideoFilesWereRemoved,
7 cleanupTests, 7 cleanupTests,
8 doubleFollow,
9 createMultipleServers, 8 createMultipleServers,
9 doubleFollow,
10 PeerTubeServer, 10 PeerTubeServer,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 testCaptionFile, 12 testCaptionFile,
diff --git a/server/tests/api/videos/video-change-ownership.ts b/server/tests/api/videos/video-change-ownership.ts
index 792550101..6ae6d3004 100644
--- a/server/tests/api/videos/video-change-ownership.ts
+++ b/server/tests/api/videos/video-change-ownership.ts
@@ -2,19 +2,18 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/models'
6import { 5import {
7 ChangeOwnershipCommand, 6 ChangeOwnershipCommand,
8 cleanupTests, 7 cleanupTests,
9 doubleFollow,
10 createMultipleServers, 8 createMultipleServers,
11 createSingleServer, 9 createSingleServer,
10 doubleFollow,
12 PeerTubeServer, 11 PeerTubeServer,
13 setAccessTokensToServers, 12 setAccessTokensToServers,
14 setDefaultVideoChannel, 13 setDefaultVideoChannel,
15 waitJobs 14 waitJobs
16} from '@shared/extra-utils' 15} from '@shared/extra-utils'
17import { VideoPrivacy } from '@shared/models' 16import { HttpStatusCode, VideoPrivacy } from '@shared/models'
18 17
19const expect = chai.expect 18const expect = chai.expect
20 19
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts
index eeaec5ad2..c25754eb6 100644
--- a/server/tests/api/videos/video-channels.ts
+++ b/server/tests/api/videos/video-channels.ts
@@ -6,8 +6,8 @@ import { basename } from 'path'
6import { ACTOR_IMAGES_SIZE } from '@server/initializers/constants' 6import { ACTOR_IMAGES_SIZE } from '@server/initializers/constants'
7import { 7import {
8 cleanupTests, 8 cleanupTests,
9 doubleFollow,
10 createMultipleServers, 9 createMultipleServers,
10 doubleFollow,
11 PeerTubeServer, 11 PeerTubeServer,
12 setAccessTokensToServers, 12 setAccessTokensToServers,
13 setDefaultVideoChannel, 13 setDefaultVideoChannel,
diff --git a/server/tests/api/videos/video-comments.ts b/server/tests/api/videos/video-comments.ts
index 9709e0628..61ee54540 100644
--- a/server/tests/api/videos/video-comments.ts
+++ b/server/tests/api/videos/video-comments.ts
@@ -5,8 +5,8 @@ import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 CommentsCommand, 7 CommentsCommand,
8 dateIsValid,
9 createSingleServer, 8 createSingleServer,
9 dateIsValid,
10 PeerTubeServer, 10 PeerTubeServer,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 testImage 12 testImage
diff --git a/server/tests/api/videos/video-description.ts b/server/tests/api/videos/video-description.ts
index ce45eac80..d22b4ed96 100644
--- a/server/tests/api/videos/video-description.ts
+++ b/server/tests/api/videos/video-description.ts
@@ -2,7 +2,7 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' 5import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
6 6
7const expect = chai.expect 7const expect = chai.expect
8 8
diff --git a/server/tests/api/videos/video-hls.ts b/server/tests/api/videos/video-hls.ts
index df030110b..7845f7334 100644
--- a/server/tests/api/videos/video-hls.ts
+++ b/server/tests/api/videos/video-hls.ts
@@ -3,22 +3,21 @@
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { join } from 'path' 5import { join } from 'path'
6import { HttpStatusCode } from '@shared/models'
7import { 6import {
8 checkDirectoryIsEmpty, 7 checkDirectoryIsEmpty,
9 checkResolutionsInMasterPlaylist, 8 checkResolutionsInMasterPlaylist,
10 checkSegmentHash, 9 checkSegmentHash,
11 checkTmpIsEmpty, 10 checkTmpIsEmpty,
12 cleanupTests, 11 cleanupTests,
13 doubleFollow,
14 createMultipleServers, 12 createMultipleServers,
13 doubleFollow,
15 makeRawRequest, 14 makeRawRequest,
16 PeerTubeServer, 15 PeerTubeServer,
17 setAccessTokensToServers, 16 setAccessTokensToServers,
18 waitJobs, 17 waitJobs,
19 webtorrentAdd 18 webtorrentAdd
20} from '@shared/extra-utils' 19} from '@shared/extra-utils'
21import { VideoStreamingPlaylistType } from '@shared/models' 20import { HttpStatusCode, VideoStreamingPlaylistType } from '@shared/models'
22import { DEFAULT_AUDIO_RESOLUTION } from '../../../initializers/constants' 21import { DEFAULT_AUDIO_RESOLUTION } from '../../../initializers/constants'
23 22
24const expect = chai.expect 23const expect = chai.expect
diff --git a/server/tests/api/videos/video-nsfw.ts b/server/tests/api/videos/video-nsfw.ts
index 0a9e5ce3f..b5d183d62 100644
--- a/server/tests/api/videos/video-nsfw.ts
+++ b/server/tests/api/videos/video-nsfw.ts
@@ -30,8 +30,8 @@ describe('Test video NSFW policy', function () {
30 promises = [ 30 promises = [
31 server.search.advancedVideoSearch({ token, search: { search: 'n', sort: '-publishedAt', ...query } }), 31 server.search.advancedVideoSearch({ token, search: { search: 'n', sort: '-publishedAt', ...query } }),
32 server.videos.listWithToken({ token, ...query }), 32 server.videos.listWithToken({ token, ...query }),
33 server.videos.listByAccount({ token, handle: channelName, ...query }), 33 server.videos.listByAccount({ token, handle: accountName, ...query }),
34 server.videos.listByChannel({ token, handle: accountName, ...query }) 34 server.videos.listByChannel({ token, handle: channelName, ...query })
35 ] 35 ]
36 36
37 // Overviews do not support video filters 37 // Overviews do not support video filters
@@ -47,8 +47,8 @@ describe('Test video NSFW policy', function () {
47 promises = [ 47 promises = [
48 server.search.searchVideos({ search: 'n', sort: '-publishedAt' }), 48 server.search.searchVideos({ search: 'n', sort: '-publishedAt' }),
49 server.videos.list(), 49 server.videos.list(),
50 server.videos.listByAccount({ handle: channelName }), 50 server.videos.listByAccount({ token: null, handle: accountName }),
51 server.videos.listByChannel({ handle: accountName }) 51 server.videos.listByChannel({ token: null, handle: channelName })
52 ] 52 ]
53 53
54 // Overviews do not support video filters 54 // Overviews do not support video filters
@@ -82,6 +82,7 @@ describe('Test video NSFW policy', function () {
82 }) 82 })
83 83
84 describe('Instance default NSFW policy', function () { 84 describe('Instance default NSFW policy', function () {
85
85 it('Should display NSFW videos with display default NSFW policy', async function () { 86 it('Should display NSFW videos with display default NSFW policy', async function () {
86 const serverConfig = await server.config.getConfig() 87 const serverConfig = await server.config.getConfig()
87 expect(serverConfig.instance.defaultNSFWPolicy).to.equal('display') 88 expect(serverConfig.instance.defaultNSFWPolicy).to.equal('display')
diff --git a/server/tests/api/videos/video-playlist-thumbnails.ts b/server/tests/api/videos/video-playlist-thumbnails.ts
index 9a682c12b..f0b2ca169 100644
--- a/server/tests/api/videos/video-playlist-thumbnails.ts
+++ b/server/tests/api/videos/video-playlist-thumbnails.ts
@@ -4,8 +4,8 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 doubleFollow,
8 createMultipleServers, 7 createMultipleServers,
8 doubleFollow,
9 PeerTubeServer, 9 PeerTubeServer,
10 setAccessTokensToServers, 10 setAccessTokensToServers,
11 setDefaultVideoChannel, 11 setDefaultVideoChannel,
diff --git a/server/tests/api/videos/video-playlists.ts b/server/tests/api/videos/video-playlists.ts
index 9a28a421a..f42aee2ff 100644
--- a/server/tests/api/videos/video-playlists.ts
+++ b/server/tests/api/videos/video-playlists.ts
@@ -2,14 +2,13 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/models'
6import { 5import {
7 checkPlaylistFilesWereRemoved, 6 checkPlaylistFilesWereRemoved,
8 cleanupTests, 7 cleanupTests,
9 doubleFollow,
10 createMultipleServers, 8 createMultipleServers,
11 PlaylistsCommand, 9 doubleFollow,
12 PeerTubeServer, 10 PeerTubeServer,
11 PlaylistsCommand,
13 setAccessTokensToServers, 12 setAccessTokensToServers,
14 setDefaultVideoChannel, 13 setDefaultVideoChannel,
15 testImage, 14 testImage,
@@ -17,6 +16,7 @@ import {
17 waitJobs 16 waitJobs
18} from '@shared/extra-utils' 17} from '@shared/extra-utils'
19import { 18import {
19 HttpStatusCode,
20 VideoPlaylist, 20 VideoPlaylist,
21 VideoPlaylistCreateResult, 21 VideoPlaylistCreateResult,
22 VideoPlaylistElementType, 22 VideoPlaylistElementType,
diff --git a/server/tests/api/videos/video-privacy.ts b/server/tests/api/videos/video-privacy.ts
index 06011082d..b51b3bcdd 100644
--- a/server/tests/api/videos/video-privacy.ts
+++ b/server/tests/api/videos/video-privacy.ts
@@ -2,9 +2,8 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/models' 5import { cleanupTests, createSingleServer, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
6import { cleanupTests, doubleFollow, createSingleServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' 6import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models'
7import { VideoCreateResult, VideoPrivacy } from '@shared/models'
8 7
9const expect = chai.expect 8const expect = chai.expect
10 9
@@ -162,7 +161,7 @@ describe('Test video privacy', function () {
162 }) 161 })
163 162
164 it('Should not be able to get this unlisted video using its id', async function () { 163 it('Should not be able to get this unlisted video using its id', async function () {
165 await servers[1].videos.get({ id: unlistedVideo.id, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 164 await servers[1].videos.get({ id: unlistedVideo.id, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
166 }) 165 })
167 166
168 it('Should be able to get this unlisted video using its uuid/shortUUID', async function () { 167 it('Should be able to get this unlisted video using its uuid/shortUUID', async function () {
diff --git a/server/tests/api/videos/video-schedule-update.ts b/server/tests/api/videos/video-schedule-update.ts
index 22b5cf1c2..3f7738784 100644
--- a/server/tests/api/videos/video-schedule-update.ts
+++ b/server/tests/api/videos/video-schedule-update.ts
@@ -4,8 +4,8 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 doubleFollow,
8 createMultipleServers, 7 createMultipleServers,
8 doubleFollow,
9 PeerTubeServer, 9 PeerTubeServer,
10 setAccessTokensToServers, 10 setAccessTokensToServers,
11 wait, 11 wait,
diff --git a/server/tests/api/videos/video-transcoder.ts b/server/tests/api/videos/video-transcoder.ts
index 7510472e3..e4892bb24 100644
--- a/server/tests/api/videos/video-transcoder.ts
+++ b/server/tests/api/videos/video-transcoder.ts
@@ -4,12 +4,11 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { omit } from 'lodash' 5import { omit } from 'lodash'
6import { join } from 'path' 6import { join } from 'path'
7import { HttpStatusCode } from '@shared/models'
8import { 7import {
9 buildAbsoluteFixturePath, 8 buildAbsoluteFixturePath,
10 cleanupTests, 9 cleanupTests,
11 doubleFollow,
12 createMultipleServers, 10 createMultipleServers,
11 doubleFollow,
13 generateHighBitrateVideo, 12 generateHighBitrateVideo,
14 generateVideoWithFramerate, 13 generateVideoWithFramerate,
15 makeGetRequest, 14 makeGetRequest,
@@ -18,7 +17,7 @@ import {
18 waitJobs, 17 waitJobs,
19 webtorrentAdd 18 webtorrentAdd
20} from '@shared/extra-utils' 19} from '@shared/extra-utils'
21import { getMaxBitrate, VideoResolution, VideoState } from '@shared/models' 20import { getMaxBitrate, HttpStatusCode, VideoResolution, VideoState } from '@shared/models'
22import { VIDEO_TRANSCODING_FPS } from '../../../../server/initializers/constants' 21import { VIDEO_TRANSCODING_FPS } from '../../../../server/initializers/constants'
23import { 22import {
24 canDoQuickTranscode, 23 canDoQuickTranscode,
diff --git a/server/tests/api/videos/videos-filter.ts b/server/tests/api/videos/videos-filter.ts
index 88dff3e7f..2306807bf 100644
--- a/server/tests/api/videos/videos-filter.ts
+++ b/server/tests/api/videos/videos-filter.ts
@@ -2,16 +2,15 @@
2 2
3import 'mocha' 3import 'mocha'
4import { expect } from 'chai' 4import { expect } from 'chai'
5import { HttpStatusCode } from '@shared/models'
6import { 5import {
7 cleanupTests, 6 cleanupTests,
8 doubleFollow,
9 createMultipleServers, 7 createMultipleServers,
8 doubleFollow,
10 makeGetRequest, 9 makeGetRequest,
11 PeerTubeServer, 10 PeerTubeServer,
12 setAccessTokensToServers 11 setAccessTokensToServers
13} from '@shared/extra-utils' 12} from '@shared/extra-utils'
14import { UserRole, Video, VideoPrivacy } from '@shared/models' 13import { HttpStatusCode, UserRole, Video, VideoPrivacy } from '@shared/models'
15 14
16async function getVideosNames (server: PeerTubeServer, token: string, filter: string, expectedStatus = HttpStatusCode.OK_200) { 15async function getVideosNames (server: PeerTubeServer, token: string, filter: string, expectedStatus = HttpStatusCode.OK_200) {
17 const paths = [ 16 const paths = [
diff --git a/server/tests/api/videos/videos-history.ts b/server/tests/api/videos/videos-history.ts
index acb9d1a46..e4bc0bb3a 100644
--- a/server/tests/api/videos/videos-history.ts
+++ b/server/tests/api/videos/videos-history.ts
@@ -2,7 +2,6 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/models'
6import { 5import {
7 cleanupTests, 6 cleanupTests,
8 createSingleServer, 7 createSingleServer,
@@ -12,7 +11,7 @@ import {
12 setAccessTokensToServers, 11 setAccessTokensToServers,
13 wait 12 wait
14} from '@shared/extra-utils' 13} from '@shared/extra-utils'
15import { Video } from '@shared/models' 14import { HttpStatusCode, Video } from '@shared/models'
16 15
17const expect = chai.expect 16const expect = chai.expect
18 17
diff --git a/server/tests/api/videos/videos-views-cleaner.ts b/server/tests/api/videos/videos-views-cleaner.ts
index 0be03ddd2..82268b1be 100644
--- a/server/tests/api/videos/videos-views-cleaner.ts
+++ b/server/tests/api/videos/videos-views-cleaner.ts
@@ -4,8 +4,8 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 doubleFollow,
8 createMultipleServers, 7 createMultipleServers,
8 doubleFollow,
9 killallServers, 9 killallServers,
10 PeerTubeServer, 10 PeerTubeServer,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
diff --git a/server/tests/cli/create-import-video-file-job.ts b/server/tests/cli/create-import-video-file-job.ts
index e8cd71e09..bddcff5e7 100644
--- a/server/tests/cli/create-import-video-file-job.ts
+++ b/server/tests/cli/create-import-video-file-job.ts
@@ -2,7 +2,7 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' 5import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
6import { VideoFile } from '@shared/models' 6import { VideoFile } from '@shared/models'
7 7
8const expect = chai.expect 8const expect = chai.expect
diff --git a/server/tests/cli/create-transcoding-job.ts b/server/tests/cli/create-transcoding-job.ts
index 53f187f90..df787ccdc 100644
--- a/server/tests/cli/create-transcoding-job.ts
+++ b/server/tests/cli/create-transcoding-job.ts
@@ -4,8 +4,8 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 doubleFollow,
8 createMultipleServers, 7 createMultipleServers,
8 doubleFollow,
9 PeerTubeServer, 9 PeerTubeServer,
10 setAccessTokensToServers, 10 setAccessTokensToServers,
11 waitJobs 11 waitJobs
diff --git a/server/tests/cli/optimize-old-videos.ts b/server/tests/cli/optimize-old-videos.ts
index 53f47a85e..685b3b7b8 100644
--- a/server/tests/cli/optimize-old-videos.ts
+++ b/server/tests/cli/optimize-old-videos.ts
@@ -5,8 +5,8 @@ import * as chai from 'chai'
5import { join } from 'path' 5import { join } from 'path'
6import { 6import {
7 cleanupTests, 7 cleanupTests,
8 doubleFollow,
9 createMultipleServers, 8 createMultipleServers,
9 doubleFollow,
10 generateHighBitrateVideo, 10 generateHighBitrateVideo,
11 PeerTubeServer, 11 PeerTubeServer,
12 setAccessTokensToServers, 12 setAccessTokensToServers,
diff --git a/server/tests/cli/plugins.ts b/server/tests/cli/plugins.ts
index 42651d79c..07c78cc89 100644
--- a/server/tests/cli/plugins.ts
+++ b/server/tests/cli/plugins.ts
@@ -6,8 +6,8 @@ import {
6 cleanupTests, 6 cleanupTests,
7 createSingleServer, 7 createSingleServer,
8 killallServers, 8 killallServers,
9 PluginsCommand,
10 PeerTubeServer, 9 PeerTubeServer,
10 PluginsCommand,
11 setAccessTokensToServers 11 setAccessTokensToServers
12} from '../../../shared/extra-utils' 12} from '../../../shared/extra-utils'
13 13
diff --git a/server/tests/cli/prune-storage.ts b/server/tests/cli/prune-storage.ts
index 2bd4a466b..954a87833 100644
--- a/server/tests/cli/prune-storage.ts
+++ b/server/tests/cli/prune-storage.ts
@@ -5,12 +5,11 @@ import * as chai from 'chai'
5import { createFile, readdir } from 'fs-extra' 5import { createFile, readdir } from 'fs-extra'
6import { join } from 'path' 6import { join } from 'path'
7import { buildUUID } from '@server/helpers/uuid' 7import { buildUUID } from '@server/helpers/uuid'
8import { HttpStatusCode } from '@shared/models'
9import { 8import {
10 cleanupTests, 9 cleanupTests,
11 CLICommand, 10 CLICommand,
12 doubleFollow,
13 createMultipleServers, 11 createMultipleServers,
12 doubleFollow,
14 killallServers, 13 killallServers,
15 makeGetRequest, 14 makeGetRequest,
16 PeerTubeServer, 15 PeerTubeServer,
@@ -19,7 +18,7 @@ import {
19 wait, 18 wait,
20 waitJobs 19 waitJobs
21} from '@shared/extra-utils' 20} from '@shared/extra-utils'
22import { VideoPlaylistPrivacy } from '@shared/models' 21import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models'
23 22
24const expect = chai.expect 23const expect = chai.expect
25 24
diff --git a/server/tests/cli/regenerate-thumbnails.ts b/server/tests/cli/regenerate-thumbnails.ts
index 595d842ef..780c9b4bd 100644
--- a/server/tests/cli/regenerate-thumbnails.ts
+++ b/server/tests/cli/regenerate-thumbnails.ts
@@ -2,12 +2,11 @@ import 'mocha'
2import { expect } from 'chai' 2import { expect } from 'chai'
3import { writeFile } from 'fs-extra' 3import { writeFile } from 'fs-extra'
4import { basename, join } from 'path' 4import { basename, join } from 'path'
5import { HttpStatusCode } from '@shared/models' 5import { HttpStatusCode, Video } from '@shared/models'
6import { Video } from '@shared/models'
7import { 6import {
8 cleanupTests, 7 cleanupTests,
9 doubleFollow,
10 createMultipleServers, 8 createMultipleServers,
9 doubleFollow,
11 makeRawRequest, 10 makeRawRequest,
12 PeerTubeServer, 11 PeerTubeServer,
13 setAccessTokensToServers, 12 setAccessTokensToServers,
diff --git a/server/tests/client.ts b/server/tests/client.ts
index 6255c6961..9c27a7aae 100644
--- a/server/tests/client.ts
+++ b/server/tests/client.ts
@@ -3,12 +3,11 @@
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { omit } from 'lodash' 5import { omit } from 'lodash'
6import { HttpStatusCode } from '@shared/models' 6import { Account, HTMLServerConfig, HttpStatusCode, ServerConfig, VideoPlaylistCreateResult, VideoPlaylistPrivacy } from '@shared/models'
7import { Account, HTMLServerConfig, ServerConfig, VideoPlaylistCreateResult, VideoPlaylistPrivacy } from '@shared/models'
8import { 7import {
9 cleanupTests, 8 cleanupTests,
10 doubleFollow,
11 createMultipleServers, 9 createMultipleServers,
10 doubleFollow,
12 makeGetRequest, 11 makeGetRequest,
13 makeHTMLRequest, 12 makeHTMLRequest,
14 PeerTubeServer, 13 PeerTubeServer,
diff --git a/server/tests/external-plugins/auth-ldap.ts b/server/tests/external-plugins/auth-ldap.ts
index 12b4a1b8d..acec69df5 100644
--- a/server/tests/external-plugins/auth-ldap.ts
+++ b/server/tests/external-plugins/auth-ldap.ts
@@ -2,8 +2,8 @@
2 2
3import 'mocha' 3import 'mocha'
4import { expect } from 'chai' 4import { expect } from 'chai'
5import { HttpStatusCode } from '@shared/models'
6import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' 5import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils'
6import { HttpStatusCode } from '@shared/models'
7 7
8describe('Official plugin auth-ldap', function () { 8describe('Official plugin auth-ldap', function () {
9 let server: PeerTubeServer 9 let server: PeerTubeServer
diff --git a/server/tests/external-plugins/auto-block-videos.ts b/server/tests/external-plugins/auto-block-videos.ts
index 78b13eded..0eb4bda9a 100644
--- a/server/tests/external-plugins/auto-block-videos.ts
+++ b/server/tests/external-plugins/auto-block-videos.ts
@@ -4,8 +4,8 @@ import 'mocha'
4import { expect } from 'chai' 4import { expect } from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 doubleFollow,
8 createMultipleServers, 7 createMultipleServers,
8 doubleFollow,
9 killallServers, 9 killallServers,
10 MockBlocklist, 10 MockBlocklist,
11 PeerTubeServer, 11 PeerTubeServer,
diff --git a/server/tests/external-plugins/auto-mute.ts b/server/tests/external-plugins/auto-mute.ts
index b2046313b..271779dd4 100644
--- a/server/tests/external-plugins/auto-mute.ts
+++ b/server/tests/external-plugins/auto-mute.ts
@@ -2,11 +2,10 @@
2 2
3import 'mocha' 3import 'mocha'
4import { expect } from 'chai' 4import { expect } from 'chai'
5import { HttpStatusCode } from '@shared/models'
6import { 5import {
7 cleanupTests, 6 cleanupTests,
8 doubleFollow,
9 createMultipleServers, 7 createMultipleServers,
8 doubleFollow,
10 killallServers, 9 killallServers,
11 makeGetRequest, 10 makeGetRequest,
12 MockBlocklist, 11 MockBlocklist,
@@ -14,6 +13,7 @@ import {
14 setAccessTokensToServers, 13 setAccessTokensToServers,
15 wait 14 wait
16} from '@shared/extra-utils' 15} from '@shared/extra-utils'
16import { HttpStatusCode } from '@shared/models'
17 17
18describe('Official plugin auto-mute', function () { 18describe('Official plugin auto-mute', function () {
19 const autoMuteListPath = '/plugins/auto-mute/router/api/v1/mute-list' 19 const autoMuteListPath = '/plugins/auto-mute/router/api/v1/mute-list'
diff --git a/server/tests/feeds/feeds.ts b/server/tests/feeds/feeds.ts
index 543c431dd..5667207c0 100644
--- a/server/tests/feeds/feeds.ts
+++ b/server/tests/feeds/feeds.ts
@@ -3,17 +3,16 @@
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import * as xmlParser from 'fast-xml-parser' 5import * as xmlParser from 'fast-xml-parser'
6import { HttpStatusCode } from '@shared/models'
7import { 6import {
8 cleanupTests, 7 cleanupTests,
9 doubleFollow,
10 createMultipleServers, 8 createMultipleServers,
11 createSingleServer, 9 createSingleServer,
10 doubleFollow,
12 PeerTubeServer, 11 PeerTubeServer,
13 setAccessTokensToServers, 12 setAccessTokensToServers,
14 waitJobs 13 waitJobs
15} from '@shared/extra-utils' 14} from '@shared/extra-utils'
16import { VideoPrivacy } from '@shared/models' 15import { HttpStatusCode, VideoPrivacy } from '@shared/models'
17 16
18chai.use(require('chai-xml')) 17chai.use(require('chai-xml'))
19chai.use(require('chai-json-schema')) 18chai.use(require('chai-json-schema'))
diff --git a/server/tests/helpers/comment-model.ts b/server/tests/helpers/comment-model.ts
index 4c51b7000..31dc6ec72 100644
--- a/server/tests/helpers/comment-model.ts
+++ b/server/tests/helpers/comment-model.ts
@@ -1,7 +1,7 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import * as chai from 'chai'
4import 'mocha' 3import 'mocha'
4import * as chai from 'chai'
5import { VideoCommentModel } from '../../models/video/video-comment' 5import { VideoCommentModel } from '../../models/video/video-comment'
6 6
7const expect = chai.expect 7const expect = chai.expect
diff --git a/server/tests/helpers/core-utils.ts b/server/tests/helpers/core-utils.ts
index c028b316d..d5cac51a3 100644
--- a/server/tests/helpers/core-utils.ts
+++ b/server/tests/helpers/core-utils.ts
@@ -1,10 +1,10 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import * as chai from 'chai'
4import 'mocha' 3import 'mocha'
4import * as chai from 'chai'
5import { snakeCase } from 'lodash' 5import { snakeCase } from 'lodash'
6import { objectConverter, parseBytes } from '../../helpers/core-utils'
7import validator from 'validator' 6import validator from 'validator'
7import { objectConverter, parseBytes } from '../../helpers/core-utils'
8 8
9const expect = chai.expect 9const expect = chai.expect
10 10
diff --git a/server/tests/helpers/image.ts b/server/tests/helpers/image.ts
index 54911697f..9fe9aa4cb 100644
--- a/server/tests/helpers/image.ts
+++ b/server/tests/helpers/image.ts
@@ -1,11 +1,11 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import 'mocha' 3import 'mocha'
4import { expect } from 'chai'
4import { readFile, remove } from 'fs-extra' 5import { readFile, remove } from 'fs-extra'
5import { join } from 'path' 6import { join } from 'path'
6import { processImage } from '../../../server/helpers/image-utils' 7import { processImage } from '../../../server/helpers/image-utils'
7import { buildAbsoluteFixturePath, root } from '../../../shared/extra-utils' 8import { buildAbsoluteFixturePath, root } from '../../../shared/extra-utils'
8import { expect } from 'chai'
9 9
10async function checkBuffers (path1: string, path2: string, equals: boolean) { 10async function checkBuffers (path1: string, path2: string, equals: boolean) {
11 const [ buf1, buf2 ] = await Promise.all([ 11 const [ buf1, buf2 ] = await Promise.all([
diff --git a/server/tests/misc-endpoints.ts b/server/tests/misc-endpoints.ts
index 4d9c07f1a..4968eef08 100644
--- a/server/tests/misc-endpoints.ts
+++ b/server/tests/misc-endpoints.ts
@@ -2,9 +2,8 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/models'
6import { cleanupTests, createSingleServer, makeGetRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' 5import { cleanupTests, createSingleServer, makeGetRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils'
7import { VideoPrivacy } from '@shared/models' 6import { HttpStatusCode, VideoPrivacy } from '@shared/models'
8 7
9const expect = chai.expect 8const expect = chai.expect
10 9
diff --git a/server/tests/plugins/action-hooks.ts b/server/tests/plugins/action-hooks.ts
index b96de4e90..4c1bc7d06 100644
--- a/server/tests/plugins/action-hooks.ts
+++ b/server/tests/plugins/action-hooks.ts
@@ -120,7 +120,7 @@ describe('Test plugin action hooks', function () {
120 }) 120 })
121 121
122 it('Should run action:api.user.oauth2-got-token', async function () { 122 it('Should run action:api.user.oauth2-got-token', async function () {
123 await servers[0].login.getAccessToken('created_user', 'super_password') 123 await servers[0].login.login({ user: { username: 'created_user' } })
124 124
125 await checkHook('action:api.user.oauth2-got-token') 125 await checkHook('action:api.user.oauth2-got-token')
126 }) 126 })
diff --git a/server/tests/plugins/external-auth.ts b/server/tests/plugins/external-auth.ts
index a2828603a..f3e018d43 100644
--- a/server/tests/plugins/external-auth.ts
+++ b/server/tests/plugins/external-auth.ts
@@ -2,17 +2,16 @@
2 2
3import 'mocha' 3import 'mocha'
4import { expect } from 'chai' 4import { expect } from 'chai'
5import { HttpStatusCode } from '@shared/models'
6import { 5import {
7 cleanupTests, 6 cleanupTests,
8 decodeQueryString,
9 createSingleServer, 7 createSingleServer,
10 PluginsCommand, 8 decodeQueryString,
11 PeerTubeServer, 9 PeerTubeServer,
10 PluginsCommand,
12 setAccessTokensToServers, 11 setAccessTokensToServers,
13 wait 12 wait
14} from '@shared/extra-utils' 13} from '@shared/extra-utils'
15import { UserRole } from '@shared/models' 14import { HttpStatusCode, UserRole } from '@shared/models'
16 15
17async function loginExternal (options: { 16async function loginExternal (options: {
18 server: PeerTubeServer 17 server: PeerTubeServer
diff --git a/server/tests/plugins/filter-hooks.ts b/server/tests/plugins/filter-hooks.ts
index ba84dd27a..c00ac8f91 100644
--- a/server/tests/plugins/filter-hooks.ts
+++ b/server/tests/plugins/filter-hooks.ts
@@ -2,7 +2,6 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/models'
6import { 5import {
7 cleanupTests, 6 cleanupTests,
8 createMultipleServers, 7 createMultipleServers,
@@ -15,7 +14,7 @@ import {
15 setDefaultVideoChannel, 14 setDefaultVideoChannel,
16 waitJobs 15 waitJobs
17} from '@shared/extra-utils' 16} from '@shared/extra-utils'
18import { VideoDetails, VideoImportState, VideoPlaylist, VideoPlaylistPrivacy, VideoPrivacy } from '@shared/models' 17import { HttpStatusCode, VideoDetails, VideoImportState, VideoPlaylist, VideoPlaylistPrivacy, VideoPrivacy } from '@shared/models'
19 18
20const expect = chai.expect 19const expect = chai.expect
21 20
diff --git a/server/tests/plugins/html-injection.ts b/server/tests/plugins/html-injection.ts
index 2902c39b7..95c0cd687 100644
--- a/server/tests/plugins/html-injection.ts
+++ b/server/tests/plugins/html-injection.ts
@@ -6,8 +6,8 @@ import {
6 cleanupTests, 6 cleanupTests,
7 createSingleServer, 7 createSingleServer,
8 makeHTMLRequest, 8 makeHTMLRequest,
9 PluginsCommand,
10 PeerTubeServer, 9 PeerTubeServer,
10 PluginsCommand,
11 setAccessTokensToServers 11 setAccessTokensToServers
12} from '../../../shared/extra-utils' 12} from '../../../shared/extra-utils'
13 13
diff --git a/server/tests/plugins/id-and-pass-auth.ts b/server/tests/plugins/id-and-pass-auth.ts
index a73d76caa..fde0166f9 100644
--- a/server/tests/plugins/id-and-pass-auth.ts
+++ b/server/tests/plugins/id-and-pass-auth.ts
@@ -2,9 +2,8 @@
2 2
3import 'mocha' 3import 'mocha'
4import { expect } from 'chai' 4import { expect } from 'chai'
5import { HttpStatusCode } from '@shared/models' 5import { cleanupTests, createSingleServer, PeerTubeServer, PluginsCommand, setAccessTokensToServers, wait } from '@shared/extra-utils'
6import { cleanupTests, createSingleServer, PluginsCommand, PeerTubeServer, setAccessTokensToServers, wait } from '@shared/extra-utils' 6import { HttpStatusCode, UserRole } from '@shared/models'
7import { UserRole } from '@shared/models'
8 7
9describe('Test id and pass auth plugins', function () { 8describe('Test id and pass auth plugins', function () {
10 let server: PeerTubeServer 9 let server: PeerTubeServer
diff --git a/server/tests/plugins/plugin-helpers.ts b/server/tests/plugins/plugin-helpers.ts
index 5cb664bda..242994273 100644
--- a/server/tests/plugins/plugin-helpers.ts
+++ b/server/tests/plugins/plugin-helpers.ts
@@ -2,19 +2,19 @@
2 2
3import 'mocha' 3import 'mocha'
4import { expect } from 'chai' 4import { expect } from 'chai'
5import { HttpStatusCode } from '@shared/models'
6import { 5import {
7 checkVideoFilesWereRemoved, 6 checkVideoFilesWereRemoved,
8 cleanupTests, 7 cleanupTests,
9 doubleFollow,
10 createMultipleServers, 8 createMultipleServers,
9 doubleFollow,
11 makeGetRequest, 10 makeGetRequest,
12 makePostBodyRequest, 11 makePostBodyRequest,
13 PluginsCommand,
14 PeerTubeServer, 12 PeerTubeServer,
13 PluginsCommand,
15 setAccessTokensToServers, 14 setAccessTokensToServers,
16 waitJobs 15 waitJobs
17} from '@shared/extra-utils' 16} from '@shared/extra-utils'
17import { HttpStatusCode } from '@shared/models'
18 18
19function postCommand (server: PeerTubeServer, command: string, bodyArg?: object) { 19function postCommand (server: PeerTubeServer, command: string, bodyArg?: object) {
20 const body = { command } 20 const body = { command }
diff --git a/server/tests/plugins/plugin-router.ts b/server/tests/plugins/plugin-router.ts
index becb7c47b..b1ac9e2fe 100644
--- a/server/tests/plugins/plugin-router.ts
+++ b/server/tests/plugins/plugin-router.ts
@@ -2,16 +2,16 @@
2 2
3import 'mocha' 3import 'mocha'
4import { expect } from 'chai' 4import { expect } from 'chai'
5import { HttpStatusCode } from '@shared/models'
6import { 5import {
7 cleanupTests, 6 cleanupTests,
8 createSingleServer, 7 createSingleServer,
9 makeGetRequest, 8 makeGetRequest,
10 makePostBodyRequest, 9 makePostBodyRequest,
11 PluginsCommand,
12 PeerTubeServer, 10 PeerTubeServer,
11 PluginsCommand,
13 setAccessTokensToServers 12 setAccessTokensToServers
14} from '@shared/extra-utils' 13} from '@shared/extra-utils'
14import { HttpStatusCode } from '@shared/models'
15 15
16describe('Test plugin helpers', function () { 16describe('Test plugin helpers', function () {
17 let server: PeerTubeServer 17 let server: PeerTubeServer
diff --git a/server/tests/plugins/plugin-storage.ts b/server/tests/plugins/plugin-storage.ts
index 90dafa3e1..e20c36dba 100644
--- a/server/tests/plugins/plugin-storage.ts
+++ b/server/tests/plugins/plugin-storage.ts
@@ -4,7 +4,6 @@ import 'mocha'
4import { expect } from 'chai' 4import { expect } from 'chai'
5import { pathExists, readdir, readFile } from 'fs-extra' 5import { pathExists, readdir, readFile } from 'fs-extra'
6import { join } from 'path' 6import { join } from 'path'
7import { HttpStatusCode } from '@shared/models'
8import { 7import {
9 cleanupTests, 8 cleanupTests,
10 createSingleServer, 9 createSingleServer,
@@ -13,6 +12,7 @@ import {
13 PluginsCommand, 12 PluginsCommand,
14 setAccessTokensToServers 13 setAccessTokensToServers
15} from '@shared/extra-utils' 14} from '@shared/extra-utils'
15import { HttpStatusCode } from '@shared/models'
16 16
17describe('Test plugin storage', function () { 17describe('Test plugin storage', function () {
18 let server: PeerTubeServer 18 let server: PeerTubeServer
diff --git a/server/tests/plugins/plugin-transcoding.ts b/server/tests/plugins/plugin-transcoding.ts
index 3c54d3796..0bf1fab01 100644
--- a/server/tests/plugins/plugin-transcoding.ts
+++ b/server/tests/plugins/plugin-transcoding.ts
@@ -7,8 +7,8 @@ import { getAudioStream, getVideoFileFPS, getVideoStreamFromFile } from '@server
7import { 7import {
8 cleanupTests, 8 cleanupTests,
9 createSingleServer, 9 createSingleServer,
10 PluginsCommand,
11 PeerTubeServer, 10 PeerTubeServer,
11 PluginsCommand,
12 setAccessTokensToServers, 12 setAccessTokensToServers,
13 setDefaultVideoChannel, 13 setDefaultVideoChannel,
14 testFfmpegStreamError, 14 testFfmpegStreamError,
diff --git a/server/tests/plugins/plugin-unloading.ts b/server/tests/plugins/plugin-unloading.ts
index faf9cc599..6bf2fda9b 100644
--- a/server/tests/plugins/plugin-unloading.ts
+++ b/server/tests/plugins/plugin-unloading.ts
@@ -2,7 +2,6 @@
2 2
3import 'mocha' 3import 'mocha'
4import { expect } from 'chai' 4import { expect } from 'chai'
5import { HttpStatusCode } from '@shared/models'
6import { 5import {
7 cleanupTests, 6 cleanupTests,
8 createSingleServer, 7 createSingleServer,
@@ -11,6 +10,7 @@ import {
11 PluginsCommand, 10 PluginsCommand,
12 setAccessTokensToServers 11 setAccessTokensToServers
13} from '@shared/extra-utils' 12} from '@shared/extra-utils'
13import { HttpStatusCode } from '@shared/models'
14 14
15describe('Test plugins module unloading', function () { 15describe('Test plugins module unloading', function () {
16 let server: PeerTubeServer = null 16 let server: PeerTubeServer = null
diff --git a/server/tests/plugins/video-constants.ts b/server/tests/plugins/video-constants.ts
index dd3b40225..f527a2b30 100644
--- a/server/tests/plugins/video-constants.ts
+++ b/server/tests/plugins/video-constants.ts
@@ -2,9 +2,8 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/models' 5import { cleanupTests, createSingleServer, PeerTubeServer, PluginsCommand, setAccessTokensToServers } from '@shared/extra-utils'
6import { cleanupTests, createSingleServer, PluginsCommand, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' 6import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models'
7import { VideoPlaylistPrivacy } from '@shared/models'
8 7
9const expect = chai.expect 8const expect = chai.expect
10 9
diff --git a/server/tools/peertube-redundancy.ts b/server/tools/peertube-redundancy.ts
index bcaae63a3..73b026ac8 100644
--- a/server/tools/peertube-redundancy.ts
+++ b/server/tools/peertube-redundancy.ts
@@ -6,8 +6,7 @@ import { Command, program } from 'commander'
6import { uniq } from 'lodash' 6import { uniq } from 'lodash'
7import { URL } from 'url' 7import { URL } from 'url'
8import validator from 'validator' 8import validator from 'validator'
9import { HttpStatusCode } from '@shared/models' 9import { HttpStatusCode, VideoRedundanciesTarget } from '@shared/models'
10import { VideoRedundanciesTarget } from '@shared/models'
11import { assignToken, buildServer, getServerCredentials } from './cli' 10import { assignToken, buildServer, getServerCredentials } from './cli'
12 11
13import bytes = require('bytes') 12import bytes = require('bytes')
diff --git a/shared/extra-utils/custom-pages/custom-pages-command.ts b/shared/extra-utils/custom-pages/custom-pages-command.ts
index 6042233d4..cd869a8de 100644
--- a/shared/extra-utils/custom-pages/custom-pages-command.ts
+++ b/shared/extra-utils/custom-pages/custom-pages-command.ts
@@ -1,5 +1,4 @@
1import { CustomPage } from '@shared/models' 1import { CustomPage, HttpStatusCode } from '@shared/models'
2import { HttpStatusCode } from '@shared/models'
3import { AbstractCommand, OverrideCommandOptions } from '../shared' 2import { AbstractCommand, OverrideCommandOptions } from '../shared'
4 3
5export class CustomPagesCommand extends AbstractCommand { 4export class CustomPagesCommand extends AbstractCommand {
diff --git a/shared/extra-utils/miscs/generate.ts b/shared/extra-utils/miscs/generate.ts
index 4e70ab853..8d6435481 100644
--- a/shared/extra-utils/miscs/generate.ts
+++ b/shared/extra-utils/miscs/generate.ts
@@ -1,7 +1,7 @@
1import * as ffmpeg from 'fluent-ffmpeg'
1import { ensureDir, pathExists } from 'fs-extra' 2import { ensureDir, pathExists } from 'fs-extra'
2import { dirname } from 'path' 3import { dirname } from 'path'
3import { buildAbsoluteFixturePath } from './tests' 4import { buildAbsoluteFixturePath } from './tests'
4import * as ffmpeg from 'fluent-ffmpeg'
5 5
6async function generateHighBitrateVideo () { 6async function generateHighBitrateVideo () {
7 const tempFixturePath = buildAbsoluteFixturePath('video_high_bitrate_1080p.mp4', true) 7 const tempFixturePath = buildAbsoluteFixturePath('video_high_bitrate_1080p.mp4', true)
diff --git a/shared/extra-utils/moderation/abuses-command.ts b/shared/extra-utils/moderation/abuses-command.ts
index 72f2c9951..7b3abb056 100644
--- a/shared/extra-utils/moderation/abuses-command.ts
+++ b/shared/extra-utils/moderation/abuses-command.ts
@@ -7,12 +7,12 @@ import {
7 AbuseUpdate, 7 AbuseUpdate,
8 AbuseVideoIs, 8 AbuseVideoIs,
9 AdminAbuse, 9 AdminAbuse,
10 HttpStatusCode,
10 ResultList, 11 ResultList,
11 UserAbuse 12 UserAbuse
12} from '@shared/models' 13} from '@shared/models'
13import { HttpStatusCode } from '@shared/models'
14import { AbstractCommand, OverrideCommandOptions } from '../shared'
15import { unwrapBody } from '../requests/requests' 14import { unwrapBody } from '../requests/requests'
15import { AbstractCommand, OverrideCommandOptions } from '../shared'
16 16
17export class AbusesCommand extends AbstractCommand { 17export class AbusesCommand extends AbstractCommand {
18 18
diff --git a/shared/extra-utils/overviews/overviews-command.ts b/shared/extra-utils/overviews/overviews-command.ts
index d4a2ac254..06b4892d2 100644
--- a/shared/extra-utils/overviews/overviews-command.ts
+++ b/shared/extra-utils/overviews/overviews-command.ts
@@ -1,5 +1,4 @@
1import { HttpStatusCode } from '@shared/models' 1import { HttpStatusCode, VideosOverview } from '@shared/models'
2import { VideosOverview } from '@shared/models'
3import { AbstractCommand, OverrideCommandOptions } from '../shared' 2import { AbstractCommand, OverrideCommandOptions } from '../shared'
4 3
5export class OverviewsCommand extends AbstractCommand { 4export class OverviewsCommand extends AbstractCommand {
diff --git a/shared/extra-utils/requests/activitypub.ts b/shared/extra-utils/requests/activitypub.ts
index ecd8ce823..4ae878384 100644
--- a/shared/extra-utils/requests/activitypub.ts
+++ b/shared/extra-utils/requests/activitypub.ts
@@ -1,7 +1,7 @@
1import { activityPubContextify } from '../../../server/helpers/activitypub'
1import { doRequest } from '../../../server/helpers/requests' 2import { doRequest } from '../../../server/helpers/requests'
2import { HTTP_SIGNATURE } from '../../../server/initializers/constants' 3import { HTTP_SIGNATURE } from '../../../server/initializers/constants'
3import { buildGlobalHeaders } from '../../../server/lib/job-queue/handlers/utils/activitypub-http-utils' 4import { buildGlobalHeaders } from '../../../server/lib/job-queue/handlers/utils/activitypub-http-utils'
4import { activityPubContextify } from '../../../server/helpers/activitypub'
5 5
6function makePOSTAPRequest (url: string, body: any, httpSignature: any, headers: any) { 6function makePOSTAPRequest (url: string, body: any, httpSignature: any, headers: any) {
7 const options = { 7 const options = {
diff --git a/shared/extra-utils/search/search-command.ts b/shared/extra-utils/search/search-command.ts
index 09f5d3f1d..0fbbcd6ef 100644
--- a/shared/extra-utils/search/search-command.ts
+++ b/shared/extra-utils/search/search-command.ts
@@ -1,4 +1,5 @@
1import { 1import {
2 HttpStatusCode,
2 ResultList, 3 ResultList,
3 Video, 4 Video,
4 VideoChannel, 5 VideoChannel,
@@ -7,7 +8,6 @@ import {
7 VideoPlaylistsSearchQuery, 8 VideoPlaylistsSearchQuery,
8 VideosSearchQuery 9 VideosSearchQuery
9} from '@shared/models' 10} from '@shared/models'
10import { HttpStatusCode } from '@shared/models'
11import { AbstractCommand, OverrideCommandOptions } from '../shared' 11import { AbstractCommand, OverrideCommandOptions } from '../shared'
12 12
13export class SearchCommand extends AbstractCommand { 13export class SearchCommand extends AbstractCommand {
diff --git a/shared/extra-utils/server/config-command.ts b/shared/extra-utils/server/config-command.ts
index 6e875fdf6..11148aa46 100644
--- a/shared/extra-utils/server/config-command.ts
+++ b/shared/extra-utils/server/config-command.ts
@@ -1,6 +1,6 @@
1import { merge } from 'lodash' 1import { merge } from 'lodash'
2import { DeepPartial } from '@shared/core-utils' 2import { DeepPartial } from '@shared/core-utils'
3import { About, ServerConfig, HttpStatusCode } from '@shared/models' 3import { About, HttpStatusCode, ServerConfig } from '@shared/models'
4import { CustomConfig } from '../../models/server/custom-config.model' 4import { CustomConfig } from '../../models/server/custom-config.model'
5import { AbstractCommand, OverrideCommandOptions } from '../shared' 5import { AbstractCommand, OverrideCommandOptions } from '../shared'
6 6
diff --git a/shared/extra-utils/server/debug-command.ts b/shared/extra-utils/server/debug-command.ts
index 36704836d..3c5a785bb 100644
--- a/shared/extra-utils/server/debug-command.ts
+++ b/shared/extra-utils/server/debug-command.ts
@@ -1,5 +1,4 @@
1import { Debug, SendDebugCommand } from '@shared/models' 1import { Debug, HttpStatusCode, SendDebugCommand } from '@shared/models'
2import { HttpStatusCode } from '@shared/models'
3import { AbstractCommand, OverrideCommandOptions } from '../shared' 2import { AbstractCommand, OverrideCommandOptions } from '../shared'
4 3
5export class DebugCommand extends AbstractCommand { 4export class DebugCommand extends AbstractCommand {
diff --git a/shared/extra-utils/server/follows-command.ts b/shared/extra-utils/server/follows-command.ts
index 694f5ea24..dce674ac5 100644
--- a/shared/extra-utils/server/follows-command.ts
+++ b/shared/extra-utils/server/follows-command.ts
@@ -1,6 +1,5 @@
1import { pick } from 'lodash' 1import { pick } from 'lodash'
2import { ActivityPubActorType, ActorFollow, FollowState, ResultList } from '@shared/models' 2import { ActivityPubActorType, ActorFollow, FollowState, HttpStatusCode, ResultList } from '@shared/models'
3import { HttpStatusCode } from '@shared/models'
4import { AbstractCommand, OverrideCommandOptions } from '../shared' 3import { AbstractCommand, OverrideCommandOptions } from '../shared'
5import { PeerTubeServer } from './server' 4import { PeerTubeServer } from './server'
6 5
diff --git a/shared/extra-utils/server/plugins-command.ts b/shared/extra-utils/server/plugins-command.ts
index 59bc79b3d..b944475a2 100644
--- a/shared/extra-utils/server/plugins-command.ts
+++ b/shared/extra-utils/server/plugins-command.ts
@@ -3,8 +3,8 @@
3import { readJSON, writeJSON } from 'fs-extra' 3import { readJSON, writeJSON } from 'fs-extra'
4import { join } from 'path' 4import { join } from 'path'
5import { root } from '@server/helpers/core-utils' 5import { root } from '@server/helpers/core-utils'
6import { HttpStatusCode } from '@shared/models'
7import { 6import {
7 HttpStatusCode,
8 PeerTubePlugin, 8 PeerTubePlugin,
9 PeerTubePluginIndex, 9 PeerTubePluginIndex,
10 PeertubePluginIndexList, 10 PeertubePluginIndexList,
diff --git a/shared/extra-utils/server/redundancy-command.ts b/shared/extra-utils/server/redundancy-command.ts
index 137d7f01c..e7a8b3c29 100644
--- a/shared/extra-utils/server/redundancy-command.ts
+++ b/shared/extra-utils/server/redundancy-command.ts
@@ -1,5 +1,4 @@
1import { ResultList, VideoRedundanciesTarget, VideoRedundancy } from '@shared/models' 1import { HttpStatusCode, ResultList, VideoRedundanciesTarget, VideoRedundancy } from '@shared/models'
2import { HttpStatusCode } from '@shared/models'
3import { AbstractCommand, OverrideCommandOptions } from '../shared' 2import { AbstractCommand, OverrideCommandOptions } from '../shared'
4 3
5export class RedundancyCommand extends AbstractCommand { 4export class RedundancyCommand extends AbstractCommand {
diff --git a/shared/extra-utils/server/stats-command.ts b/shared/extra-utils/server/stats-command.ts
index 6db473588..64a452306 100644
--- a/shared/extra-utils/server/stats-command.ts
+++ b/shared/extra-utils/server/stats-command.ts
@@ -1,5 +1,4 @@
1import { ServerStats } from '@shared/models' 1import { HttpStatusCode, ServerStats } from '@shared/models'
2import { HttpStatusCode } from '@shared/models'
3import { AbstractCommand, OverrideCommandOptions } from '../shared' 2import { AbstractCommand, OverrideCommandOptions } from '../shared'
4 3
5export class StatsCommand extends AbstractCommand { 4export class StatsCommand extends AbstractCommand {
diff --git a/shared/extra-utils/users/accounts-command.ts b/shared/extra-utils/users/accounts-command.ts
index 08977e58b..2f586104e 100644
--- a/shared/extra-utils/users/accounts-command.ts
+++ b/shared/extra-utils/users/accounts-command.ts
@@ -1,5 +1,4 @@
1import { ResultList } from '@shared/models' 1import { HttpStatusCode, ResultList } from '@shared/models'
2import { HttpStatusCode } from '@shared/models'
3import { Account } from '../../models/actors' 2import { Account } from '../../models/actors'
4import { AccountVideoRate, VideoRateType } from '../../models/videos' 3import { AccountVideoRate, VideoRateType } from '../../models/videos'
5import { AbstractCommand, OverrideCommandOptions } from '../shared' 4import { AbstractCommand, OverrideCommandOptions } from '../shared'
diff --git a/shared/extra-utils/users/blocklist-command.ts b/shared/extra-utils/users/blocklist-command.ts
index a9431acf3..14491a1ae 100644
--- a/shared/extra-utils/users/blocklist-command.ts
+++ b/shared/extra-utils/users/blocklist-command.ts
@@ -1,7 +1,6 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import { HttpStatusCode } from '@shared/models' 3import { AccountBlock, HttpStatusCode, ResultList, ServerBlock } from '@shared/models'
4import { AccountBlock, ResultList, ServerBlock } from '@shared/models'
5import { AbstractCommand, OverrideCommandOptions } from '../shared' 4import { AbstractCommand, OverrideCommandOptions } from '../shared'
6 5
7type ListBlocklistOptions = OverrideCommandOptions & { 6type ListBlocklistOptions = OverrideCommandOptions & {
diff --git a/shared/extra-utils/users/login-command.ts b/shared/extra-utils/users/login-command.ts
index b39577260..143f72a59 100644
--- a/shared/extra-utils/users/login-command.ts
+++ b/shared/extra-utils/users/login-command.ts
@@ -1,5 +1,4 @@
1import { HttpStatusCode } from '@shared/models' 1import { HttpStatusCode, PeerTubeProblemDocument } from '@shared/models'
2import { PeerTubeProblemDocument } from '@shared/models'
3import { unwrapBody } from '../requests' 2import { unwrapBody } from '../requests'
4import { AbstractCommand, OverrideCommandOptions } from '../shared' 3import { AbstractCommand, OverrideCommandOptions } from '../shared'
5 4
diff --git a/shared/extra-utils/users/notifications-command.ts b/shared/extra-utils/users/notifications-command.ts
index a51fcc3af..2d79a3747 100644
--- a/shared/extra-utils/users/notifications-command.ts
+++ b/shared/extra-utils/users/notifications-command.ts
@@ -1,5 +1,4 @@
1import { ResultList } from '@shared/models' 1import { HttpStatusCode, ResultList } from '@shared/models'
2import { HttpStatusCode } from '@shared/models'
3import { UserNotification, UserNotificationSetting } from '../../models/users' 2import { UserNotification, UserNotificationSetting } from '../../models/users'
4import { AbstractCommand, OverrideCommandOptions } from '../shared' 3import { AbstractCommand, OverrideCommandOptions } from '../shared'
5 4
diff --git a/shared/extra-utils/users/subscriptions-command.ts b/shared/extra-utils/users/subscriptions-command.ts
index a69d2a194..edc60e612 100644
--- a/shared/extra-utils/users/subscriptions-command.ts
+++ b/shared/extra-utils/users/subscriptions-command.ts
@@ -1,5 +1,4 @@
1import { ResultList, Video, VideoChannel } from '@shared/models' 1import { HttpStatusCode, ResultList, Video, VideoChannel } from '@shared/models'
2import { HttpStatusCode } from '@shared/models'
3import { AbstractCommand, OverrideCommandOptions } from '../shared' 2import { AbstractCommand, OverrideCommandOptions } from '../shared'
4 3
5export class SubscriptionsCommand extends AbstractCommand { 4export class SubscriptionsCommand extends AbstractCommand {
diff --git a/shared/extra-utils/users/users-command.ts b/shared/extra-utils/users/users-command.ts
index f3a251e65..d66ad15f2 100644
--- a/shared/extra-utils/users/users-command.ts
+++ b/shared/extra-utils/users/users-command.ts
@@ -1,6 +1,6 @@
1import { omit, pick } from 'lodash' 1import { omit, pick } from 'lodash'
2import { HttpStatusCode } from '@shared/models'
3import { 2import {
3 HttpStatusCode,
4 MyUser, 4 MyUser,
5 ResultList, 5 ResultList,
6 User, 6 User,
diff --git a/shared/extra-utils/videos/blacklist-command.ts b/shared/extra-utils/videos/blacklist-command.ts
index 9404d4c08..3a2ef89ba 100644
--- a/shared/extra-utils/videos/blacklist-command.ts
+++ b/shared/extra-utils/videos/blacklist-command.ts
@@ -1,6 +1,5 @@
1 1
2import { ResultList } from '@shared/models' 2import { HttpStatusCode, ResultList } from '@shared/models'
3import { HttpStatusCode } from '@shared/models'
4import { VideoBlacklist, VideoBlacklistType } from '../../models/videos' 3import { VideoBlacklist, VideoBlacklistType } from '../../models/videos'
5import { AbstractCommand, OverrideCommandOptions } from '../shared' 4import { AbstractCommand, OverrideCommandOptions } from '../shared'
6 5
diff --git a/shared/extra-utils/videos/captions-command.ts b/shared/extra-utils/videos/captions-command.ts
index 04dd32f84..a0608e1a6 100644
--- a/shared/extra-utils/videos/captions-command.ts
+++ b/shared/extra-utils/videos/captions-command.ts
@@ -1,5 +1,4 @@
1import { HttpStatusCode } from '@shared/models' 1import { HttpStatusCode, ResultList, VideoCaption } from '@shared/models'
2import { ResultList, VideoCaption } from '@shared/models'
3import { buildAbsoluteFixturePath } from '../miscs' 2import { buildAbsoluteFixturePath } from '../miscs'
4import { AbstractCommand, OverrideCommandOptions } from '../shared' 3import { AbstractCommand, OverrideCommandOptions } from '../shared'
5 4
diff --git a/shared/extra-utils/videos/change-ownership-command.ts b/shared/extra-utils/videos/change-ownership-command.ts
index ef6f07536..ad4c726ef 100644
--- a/shared/extra-utils/videos/change-ownership-command.ts
+++ b/shared/extra-utils/videos/change-ownership-command.ts
@@ -1,6 +1,5 @@
1 1
2import { ResultList, VideoChangeOwnership } from '@shared/models' 2import { HttpStatusCode, ResultList, VideoChangeOwnership } from '@shared/models'
3import { HttpStatusCode } from '@shared/models'
4import { AbstractCommand, OverrideCommandOptions } from '../shared' 3import { AbstractCommand, OverrideCommandOptions } from '../shared'
5 4
6export class ChangeOwnershipCommand extends AbstractCommand { 5export class ChangeOwnershipCommand extends AbstractCommand {
diff --git a/shared/extra-utils/videos/channels-command.ts b/shared/extra-utils/videos/channels-command.ts
index e5393ff56..f8eb3f885 100644
--- a/shared/extra-utils/videos/channels-command.ts
+++ b/shared/extra-utils/videos/channels-command.ts
@@ -1,6 +1,5 @@
1import { pick } from 'lodash' 1import { pick } from 'lodash'
2import { ResultList, VideoChannel, VideoChannelCreateResult } from '@shared/models' 2import { HttpStatusCode, ResultList, VideoChannel, VideoChannelCreateResult } from '@shared/models'
3import { HttpStatusCode } from '@shared/models'
4import { VideoChannelCreate } from '../../models/videos/channel/video-channel-create.model' 3import { VideoChannelCreate } from '../../models/videos/channel/video-channel-create.model'
5import { VideoChannelUpdate } from '../../models/videos/channel/video-channel-update.model' 4import { VideoChannelUpdate } from '../../models/videos/channel/video-channel-update.model'
6import { unwrapBody } from '../requests' 5import { unwrapBody } from '../requests'
diff --git a/shared/extra-utils/videos/comments-command.ts b/shared/extra-utils/videos/comments-command.ts
index 7368f3ea2..dd14e4b64 100644
--- a/shared/extra-utils/videos/comments-command.ts
+++ b/shared/extra-utils/videos/comments-command.ts
@@ -1,6 +1,5 @@
1import { pick } from 'lodash' 1import { pick } from 'lodash'
2import { HttpStatusCode } from '@shared/models' 2import { HttpStatusCode, ResultList, VideoComment, VideoCommentThreads, VideoCommentThreadTree } from '@shared/models'
3import { ResultList, VideoComment, VideoCommentThreads, VideoCommentThreadTree } from '@shared/models'
4import { unwrapBody } from '../requests' 3import { unwrapBody } from '../requests'
5import { AbstractCommand, OverrideCommandOptions } from '../shared' 4import { AbstractCommand, OverrideCommandOptions } from '../shared'
6 5
diff --git a/shared/extra-utils/videos/history-command.ts b/shared/extra-utils/videos/history-command.ts
index 41afc6bc6..13b7150c1 100644
--- a/shared/extra-utils/videos/history-command.ts
+++ b/shared/extra-utils/videos/history-command.ts
@@ -1,5 +1,4 @@
1import { HttpStatusCode } from '@shared/models' 1import { HttpStatusCode, ResultList, Video } from '@shared/models'
2import { ResultList, Video } from '@shared/models'
3import { AbstractCommand, OverrideCommandOptions } from '../shared' 2import { AbstractCommand, OverrideCommandOptions } from '../shared'
4 3
5export class HistoryCommand extends AbstractCommand { 4export class HistoryCommand extends AbstractCommand {
diff --git a/shared/extra-utils/videos/imports-command.ts b/shared/extra-utils/videos/imports-command.ts
index d30f9745b..e4944694d 100644
--- a/shared/extra-utils/videos/imports-command.ts
+++ b/shared/extra-utils/videos/imports-command.ts
@@ -1,6 +1,5 @@
1 1
2import { HttpStatusCode } from '@shared/models' 2import { HttpStatusCode, ResultList } from '@shared/models'
3import { ResultList } from '@shared/models'
4import { VideoImport, VideoImportCreate } from '../../models/videos' 3import { VideoImport, VideoImportCreate } from '../../models/videos'
5import { unwrapBody } from '../requests' 4import { unwrapBody } from '../requests'
6import { AbstractCommand, OverrideCommandOptions } from '../shared' 5import { AbstractCommand, OverrideCommandOptions } from '../shared'
diff --git a/shared/extra-utils/videos/live-command.ts b/shared/extra-utils/videos/live-command.ts
index 9dfe3087e..bf9486a05 100644
--- a/shared/extra-utils/videos/live-command.ts
+++ b/shared/extra-utils/videos/live-command.ts
@@ -3,8 +3,7 @@
3import { readdir } from 'fs-extra' 3import { readdir } from 'fs-extra'
4import { omit } from 'lodash' 4import { omit } from 'lodash'
5import { join } from 'path' 5import { join } from 'path'
6import { HttpStatusCode } from '@shared/models' 6import { HttpStatusCode, LiveVideo, LiveVideoCreate, LiveVideoUpdate, VideoCreateResult, VideoDetails, VideoState } from '@shared/models'
7import { LiveVideo, LiveVideoCreate, LiveVideoUpdate, VideoCreateResult, VideoDetails, VideoState } from '@shared/models'
8import { wait } from '../miscs' 7import { wait } from '../miscs'
9import { unwrapBody } from '../requests' 8import { unwrapBody } from '../requests'
10import { AbstractCommand, OverrideCommandOptions } from '../shared' 9import { AbstractCommand, OverrideCommandOptions } from '../shared'
diff --git a/shared/extra-utils/videos/playlists-command.ts b/shared/extra-utils/videos/playlists-command.ts
index 40162c30d..6f329800e 100644
--- a/shared/extra-utils/videos/playlists-command.ts
+++ b/shared/extra-utils/videos/playlists-command.ts
@@ -1,7 +1,7 @@
1import { omit, pick } from 'lodash' 1import { omit, pick } from 'lodash'
2import { HttpStatusCode } from '@shared/models'
3import { 2import {
4 BooleanBothQuery, 3 BooleanBothQuery,
4 HttpStatusCode,
5 ResultList, 5 ResultList,
6 VideoExistInPlaylist, 6 VideoExistInPlaylist,
7 VideoPlaylist, 7 VideoPlaylist,
diff --git a/shared/extra-utils/videos/streaming-playlists.ts b/shared/extra-utils/videos/streaming-playlists.ts
index 007d3d98d..1ae3fefc1 100644
--- a/shared/extra-utils/videos/streaming-playlists.ts
+++ b/shared/extra-utils/videos/streaming-playlists.ts
@@ -1,7 +1,6 @@
1import { expect } from 'chai' 1import { expect } from 'chai'
2import { sha256 } from '@server/helpers/core-utils' 2import { sha256 } from '@server/helpers/core-utils'
3import { HttpStatusCode } from '@shared/models' 3import { HttpStatusCode, VideoStreamingPlaylist } from '@shared/models'
4import { VideoStreamingPlaylist } from '@shared/models'
5import { PeerTubeServer } from '../server' 4import { PeerTubeServer } from '../server'
6 5
7async function checkSegmentHash (options: { 6async function checkSegmentHash (options: {
diff --git a/shared/extra-utils/videos/videos-command.ts b/shared/extra-utils/videos/videos-command.ts
index f46d386f4..40cc4dc28 100644
--- a/shared/extra-utils/videos/videos-command.ts
+++ b/shared/extra-utils/videos/videos-command.ts
@@ -7,8 +7,8 @@ import { omit, pick } from 'lodash'
7import validator from 'validator' 7import validator from 'validator'
8import { buildUUID } from '@server/helpers/uuid' 8import { buildUUID } from '@server/helpers/uuid'
9import { loadLanguages } from '@server/initializers/constants' 9import { loadLanguages } from '@server/initializers/constants'
10import { HttpStatusCode } from '@shared/models'
11import { 10import {
11 HttpStatusCode,
12 ResultList, 12 ResultList,
13 UserVideoRateType, 13 UserVideoRateType,
14 Video, 14 Video,
@@ -332,7 +332,7 @@ export class VideosCommand extends AbstractCommand {
332 attributes?: VideoEdit 332 attributes?: VideoEdit
333 mode?: 'legacy' | 'resumable' // default legacy 333 mode?: 'legacy' | 'resumable' // default legacy
334 } = {}) { 334 } = {}) {
335 const { mode = 'legacy', expectedStatus } = options 335 const { mode = 'legacy' } = options
336 let defaultChannelId = 1 336 let defaultChannelId = 1
337 337
338 try { 338 try {
@@ -360,22 +360,23 @@ export class VideosCommand extends AbstractCommand {
360 ...options.attributes 360 ...options.attributes
361 } 361 }
362 362
363 const res = mode === 'legacy' 363 const created = mode === 'legacy'
364 ? await this.buildLegacyUpload({ ...options, attributes }) 364 ? await this.buildLegacyUpload({ ...options, attributes })
365 : await this.buildResumeUpload({ ...options, attributes }) 365 : await this.buildResumeUpload({ ...options, attributes })
366 366
367 // Wait torrent generation 367 // Wait torrent generation
368 const expectedStatus = this.buildExpectedStatus({ ...options, defaultExpectedStatus: HttpStatusCode.OK_200 })
368 if (expectedStatus === HttpStatusCode.OK_200) { 369 if (expectedStatus === HttpStatusCode.OK_200) {
369 let video: VideoDetails 370 let video: VideoDetails
370 371
371 do { 372 do {
372 video = await this.getWithToken({ ...options, id: video.uuid }) 373 video = await this.getWithToken({ ...options, id: created.uuid })
373 374
374 await wait(50) 375 await wait(50)
375 } while (!video.files[0].torrentUrl) 376 } while (!video.files[0].torrentUrl)
376 } 377 }
377 378
378 return res 379 return created
379 } 380 }
380 381
381 async buildLegacyUpload (options: OverrideCommandOptions & { 382 async buildLegacyUpload (options: OverrideCommandOptions & {
@@ -535,13 +536,13 @@ export class VideosCommand extends AbstractCommand {
535 536
536 async randomUpload (options: OverrideCommandOptions & { 537 async randomUpload (options: OverrideCommandOptions & {
537 wait?: boolean // default true 538 wait?: boolean // default true
538 additionalParams?: VideoEdit & { prefixName: string } 539 additionalParams?: VideoEdit & { prefixName?: string }
539 } = {}) { 540 } = {}) {
540 const { wait = true, additionalParams } = options 541 const { wait = true, additionalParams } = options
541 const prefixName = additionalParams?.prefixName || '' 542 const prefixName = additionalParams?.prefixName || ''
542 const name = prefixName + buildUUID() 543 const name = prefixName + buildUUID()
543 544
544 const attributes = { name, additionalParams } 545 const attributes = { name, ...additionalParams }
545 546
546 const result = await this.upload({ ...options, attributes }) 547 const result = await this.upload({ ...options, attributes })
547 548
diff --git a/shared/extra-utils/videos/videos.ts b/shared/extra-utils/videos/videos.ts
index a96073c56..9a9bfb3cf 100644
--- a/shared/extra-utils/videos/videos.ts
+++ b/shared/extra-utils/videos/videos.ts
@@ -202,7 +202,7 @@ async function uploadRandomVideoOnServers (
202 additionalParams?: VideoEdit & { prefixName?: string } 202 additionalParams?: VideoEdit & { prefixName?: string }
203) { 203) {
204 const server = servers.find(s => s.serverNumber === serverNumber) 204 const server = servers.find(s => s.serverNumber === serverNumber)
205 const res = await server.videos.randomUpload({ wait: false, ...additionalParams }) 205 const res = await server.videos.randomUpload({ wait: false, additionalParams })
206 206
207 await waitJobs(servers) 207 await waitJobs(servers)
208 208