1
0
Fork 0

Reorganize imports

This commit is contained in:
Chocobozzz 2021-07-16 14:27:30 +02:00
parent c0e8b12e7f
commit 4c7e60bc17
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
165 changed files with 268 additions and 328 deletions

View File

@ -1,10 +1,10 @@
import * as express from 'express'
import { asyncMiddleware, authenticate } from '../../middlewares'
import { removeComment } from '@server/lib/video-comment'
import { bulkRemoveCommentsOfValidator } from '@server/middlewares/validators/bulk'
import { VideoCommentModel } from '@server/models/video/video-comment'
import { removeComment } from '@server/lib/video-comment'
import { BulkRemoveCommentsOfBody } from '@shared/models/bulk/bulk-remove-comments-of-body.model'
import { HttpStatusCode } from '@shared/models'
import { BulkRemoveCommentsOfBody } from '@shared/models/bulk/bulk-remove-comments-of-body.model'
import { asyncMiddleware, authenticate } from '../../middlewares'
const bulkRouter = express.Router()

View File

@ -1,8 +1,8 @@
import { ServerConfigManager } from '@server/lib/server-config-manager'
import * as express from 'express'
import { remove, writeJSON } from 'fs-extra'
import { snakeCase } from 'lodash'
import validator from 'validator'
import { ServerConfigManager } from '@server/lib/server-config-manager'
import { UserRight } from '../../../shared'
import { About } from '../../../shared/models/server/about.model'
import { CustomConfig } from '../../../shared/models/server/custom-config.model'

View File

@ -1,8 +1,7 @@
import * as express from 'express'
import { ServerConfigManager } from '@server/lib/server-config-manager'
import { ActorCustomPageModel } from '@server/models/account/actor-custom-page'
import { HttpStatusCode } from '@shared/models'
import { UserRight } from '@shared/models'
import { HttpStatusCode, UserRight } from '@shared/models'
import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../middlewares'
const customPageRouter = express.Router()

View File

@ -1,12 +1,12 @@
import * as express from 'express'
import { buildNSFWFilter } from '../../helpers/express-utils'
import { VideoModel } from '../../models/video/video'
import { asyncMiddleware, optionalAuthenticate, videosOverviewValidator } from '../../middlewares'
import { TagModel } from '../../models/video/tag'
import { CategoryOverview, ChannelOverview, TagOverview, VideosOverview } from '../../../shared/models/overviews'
import { MEMOIZE_TTL, OVERVIEWS } from '../../initializers/constants'
import * as memoizee from 'memoizee'
import { logger } from '@server/helpers/logger'
import { CategoryOverview, ChannelOverview, TagOverview, VideosOverview } from '../../../shared/models/overviews'
import { buildNSFWFilter } from '../../helpers/express-utils'
import { MEMOIZE_TTL, OVERVIEWS } from '../../initializers/constants'
import { asyncMiddleware, optionalAuthenticate, videosOverviewValidator } from '../../middlewares'
import { TagModel } from '../../models/video/tag'
import { VideoModel } from '../../models/video/video'
const overviewsRouter = express.Router()

View File

@ -23,8 +23,8 @@ import {
updatePluginSettingsValidator
} from '@server/middlewares/validators/plugins'
import { PluginModel } from '@server/models/server/plugin'
import { HttpStatusCode } from '@shared/models'
import {
HttpStatusCode,
InstallOrUpdatePlugin,
ManagePlugin,
PeertubePluginIndexList,

View File

@ -6,8 +6,7 @@ import { WEBSERVER } from '@server/initializers/constants'
import { Hooks } from '@server/lib/plugins/hooks'
import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search'
import { getServerActor } from '@server/models/application/application'
import { HttpStatusCode } from '@shared/models'
import { ResultList, VideoChannel } from '@shared/models'
import { HttpStatusCode, ResultList, VideoChannel } from '@shared/models'
import { VideoChannelsSearchQuery } from '../../../../shared/models/search'
import { isUserAbleToSearchRemoteURI } from '../../../helpers/express-utils'
import { logger } from '../../../helpers/logger'

View File

@ -5,14 +5,14 @@ import { logger } from '@server/helpers/logger'
import { doJSONRequest } from '@server/helpers/requests'
import { getFormattedObjects } from '@server/helpers/utils'
import { CONFIG } from '@server/initializers/config'
import { WEBSERVER } from '@server/initializers/constants'
import { getOrCreateAPVideoPlaylist } from '@server/lib/activitypub/playlists/get'
import { Hooks } from '@server/lib/plugins/hooks'
import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search'
import { getServerActor } from '@server/models/application/application'
import { VideoPlaylistModel } from '@server/models/video/video-playlist'
import { MVideoPlaylistFullSummary } from '@server/types/models'
import { HttpStatusCode } from '@shared/models'
import { ResultList, VideoPlaylist, VideoPlaylistsSearchQuery } from '@shared/models'
import { HttpStatusCode, ResultList, VideoPlaylist, VideoPlaylistsSearchQuery } from '@shared/models'
import {
asyncMiddleware,
openapiOperationDoc,
@ -23,7 +23,6 @@ import {
videoPlaylistsListSearchValidator,
videoPlaylistsSearchSortValidator
} from '../../../middlewares'
import { WEBSERVER } from '@server/initializers/constants'
const searchPlaylistsRouter = express.Router()

View File

@ -6,8 +6,7 @@ import { WEBSERVER } from '@server/initializers/constants'
import { getOrCreateAPVideo } from '@server/lib/activitypub/videos'
import { Hooks } from '@server/lib/plugins/hooks'
import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search'
import { HttpStatusCode } from '@shared/models'
import { ResultList, Video } from '@shared/models'
import { HttpStatusCode, ResultList, Video } from '@shared/models'
import { VideosSearchQuery } from '../../../../shared/models/search'
import { buildNSFWFilter, isUserAbleToSearchRemoteURI } from '../../../helpers/express-utils'
import { logger } from '../../../helpers/logger'

View File

@ -1,9 +1,9 @@
import * as express from 'express'
import { asyncMiddleware, contactAdministratorValidator } from '../../../middlewares'
import { Redis } from '../../../lib/redis'
import { Emailer } from '../../../lib/emailer'
import { ContactForm } from '../../../../shared/models/server'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
import { ContactForm } from '../../../../shared/models/server'
import { Emailer } from '../../../lib/emailer'
import { Redis } from '../../../lib/redis'
import { asyncMiddleware, contactAdministratorValidator } from '../../../middlewares'
const contactRouter = express.Router()

View File

@ -1,11 +1,11 @@
import * as express from 'express'
import { contactRouter } from './contact'
import { debugRouter } from './debug'
import { serverFollowsRouter } from './follows'
import { statsRouter } from './stats'
import { logsRouter } from './logs'
import { serverRedundancyRouter } from './redundancy'
import { serverBlocklistRouter } from './server-blocklist'
import { contactRouter } from './contact'
import { logsRouter } from './logs'
import { debugRouter } from './debug'
import { statsRouter } from './stats'
const serverRouter = express.Router()

View File

@ -1,14 +1,14 @@
import * as express from 'express'
import { UserRight } from '../../../../shared/models/users'
import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../../middlewares'
import { mtimeSortFilesDesc } from '../../../../shared/core-utils/logs/logs'
import { readdir, readFile } from 'fs-extra'
import { AUDIT_LOG_FILENAME, MAX_LOGS_OUTPUT_CHARACTERS, LOG_FILENAME } from '../../../initializers/constants'
import { join } from 'path'
import { getAuditLogsValidator, getLogsValidator } from '../../../middlewares/validators/logs'
import { LogLevel } from '../../../../shared/models/server/log-level.type'
import { CONFIG } from '../../../initializers/config'
import { logger } from '@server/helpers/logger'
import { mtimeSortFilesDesc } from '../../../../shared/core-utils/logs/logs'
import { LogLevel } from '../../../../shared/models/server/log-level.type'
import { UserRight } from '../../../../shared/models/users'
import { CONFIG } from '../../../initializers/config'
import { AUDIT_LOG_FILENAME, LOG_FILENAME, MAX_LOGS_OUTPUT_CHARACTERS } from '../../../initializers/constants'
import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../../middlewares'
import { getAuditLogsValidator, getLogsValidator } from '../../../middlewares/validators/logs'
const logsRouter = express.Router()

View File

@ -2,6 +2,7 @@ import 'multer'
import * as express from 'express'
import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '@server/helpers/audit-logger'
import { Hooks } from '@server/lib/plugins/hooks'
import { AttributesOnly } from '@shared/core-utils'
import { ActorImageType, UserUpdateMe, UserVideoRate as FormattedUserVideoRate } from '../../../../shared'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
import { UserVideoQuota } from '../../../../shared/models/users/user-video-quota.model'
@ -31,7 +32,6 @@ import { AccountVideoRateModel } from '../../../models/account/account-video-rat
import { UserModel } from '../../../models/user/user'
import { VideoModel } from '../../../models/video/video'
import { VideoImportModel } from '../../../models/video/video-import'
import { AttributesOnly } from '@shared/core-utils'
const auditLogger = auditLoggerFactory('users')

View File

@ -1,6 +1,10 @@
import * as express from 'express'
import 'multer'
import * as express from 'express'
import { logger } from '@server/helpers/logger'
import { UserNotificationModel } from '@server/models/user/user-notification'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
import { getFormattedObjects } from '../../../helpers/utils'
import { addAccountInBlocklist, addServerInBlocklist, removeAccountFromBlocklist, removeServerFromBlocklist } from '../../../lib/blocklist'
import {
asyncMiddleware,
asyncRetryTransactionMiddleware,
@ -18,11 +22,7 @@ import {
unblockServerByAccountValidator
} from '../../../middlewares/validators'
import { AccountBlocklistModel } from '../../../models/account/account-blocklist'
import { addAccountInBlocklist, addServerInBlocklist, removeAccountFromBlocklist, removeServerFromBlocklist } from '../../../lib/blocklist'
import { ServerBlocklistModel } from '../../../models/server/server-blocklist'
import { UserNotificationModel } from '@server/models/user/user-notification'
import { logger } from '@server/helpers/logger'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
const myBlocklistRouter = express.Router()

View File

@ -1,4 +1,7 @@
import * as express from 'express'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
import { getFormattedObjects } from '../../../helpers/utils'
import { sequelizeTypescript } from '../../../initializers/database'
import {
asyncMiddleware,
asyncRetryTransactionMiddleware,
@ -8,10 +11,7 @@ import {
userHistoryListValidator,
userHistoryRemoveValidator
} from '../../../middlewares'
import { getFormattedObjects } from '../../../helpers/utils'
import { UserVideoHistoryModel } from '../../../models/user/user-video-history'
import { sequelizeTypescript } from '../../../initializers/database'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
const myVideosHistoryRouter = express.Router()

View File

@ -1,8 +1,8 @@
import * as express from 'express'
import { VideosExistInPlaylists } from '../../../../shared/models/videos/playlist/video-exist-in-playlist.model'
import { asyncMiddleware, authenticate } from '../../../middlewares'
import { doVideosInPlaylistExistValidator } from '../../../middlewares/validators/videos/video-playlists'
import { VideoPlaylistModel } from '../../../models/video/video-playlist'
import { VideosExistInPlaylists } from '../../../../shared/models/videos/playlist/video-exist-in-playlist.model'
const myVideoPlaylistsRouter = express.Router()

View File

@ -1,6 +1,7 @@
import * as express from 'express'
import { blacklistVideo, unblacklistVideo } from '@server/lib/video-blacklist'
import { UserRight, VideoBlacklistCreate } from '../../../../shared'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
import { logger } from '../../../helpers/logger'
import { getFormattedObjects } from '../../../helpers/utils'
import { sequelizeTypescript } from '../../../initializers/database'
@ -19,7 +20,6 @@ import {
videosBlacklistUpdateValidator
} from '../../../middlewares'
import { VideoBlacklistModel } from '../../../models/video/video-blacklist'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
const blacklistRouter = express.Router()

View File

@ -1,6 +1,6 @@
import * as express from 'express'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
import { ResultList, ThreadsResultList, UserRight, VideoCommentCreate } from '../../../../shared/models'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
import { VideoCommentThreads } from '../../../../shared/models/videos/comment/video-comment.model'
import { auditLoggerFactory, CommentAuditView, getAuditIdFromRes } from '../../../helpers/audit-logger'
import { getFormattedObjects } from '../../../helpers/utils'

View File

@ -1,6 +1,12 @@
import * as express from 'express'
import { MVideoFullLight } from '@server/types/models'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
import { VideoChangeOwnershipStatus, VideoState } from '../../../../shared/models/videos'
import { logger } from '../../../helpers/logger'
import { getFormattedObjects } from '../../../helpers/utils'
import { sequelizeTypescript } from '../../../initializers/database'
import { sendUpdateVideo } from '../../../lib/activitypub/send'
import { changeVideoChannelShare } from '../../../lib/activitypub/share'
import {
asyncMiddleware,
asyncRetryTransactionMiddleware,
@ -11,15 +17,9 @@ import {
videosChangeOwnershipValidator,
videosTerminateChangeOwnershipValidator
} from '../../../middlewares'
import { VideoChangeOwnershipModel } from '../../../models/video/video-change-ownership'
import { VideoChangeOwnershipStatus, VideoState } from '../../../../shared/models/videos'
import { VideoChannelModel } from '../../../models/video/video-channel'
import { getFormattedObjects } from '../../../helpers/utils'
import { changeVideoChannelShare } from '../../../lib/activitypub/share'
import { sendUpdateVideo } from '../../../lib/activitypub/send'
import { VideoModel } from '../../../models/video/video'
import { MVideoFullLight } from '@server/types/models'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
import { VideoChangeOwnershipModel } from '../../../models/video/video-change-ownership'
import { VideoChannelModel } from '../../../models/video/video-channel'
const ownershipVideoRouter = express.Router()

View File

@ -1,13 +1,13 @@
import * as express from 'express'
import { UserVideoRateUpdate } from '../../../../shared'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
import { logger } from '../../../helpers/logger'
import { VIDEO_RATE_TYPES } from '../../../initializers/constants'
import { sequelizeTypescript } from '../../../initializers/database'
import { getLocalRateUrl, sendVideoRateChange } from '../../../lib/activitypub/video-rates'
import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videoUpdateRateValidator } from '../../../middlewares'
import { AccountModel } from '../../../models/account/account'
import { AccountVideoRateModel } from '../../../models/account/account-video-rate'
import { sequelizeTypescript } from '../../../initializers/database'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
const rateVideoRouter = express.Router()

View File

@ -1,5 +1,6 @@
import * as express from 'express'
import { UserWatchingVideo } from '../../../../shared'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
import {
asyncMiddleware,
asyncRetryTransactionMiddleware,
@ -8,7 +9,6 @@ import {
videoWatchingValidator
} from '../../../middlewares'
import { UserVideoHistoryModel } from '../../../models/user/user-video-history'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
const watchingRouter = express.Router()

View File

@ -5,8 +5,7 @@ import { VideosTorrentCache } from '@server/lib/files-cache/videos-torrent-cache
import { Hooks } from '@server/lib/plugins/hooks'
import { getVideoFilePath } from '@server/lib/video-paths'
import { MStreamingPlaylist, MVideo, MVideoFile, MVideoFullLight } from '@server/types/models'
import { HttpStatusCode } from '@shared/models'
import { VideoStreamingPlaylistType } from '@shared/models'
import { HttpStatusCode, VideoStreamingPlaylistType } from '@shared/models'
import { STATIC_DOWNLOAD_PATHS } from '../initializers/constants'
import { asyncMiddleware, videosDownloadValidator } from '../middlewares'

View File

@ -1,6 +1,6 @@
import { Redis } from '../lib/redis'
import * as apicache from 'apicache'
import { HttpStatusCode } from '../../shared/models/http/http-error-codes'
import { Redis } from '../lib/redis'
// Ensure Redis is initialized
Redis.Instance.init()

View File

@ -1,6 +1,6 @@
import * as express from 'express'
import { getHostWithPort } from '../helpers/express-utils'
import { HttpStatusCode } from '../../shared/models/http/http-error-codes'
import { getHostWithPort } from '../helpers/express-utils'
function setBodyHostsPort (req: express.Request, res: express.Response, next: express.NextFunction) {
if (!req.body.hosts) return next()

View File

@ -1,7 +1,7 @@
import * as express from 'express'
import { UserRight } from '../../shared'
import { logger } from '../helpers/logger'
import { HttpStatusCode } from '../../shared/models/http/http-error-codes'
import { logger } from '../helpers/logger'
function ensureUserHasRight (userRight: UserRight) {
return function (req: express.Request, res: express.Response, next: express.NextFunction) {

View File

@ -1,8 +1,8 @@
import * as express from 'express'
import { isRootActivityValid } from '../../../helpers/custom-validators/activitypub/activity'
import { logger } from '../../../helpers/logger'
import { getServerActor } from '@server/models/application/application'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
import { isRootActivityValid } from '../../../helpers/custom-validators/activitypub/activity'
import { logger } from '../../../helpers/logger'
async function activityPubValidator (req: express.Request, res: express.Response, next: express.NextFunction) {
logger.debug('Checking activity pub parameters')

View File

@ -1,8 +1,7 @@
import * as express from 'express'
import { body } from 'express-validator'
import { isBulkRemoveCommentsOfScopeValid } from '@server/helpers/custom-validators/bulk'
import { HttpStatusCode } from '@shared/models'
import { UserRight } from '@shared/models'
import { HttpStatusCode, UserRight } from '@shared/models'
import { BulkRemoveCommentsOfBody } from '@shared/models/bulk/bulk-remove-comments-of-body.model'
import { logger } from '../../helpers/logger'
import { areValidationErrors, doesAccountNameWithHostExist } from './shared'

View File

@ -1,6 +1,5 @@
import * as express from 'express'
import { param, query } from 'express-validator'
import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'
import { isValidRSSFeed } from '../../helpers/custom-validators/feeds'
import { exists, isIdOrUUIDValid, isIdValid, toCompleteUUID } from '../../helpers/custom-validators/misc'

View File

@ -12,8 +12,7 @@ import {
MVideoImmutable,
MVideoThumbnail
} from '@server/types/models'
import { HttpStatusCode } from '@shared/models'
import { UserRight } from '@shared/models'
import { HttpStatusCode, UserRight } from '@shared/models'
async function doesVideoExist (id: number | string, res: Response, fetchType: VideoLoadType = 'all') {
const userId = res.locals.oauth ? res.locals.oauth.token.User.id : undefined

View File

@ -5,8 +5,7 @@ import { isLocalLiveVideoAccepted } from '@server/lib/moderation'
import { Hooks } from '@server/lib/plugins/hooks'
import { VideoModel } from '@server/models/video/video'
import { VideoLiveModel } from '@server/models/video/video-live'
import { HttpStatusCode } from '@shared/models'
import { ServerErrorCode, UserRight, VideoState } from '@shared/models'
import { HttpStatusCode, ServerErrorCode, UserRight, VideoState } from '@shared/models'
import { isBooleanValid, isIdValid, toBooleanOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc'
import { isVideoNameValid } from '../../../helpers/custom-validators/videos'
import { cleanUpReqFiles } from '../../../helpers/express-utils'

View File

@ -6,8 +6,14 @@ import { logger } from '@server/helpers/logger'
import { isAbleToUploadVideo } from '@server/lib/user'
import { AccountModel } from '@server/models/account/account'
import { MVideoWithAllFiles } from '@server/types/models'
import { HttpStatusCode } from '@shared/models'
import { ServerErrorCode, UserRight, VideoChangeOwnershipAccept, VideoChangeOwnershipStatus, VideoState } from '@shared/models'
import {
HttpStatusCode,
ServerErrorCode,
UserRight,
VideoChangeOwnershipAccept,
VideoChangeOwnershipStatus,
VideoState
} from '@shared/models'
import {
areValidationErrors,
checkUserCanManageVideo,

View File

@ -4,8 +4,8 @@ import 'mocha'
import * as chai from 'chai'
import {
cleanupTests,
doubleFollow,
createMultipleServers,
doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
wait,

View File

@ -2,17 +2,16 @@
import 'mocha'
import * as chai from 'chai'
import { HttpStatusCode } from '@shared/models'
import {
cleanupTests,
doubleFollow,
createMultipleServers,
doubleFollow,
makeActivityPubGetRequest,
PeerTubeServer,
setAccessTokensToServers,
setDefaultVideoChannel
} from '@shared/extra-utils'
import { VideoPlaylistPrivacy } from '@shared/models'
import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models'
const expect = chai.expect

View File

@ -2,7 +2,7 @@
import 'mocha'
import * as chai from 'chai'
import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
const expect = chai.expect

View File

@ -1,11 +1,10 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha'
import { HttpStatusCode } from '@shared/models'
import {
cleanupTests,
doubleFollow,
createMultipleServers,
doubleFollow,
killallServers,
PeerTubeServer,
setAccessTokensToServers,
@ -13,7 +12,7 @@ import {
wait,
waitJobs
} from '@shared/extra-utils'
import { VideoPlaylistPrivacy } from '@shared/models'
import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models'
describe('Test AP refresher', function () {
let servers: PeerTubeServer[] = []

View File

@ -1,22 +1,21 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha'
import { HttpStatusCode } from '@shared/models'
import {
AbusesCommand,
checkBadCountPagination,
checkBadSortPagination,
checkBadStartPagination,
cleanupTests,
doubleFollow,
createSingleServer,
doubleFollow,
makeGetRequest,
makePostBodyRequest,
PeerTubeServer,
setAccessTokensToServers,
waitJobs
} from '@shared/extra-utils'
import { AbuseCreate, AbuseState } from '@shared/models'
import { AbuseCreate, AbuseState, HttpStatusCode } from '@shared/models'
describe('Test abuses API validators', function () {
const basePath = '/api/v1/abuses/'

View File

@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha'
import { HttpStatusCode } from '@shared/models'
import {
checkBadCountPagination,
checkBadSortPagination,
@ -10,6 +9,7 @@ import {
createSingleServer,
PeerTubeServer
} from '@shared/extra-utils'
import { HttpStatusCode } from '@shared/models'
describe('Test accounts API validators', function () {
const path = '/api/v1/accounts/'

View File

@ -2,7 +2,6 @@
import 'mocha'
import { omit } from 'lodash'
import { HttpStatusCode } from '@shared/models'
import {
cleanupTests,
createSingleServer,
@ -12,7 +11,7 @@ import {
PeerTubeServer,
setAccessTokensToServers
} from '@shared/extra-utils'
import { CustomConfig } from '@shared/models'
import { CustomConfig, HttpStatusCode } from '@shared/models'
describe('Test config API validators', function () {
const path = '/api/v1/config/custom'

View File

@ -1,9 +1,9 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha'
import { HttpStatusCode } from '@shared/models'
import { cleanupTests, createSingleServer, killallServers, MockSmtpServer, PeerTubeServer } from '@shared/extra-utils'
import { ContactFormCommand } from '@shared/extra-utils/server'
import { HttpStatusCode } from '@shared/models'
describe('Test contact form API validators', function () {
let server: PeerTubeServer

View File

@ -2,7 +2,6 @@
import 'mocha'
import { omit } from 'lodash'
import { HttpStatusCode } from '@shared/models'
import {
buildAbsoluteFixturePath,
cleanupTests,
@ -10,12 +9,12 @@ import {
LiveCommand,
makePostBodyRequest,
makeUploadRequest,
sendRTMPStream,
PeerTubeServer,
sendRTMPStream,
setAccessTokensToServers,
stopFfmpeg
} from '@shared/extra-utils'
import { VideoCreateResult, VideoPrivacy } from '@shared/models'
import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models'
describe('Test video lives API validator', function () {
const path = '/api/v1/videos/live'

View File

@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha'
import { HttpStatusCode } from '@shared/models'
import {
checkBadCountPagination,
checkBadSortPagination,
@ -14,7 +13,7 @@ import {
PeerTubeServer,
setAccessTokensToServers
} from '@shared/extra-utils'
import { PeerTubePlugin, PluginType } from '@shared/models'
import { HttpStatusCode, PeerTubePlugin, PluginType } from '@shared/models'
describe('Test server plugins API validators', function () {
let server: PeerTubeServer

View File

@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha'
import { HttpStatusCode } from '@shared/models'
import {
checkBadCountPagination,
checkBadSortPagination,
@ -12,6 +11,7 @@ import {
PeerTubeServer,
setAccessTokensToServers
} from '@shared/extra-utils'
import { HttpStatusCode } from '@shared/models'
function updateSearchIndex (server: PeerTubeServer, enabled: boolean, disableLocalSearch = false) {
return server.config.updateCustomSubConfig({

View File

@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha'
import { HttpStatusCode } from '@shared/models'
import {
cleanupTests,
createSingleServer,
@ -10,7 +9,7 @@ import {
setAccessTokensToServers,
setDefaultVideoChannel
} from '@shared/extra-utils'
import { VideoPlaylistPrivacy } from '@shared/models'
import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models'
describe('Test services API validators', function () {
let server: PeerTubeServer

View File

@ -2,7 +2,6 @@
import 'mocha'
import { io } from 'socket.io-client'
import { HttpStatusCode } from '@shared/models'
import {
checkBadCountPagination,
checkBadSortPagination,
@ -16,7 +15,7 @@ import {
setAccessTokensToServers,
wait
} from '@shared/extra-utils'
import { UserNotificationSetting, UserNotificationSettingValue } from '@shared/models'
import { HttpStatusCode, UserNotificationSetting, UserNotificationSettingValue } from '@shared/models'
describe('Test user notifications API validators', function () {
let server: PeerTubeServer

View File

@ -2,7 +2,6 @@
import 'mocha'
import { omit } from 'lodash'
import { HttpStatusCode } from '@shared/models'
import {
buildAbsoluteFixturePath,
checkBadCountPagination,
@ -20,7 +19,7 @@ import {
setAccessTokensToServers,
UsersCommand
} from '@shared/extra-utils'
import { UserAdminFlag, UserRole, VideoCreateResult } from '@shared/models'
import { HttpStatusCode, UserAdminFlag, UserRole, VideoCreateResult } from '@shared/models'
describe('Test users API validators', function () {
const path = '/api/v1/users/'

View File

@ -2,22 +2,21 @@
import 'mocha'
import { expect } from 'chai'
import { HttpStatusCode } from '@shared/models'
import {
BlacklistCommand,
checkBadCountPagination,
checkBadSortPagination,
checkBadStartPagination,
cleanupTests,
doubleFollow,
createMultipleServers,
doubleFollow,
makePostBodyRequest,
makePutBodyRequest,
PeerTubeServer,
setAccessTokensToServers,
waitJobs
} from '@shared/extra-utils'
import { VideoBlacklistType } from '@shared/models'
import { HttpStatusCode, VideoBlacklistType } from '@shared/models'
describe('Test video blacklist API validators', function () {
let servers: PeerTubeServer[]

View File

@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha'
import { HttpStatusCode } from '@shared/models'
import {
buildAbsoluteFixturePath,
cleanupTests,
@ -12,7 +11,7 @@ import {
PeerTubeServer,
setAccessTokensToServers
} from '@shared/extra-utils'
import { VideoCreateResult } from '@shared/models'
import { HttpStatusCode, VideoCreateResult } from '@shared/models'
describe('Test video captions API validator', function () {
const path = '/api/v1/videos/'

View File

@ -3,7 +3,6 @@
import 'mocha'
import * as chai from 'chai'
import { omit } from 'lodash'
import { HttpStatusCode } from '@shared/models'
import {
buildAbsoluteFixturePath,
ChannelsCommand,
@ -19,7 +18,7 @@ import {
PeerTubeServer,
setAccessTokensToServers
} from '@shared/extra-utils'
import { VideoChannelUpdate } from '@shared/models'
import { HttpStatusCode, VideoChannelUpdate } from '@shared/models'
const expect = chai.expect

View File

@ -2,7 +2,6 @@
import 'mocha'
import * as chai from 'chai'
import { HttpStatusCode } from '@shared/models'
import {
checkBadCountPagination,
checkBadSortPagination,
@ -15,7 +14,7 @@ import {
PeerTubeServer,
setAccessTokensToServers
} from '@shared/extra-utils'
import { VideoCreateResult } from '@shared/models'
import { HttpStatusCode, VideoCreateResult } from '@shared/models'
const expect = chai.expect

View File

@ -2,7 +2,6 @@
import 'mocha'
import { omit } from 'lodash'
import { HttpStatusCode } from '@shared/models'
import {
buildAbsoluteFixturePath,
checkBadCountPagination,
@ -17,7 +16,7 @@ import {
PeerTubeServer,
setAccessTokensToServers
} from '@shared/extra-utils'
import { VideoPrivacy } from '@shared/models'
import { HttpStatusCode, VideoPrivacy } from '@shared/models'
describe('Test video imports API validator', function () {
const path = '/api/v1/videos/imports'

View File

@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha'
import { HttpStatusCode } from '@shared/models'
import {
checkBadCountPagination,
checkBadSortPagination,
@ -9,12 +8,13 @@ import {
cleanupTests,
createSingleServer,
makeGetRequest,
PlaylistsCommand,
PeerTubeServer,
PlaylistsCommand,
setAccessTokensToServers,
setDefaultVideoChannel
} from '@shared/extra-utils'
import {
HttpStatusCode,
VideoPlaylistCreate,
VideoPlaylistCreateResult,
VideoPlaylistElementCreate,

View File

@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha'
import { HttpStatusCode } from '@shared/models'
import {
cleanupTests,
createSingleServer,
@ -10,7 +9,7 @@ import {
setAccessTokensToServers,
setDefaultVideoChannel
} from '@shared/extra-utils'
import { UserRole } from '@shared/models'
import { HttpStatusCode, UserRole } from '@shared/models'
async function testEndpoints (server: PeerTubeServer, token: string, filter: string, expectedStatus: HttpStatusCode) {
const paths = [

View File

@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha'
import { HttpStatusCode } from '@shared/models'
import {
checkBadCountPagination,
checkBadStartPagination,
@ -13,6 +12,7 @@ import {
PeerTubeServer,
setAccessTokensToServers
} from '@shared/extra-utils'
import { HttpStatusCode } from '@shared/models'
describe('Test videos history API validator', function () {
const myHistoryPath = '/api/v1/users/me/history/videos'

View File

@ -7,8 +7,8 @@ import {
checkLiveCleanup,
cleanupTests,
ConfigCommand,
doubleFollow,
createMultipleServers,
doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
setDefaultVideoChannel,

View File

@ -6,8 +6,8 @@ import { LiveVideoCreate, VideoPrivacy, VideoState } from '@shared/models'
import {
cleanupTests,
ConfigCommand,
doubleFollow,
createMultipleServers,
doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
setDefaultVideoChannel,

View File

@ -3,13 +3,12 @@
import 'mocha'
import * as chai from 'chai'
import { FfmpegCommand } from 'fluent-ffmpeg'
import { HttpStatusCode } from '@shared/models'
import {
checkLiveCleanup,
cleanupTests,
ConfigCommand,
doubleFollow,
createMultipleServers,
doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
setDefaultVideoChannel,
@ -18,7 +17,7 @@ import {
wait,
waitJobs
} from '@shared/extra-utils'
import { LiveVideoCreate, VideoPrivacy, VideoState } from '@shared/models'
import { HttpStatusCode, LiveVideoCreate, VideoPrivacy, VideoState } from '@shared/models'
const expect = chai.expect

View File

@ -5,8 +5,8 @@ import * as chai from 'chai'
import { VideoPrivacy, VideoState } from '@shared/models'
import {
cleanupTests,
doubleFollow,
createMultipleServers,
doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
setDefaultVideoChannel,

View File

@ -6,8 +6,8 @@ import { FfmpegCommand } from 'fluent-ffmpeg'
import { VideoPrivacy } from '@shared/models'
import {
cleanupTests,
doubleFollow,
createMultipleServers,
doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
setDefaultVideoChannel,

View File

@ -4,19 +4,18 @@ import 'mocha'
import * as chai from 'chai'
import { join } from 'path'
import { ffprobePromise, getVideoStreamFromFile } from '@server/helpers/ffprobe-utils'
import { HttpStatusCode } from '@shared/models'
import {
checkLiveCleanup,
checkLiveSegmentHash,
checkResolutionsInMasterPlaylist,
cleanupTests,
doubleFollow,
createMultipleServers,
doubleFollow,
killallServers,
LiveCommand,
makeRawRequest,
sendRTMPStream,
PeerTubeServer,
sendRTMPStream,
setAccessTokensToServers,
setDefaultVideoChannel,
stopFfmpeg,
@ -26,7 +25,15 @@ import {
waitJobs,
waitUntilLivePublishedOnAllServers
} from '@shared/extra-utils'
import { LiveVideo, LiveVideoCreate, VideoDetails, VideoPrivacy, VideoState, VideoStreamingPlaylistType } from '@shared/models'
import {
HttpStatusCode,
LiveVideo,
LiveVideoCreate,
VideoDetails,
VideoPrivacy,
VideoState,
VideoStreamingPlaylistType
} from '@shared/models'
const expect = chai.expect

View File

@ -2,7 +2,7 @@
import 'mocha'
import * as chai from 'chai'
import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
import { UserNotificationType } from '@shared/models'
const expect = chai.expect

View File

@ -6,8 +6,8 @@ import {
BlocklistCommand,
cleanupTests,
CommentsCommand,
doubleFollow,
createMultipleServers,
doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
waitJobs

View File

@ -9,8 +9,8 @@ import {
cleanupTests,
MockJoinPeerTubeVersions,
MockSmtpServer,
prepareNotificationsTest,
PeerTubeServer,
prepareNotificationsTest,
wait
} from '@shared/extra-utils'
import { PluginType, UserNotification, UserNotificationType } from '@shared/models'

View File

@ -8,8 +8,8 @@ import {
checkNewCommentOnMyVideo,
cleanupTests,
MockSmtpServer,
prepareNotificationsTest,
PeerTubeServer,
prepareNotificationsTest,
waitJobs
} from '@shared/extra-utils'
import { UserNotification } from '@shared/models'

View File

@ -19,8 +19,8 @@ import {
cleanupTests,
MockInstancesIndex,
MockSmtpServer,
prepareNotificationsTest,
PeerTubeServer,
prepareNotificationsTest,
wait,
waitJobs
} from '@shared/extra-utils'

View File

@ -8,8 +8,8 @@ import {
cleanupTests,
getAllNotificationsSettings,
MockSmtpServer,
prepareNotificationsTest,
PeerTubeServer,
prepareNotificationsTest,
waitJobs
} from '@shared/extra-utils'
import { UserNotification, UserNotificationSettingValue } from '@shared/models'

View File

@ -4,10 +4,10 @@ import 'mocha'
import * as chai from 'chai'
import {
cleanupTests,
doubleFollow,
createMultipleServers,
RedundancyCommand,
doubleFollow,
PeerTubeServer,
RedundancyCommand,
setAccessTokensToServers,
waitJobs
} from '@shared/extra-utils'

View File

@ -2,14 +2,7 @@
import 'mocha'
import { expect } from 'chai'
import {
cleanupTests,
createSingleServer,
killallServers,
PeerTubeServer,
setAccessTokensToServers,
waitJobs
} from '@shared/extra-utils'
import { cleanupTests, createSingleServer, killallServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
import { VideoPrivacy } from '@shared/models'
describe('Test redundancy constraints', function () {

View File

@ -5,22 +5,21 @@ import * as chai from 'chai'
import { readdir } from 'fs-extra'
import * as magnetUtil from 'magnet-uri'
import { join } from 'path'
import { HttpStatusCode } from '@shared/models'
import {
checkSegmentHash,
checkVideoFilesWereRemoved,
cleanupTests,
doubleFollow,
createMultipleServers,
doubleFollow,
killallServers,
makeGetRequest,
root,
PeerTubeServer,
root,
setAccessTokensToServers,
wait,
waitJobs
} from '@shared/extra-utils'
import { VideoPrivacy, VideoRedundancyStrategy, VideoRedundancyStrategyWithManual } from '@shared/models'
import { HttpStatusCode, VideoPrivacy, VideoRedundancyStrategy, VideoRedundancyStrategyWithManual } from '@shared/models'
const expect = chai.expect

View File

@ -5,8 +5,8 @@ import * as chai from 'chai'
import {
cleanupTests,
createMultipleServers,
SearchCommand,
PeerTubeServer,
SearchCommand,
setAccessTokensToServers,
wait,
waitJobs

View File

@ -5,8 +5,8 @@ import * as chai from 'chai'
import {
cleanupTests,
createMultipleServers,
SearchCommand,
PeerTubeServer,
SearchCommand,
setAccessTokensToServers,
setDefaultVideoChannel,
wait,

View File

@ -5,8 +5,8 @@ import * as chai from 'chai'
import {
cleanupTests,
createMultipleServers,
SearchCommand,
PeerTubeServer,
SearchCommand,
setAccessTokensToServers,
wait,
waitJobs

View File

@ -2,7 +2,7 @@
import 'mocha'
import * as chai from 'chai'
import { cleanupTests, createSingleServer, SearchCommand, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils'
import { cleanupTests, createSingleServer, PeerTubeServer, SearchCommand, setAccessTokensToServers } from '@shared/extra-utils'
import { VideoChannel } from '@shared/models'
const expect = chai.expect

View File

@ -2,7 +2,7 @@
import 'mocha'
import * as chai from 'chai'
import { cleanupTests, createSingleServer, SearchCommand, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils'
import { cleanupTests, createSingleServer, PeerTubeServer, SearchCommand, setAccessTokensToServers } from '@shared/extra-utils'
import { BooleanBothQuery, VideoPlaylistPrivacy, VideoPlaylistType, VideosSearchQuery } from '@shared/models'
const expect = chai.expect

View File

@ -5,8 +5,8 @@ import * as chai from 'chai'
import {
cleanupTests,
createSingleServer,
SearchCommand,
PeerTubeServer,
SearchCommand,
setAccessTokensToServers,
setDefaultVideoChannel
} from '@shared/extra-utils'

View File

@ -5,8 +5,8 @@ import * as chai from 'chai'
import {
cleanupTests,
createSingleServer,
SearchCommand,
PeerTubeServer,
SearchCommand,
setAccessTokensToServers,
setDefaultVideoChannel,
stopFfmpeg,

View File

@ -5,8 +5,8 @@ import * as chai from 'chai'
import {
BulkCommand,
cleanupTests,
doubleFollow,
createMultipleServers,
doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
waitJobs

View File

@ -2,7 +2,6 @@
import 'mocha'
import * as chai from 'chai'
import { HttpStatusCode } from '@shared/models'
import {
cleanupTests,
createSingleServer,
@ -12,7 +11,7 @@ import {
PeerTubeServer,
setAccessTokensToServers
} from '@shared/extra-utils'
import { CustomConfig } from '@shared/models'
import { CustomConfig, HttpStatusCode } from '@shared/models'
const expect = chai.expect

View File

@ -2,7 +2,6 @@
import 'mocha'
import * as chai from 'chai'
import { HttpStatusCode } from '@shared/models'
import {
cleanupTests,
ContactFormCommand,
@ -13,6 +12,7 @@ import {
wait,
waitJobs
} from '@shared/extra-utils'
import { HttpStatusCode } from '@shared/models'
const expect = chai.expect

View File

@ -2,8 +2,8 @@
import 'mocha'
import * as chai from 'chai'
import { HttpStatusCode } from '@shared/models'
import { cleanupTests, createSingleServer, MockSmtpServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
import { HttpStatusCode } from '@shared/models'
const expect = chai.expect

View File

@ -2,9 +2,8 @@
import 'mocha'
import * as chai from 'chai'
import { HttpStatusCode } from '@shared/models'
import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils'
import { PeerTubeProblemDocument, ServerErrorCode } from '@shared/models'
import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils'
import { HttpStatusCode, PeerTubeProblemDocument, ServerErrorCode } from '@shared/models'
const expect = chai.expect
@ -157,7 +156,7 @@ describe('Test follow constraints', function () {
it('Should list local account videos', async function () {
const { total, data } = await servers[0].videos.listByAccount({
token: undefined,
token: null,
handle: 'root@localhost:' + servers[0].port
})
@ -167,7 +166,7 @@ describe('Test follow constraints', function () {
it('Should not list remote account videos', async function () {
const { total, data } = await servers[0].videos.listByAccount({
token: undefined,
token: null,
handle: 'root@localhost:' + servers[1].port
})
@ -177,7 +176,7 @@ describe('Test follow constraints', function () {
it('Should list local channel videos', async function () {
const handle = 'root_channel@localhost:' + servers[0].port
const { total, data } = await servers[0].videos.listByChannel({ token: undefined, handle })
const { total, data } = await servers[0].videos.listByChannel({ token: null, handle })
expect(total).to.equal(1)
expect(data).to.have.lengthOf(1)
@ -185,7 +184,7 @@ describe('Test follow constraints', function () {
it('Should not list remote channel videos', async function () {
const handle = 'root_channel@localhost:' + servers[1].port
const { total, data } = await servers[0].videos.listByChannel({ token: undefined, handle })
const { total, data } = await servers[0].videos.listByChannel({ token: null, handle })
expect(total).to.equal(0)
expect(data).to.have.lengthOf(0)

View File

@ -5,9 +5,9 @@ import * as chai from 'chai'
import {
cleanupTests,
completeVideoCheck,
createMultipleServers,
dateIsValid,
expectAccountFollows,
createMultipleServers,
FollowsCommand,
PeerTubeServer,
setAccessTokensToServers,

View File

@ -2,7 +2,6 @@
import 'mocha'
import * as chai from 'chai'
import { HttpStatusCode } from '@shared/models'
import {
cleanupTests,
CommentsCommand,
@ -14,7 +13,7 @@ import {
wait,
waitJobs
} from '@shared/extra-utils'
import { JobState, VideoCreateResult, VideoPrivacy } from '@shared/models'
import { HttpStatusCode, JobState, VideoCreateResult, VideoPrivacy } from '@shared/models'
const expect = chai.expect

View File

@ -5,8 +5,8 @@ import * as chai from 'chai'
import { HttpStatusCode } from '@shared/models'
import {
cleanupTests,
CustomPagesCommand,
createSingleServer,
CustomPagesCommand,
killallServers,
PeerTubeServer,
setAccessTokensToServers

View File

@ -4,9 +4,9 @@ import 'mocha'
import * as chai from 'chai'
import {
cleanupTests,
createMultipleServers,
dateIsValid,
doubleFollow,
createMultipleServers,
PeerTubeServer,
setAccessTokensToServers,
waitJobs

View File

@ -2,18 +2,17 @@
import 'mocha'
import * as chai from 'chai'
import { HttpStatusCode } from '@shared/models'
import {
cleanupTests,
createSingleServer,
killallServers,
PluginsCommand,
PeerTubeServer,
PluginsCommand,
setAccessTokensToServers,
testHelloWorldRegisteredSettings,
wait
} from '@shared/extra-utils'
import { PluginType } from '@shared/models'
import { HttpStatusCode, PluginType } from '@shared/models'
const expect = chai.expect

View File

@ -1,8 +1,8 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import { expect } from 'chai'
import { HttpStatusCode } from '@shared/models'
import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, wait } from '@shared/extra-utils'
import { HttpStatusCode } from '@shared/models'
describe('Test application behind a reverse proxy', function () {
let server: PeerTubeServer

View File

@ -4,8 +4,8 @@ import 'mocha'
import * as chai from 'chai'
import {
cleanupTests,
doubleFollow,
createMultipleServers,
doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
wait,

View File

@ -4,8 +4,8 @@ import 'mocha'
import * as chai from 'chai'
import {
cleanupTests,
doubleFollow,
createMultipleServers,
doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
SubscriptionsCommand,
@ -67,7 +67,8 @@ describe('Test users subscriptions', function () {
await waitJobs(servers)
const { uuid } = await servers[2].videos.upload({ attributes: { name: 'video server 3 added after follow' } })
const attributes = { name: 'video server 3 added after follow' }
const { uuid } = await servers[2].videos.upload({ token: users[2].accessToken, attributes })
video3UUID = uuid
await waitJobs(servers)

View File

@ -7,8 +7,8 @@ import {
checkTmpIsEmpty,
checkVideoFilesWereRemoved,
cleanupTests,
doubleFollow,
createMultipleServers,
doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
testImage,

View File

@ -2,8 +2,8 @@
import 'mocha'
import * as chai from 'chai'
import { HttpStatusCode } from '@shared/models'
import { cleanupTests, createSingleServer, MockSmtpServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
import { HttpStatusCode } from '@shared/models'
const expect = chai.expect

View File

@ -2,7 +2,6 @@
import 'mocha'
import * as chai from 'chai'
import { HttpStatusCode } from '@shared/models'
import {
cleanupTests,
createSingleServer,
@ -13,7 +12,7 @@ import {
testImage,
waitJobs
} from '@shared/extra-utils'
import { AbuseState, OAuth2ErrorCode, UserAdminFlag, UserRole, Video, VideoPlaylistType } from '@shared/models'
import { AbuseState, HttpStatusCode, OAuth2ErrorCode, UserAdminFlag, UserRole, Video, VideoPlaylistType } from '@shared/models'
const expect = chai.expect

View File

@ -4,7 +4,7 @@ import 'mocha'
import * as chai from 'chai'
import { join } from 'path'
import { getAudioStream, getVideoStreamSize } from '@server/helpers/ffprobe-utils'
import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
const expect = chai.expect

View File

@ -3,16 +3,15 @@
import 'mocha'
import * as chai from 'chai'
import * as request from 'supertest'
import { HttpStatusCode } from '@shared/models'
import {
buildAbsoluteFixturePath,
checkTmpIsEmpty,
checkVideoFilesWereRemoved,
cleanupTests,
completeVideoCheck,
createMultipleServers,
dateIsValid,
doubleFollow,
createMultipleServers,
PeerTubeServer,
setAccessTokensToServers,
testImage,
@ -20,7 +19,7 @@ import {
waitJobs,
webtorrentAdd
} from '@shared/extra-utils'
import { VideoCommentThreadTree, VideoPrivacy } from '@shared/models'
import { HttpStatusCode, VideoCommentThreadTree, VideoPrivacy } from '@shared/models'
const expect = chai.expect

View File

@ -4,7 +4,6 @@ import 'mocha'
import * as chai from 'chai'
import { pathExists, readdir, stat } from 'fs-extra'
import { join } from 'path'
import { HttpStatusCode } from '@shared/models'
import {
buildAbsoluteFixturePath,
cleanupTests,
@ -13,7 +12,7 @@ import {
setAccessTokensToServers,
setDefaultVideoChannel
} from '@shared/extra-utils'
import { VideoPrivacy } from '@shared/models'
import { HttpStatusCode, VideoPrivacy } from '@shared/models'
const expect = chai.expect

View File

@ -5,8 +5,8 @@ import * as chai from 'chai'
import {
checkVideoFilesWereRemoved,
cleanupTests,
doubleFollow,
createMultipleServers,
doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
testCaptionFile,

View File

@ -2,19 +2,18 @@
import 'mocha'
import * as chai from 'chai'
import { HttpStatusCode } from '@shared/models'
import {
ChangeOwnershipCommand,
cleanupTests,
doubleFollow,
createMultipleServers,
createSingleServer,
doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
setDefaultVideoChannel,
waitJobs
} from '@shared/extra-utils'
import { VideoPrivacy } from '@shared/models'
import { HttpStatusCode, VideoPrivacy } from '@shared/models'
const expect = chai.expect

View File

@ -6,8 +6,8 @@ import { basename } from 'path'
import { ACTOR_IMAGES_SIZE } from '@server/initializers/constants'
import {
cleanupTests,
doubleFollow,
createMultipleServers,
doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
setDefaultVideoChannel,

View File

@ -5,8 +5,8 @@ import * as chai from 'chai'
import {
cleanupTests,
CommentsCommand,
dateIsValid,
createSingleServer,
dateIsValid,
PeerTubeServer,
setAccessTokensToServers,
testImage

View File

@ -2,7 +2,7 @@
import 'mocha'
import * as chai from 'chai'
import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
const expect = chai.expect

View File

@ -3,22 +3,21 @@
import 'mocha'
import * as chai from 'chai'
import { join } from 'path'
import { HttpStatusCode } from '@shared/models'
import {
checkDirectoryIsEmpty,
checkResolutionsInMasterPlaylist,
checkSegmentHash,
checkTmpIsEmpty,
cleanupTests,
doubleFollow,
createMultipleServers,
doubleFollow,
makeRawRequest,
PeerTubeServer,
setAccessTokensToServers,
waitJobs,
webtorrentAdd
} from '@shared/extra-utils'
import { VideoStreamingPlaylistType } from '@shared/models'
import { HttpStatusCode, VideoStreamingPlaylistType } from '@shared/models'
import { DEFAULT_AUDIO_RESOLUTION } from '../../../initializers/constants'
const expect = chai.expect

View File

@ -30,8 +30,8 @@ describe('Test video NSFW policy', function () {
promises = [
server.search.advancedVideoSearch({ token, search: { search: 'n', sort: '-publishedAt', ...query } }),
server.videos.listWithToken({ token, ...query }),
server.videos.listByAccount({ token, handle: channelName, ...query }),
server.videos.listByChannel({ token, handle: accountName, ...query })
server.videos.listByAccount({ token, handle: accountName, ...query }),
server.videos.listByChannel({ token, handle: channelName, ...query })
]
// Overviews do not support video filters
@ -47,8 +47,8 @@ describe('Test video NSFW policy', function () {
promises = [
server.search.searchVideos({ search: 'n', sort: '-publishedAt' }),
server.videos.list(),
server.videos.listByAccount({ handle: channelName }),
server.videos.listByChannel({ handle: accountName })
server.videos.listByAccount({ token: null, handle: accountName }),
server.videos.listByChannel({ token: null, handle: channelName })
]
// Overviews do not support video filters
@ -82,6 +82,7 @@ describe('Test video NSFW policy', function () {
})
describe('Instance default NSFW policy', function () {
it('Should display NSFW videos with display default NSFW policy', async function () {
const serverConfig = await server.config.getConfig()
expect(serverConfig.instance.defaultNSFWPolicy).to.equal('display')

Some files were not shown because too many files have changed in this diff Show More