mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2024-08-17 17:30:32 +03:00
Update dependencies
This commit is contained in:
parent
9d94e5d7b9
commit
bdd428a6d9
@ -63,11 +63,13 @@
|
||||
"allowNumber": "true"
|
||||
}
|
||||
],
|
||||
|
||||
"@typescript-eslint/quotes": "off",
|
||||
"@typescript-eslint/no-var-requires": "off",
|
||||
"@typescript-eslint/explicit-function-return-type": "off",
|
||||
"@typescript-eslint/promise-function-async": "off",
|
||||
"@typescript-eslint/no-dynamic-delete": "off",
|
||||
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "off",
|
||||
"@typescript-eslint/strict-boolean-expressions": "off",
|
||||
"@typescript-eslint/consistent-type-definitions": "off",
|
||||
"@typescript-eslint/no-misused-promises": "off",
|
||||
|
18
package.json
18
package.json
@ -82,7 +82,7 @@
|
||||
"apicache": "^1.4.0",
|
||||
"async": "^3.0.1",
|
||||
"async-lru": "^1.1.1",
|
||||
"bcrypt": "3.0.7",
|
||||
"bcrypt": "4.0.0",
|
||||
"bittorrent-tracker": "^9.0.0",
|
||||
"bluebird": "^3.5.0",
|
||||
"body-parser": "^1.12.4",
|
||||
@ -102,7 +102,7 @@
|
||||
"fluent-ffmpeg": "^2.1.0",
|
||||
"fs-extra": "^8.0.1",
|
||||
"helmet": "^3.12.1",
|
||||
"http-signature": "1.3.1",
|
||||
"http-signature": "1.3.2",
|
||||
"ip-anonymize": "^0.1.0",
|
||||
"ipaddr.js": "1.9.1",
|
||||
"is-cidr": "^3.0.0",
|
||||
@ -122,11 +122,11 @@
|
||||
"pfeed": "1.1.11",
|
||||
"pg": "^7.4.1",
|
||||
"prompt": "^1.0.0",
|
||||
"redis": "^2.8.0",
|
||||
"redis": "^3.0.2",
|
||||
"reflect-metadata": "^0.1.12",
|
||||
"request": "^2.81.0",
|
||||
"scripty": "^1.5.0",
|
||||
"sequelize": "5.21.3",
|
||||
"sequelize": "5.21.5",
|
||||
"sequelize-typescript": "^1.0.0-beta.4",
|
||||
"sharp": "^0.24.0",
|
||||
"sitemap": "^5.0.0",
|
||||
@ -134,7 +134,7 @@
|
||||
"srt-to-vtt": "^1.1.2",
|
||||
"tsconfig-paths": "^3.9.0",
|
||||
"useragent": "^2.3.0",
|
||||
"uuid": "^3.1.0",
|
||||
"uuid": "^7.0.1",
|
||||
"validator": "^12.1.0",
|
||||
"webfinger.js": "^2.6.6",
|
||||
"webtorrent": "^0.107.16",
|
||||
@ -150,14 +150,14 @@
|
||||
"@types/bcrypt": "^3.0.0",
|
||||
"@types/bluebird": "3.5.29",
|
||||
"@types/body-parser": "^1.16.3",
|
||||
"@types/bull": "3.12.0",
|
||||
"@types/bull": "3.12.1",
|
||||
"@types/bytes": "^3.0.0",
|
||||
"@types/chai": "^4.0.4",
|
||||
"@types/chai-json-schema": "^1.4.3",
|
||||
"@types/chai-xml": "^0.3.1",
|
||||
"@types/config": "^0.0.36",
|
||||
"@types/express": "^4.0.35",
|
||||
"@types/express-rate-limit": "^3.3.0",
|
||||
"@types/express-rate-limit": "^5.0.0",
|
||||
"@types/fluent-ffmpeg": "^2.1.8",
|
||||
"@types/fs-extra": "^8.0.0",
|
||||
"@types/libxmljs": "^0.18.0",
|
||||
@ -166,7 +166,7 @@
|
||||
"@types/magnet-uri": "^5.1.1",
|
||||
"@types/maildev": "^0.0.1",
|
||||
"@types/memoizee": "^0.4.2",
|
||||
"@types/mkdirp": "^0.5.1",
|
||||
"@types/mkdirp": "^1.0.0",
|
||||
"@types/mocha": "^7.0.1",
|
||||
"@types/morgan": "^1.7.32",
|
||||
"@types/multer": "^1.3.3",
|
||||
@ -188,7 +188,7 @@
|
||||
"chai-xml": "^0.3.2",
|
||||
"concurrently": "^5.0.0",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-config-standard-with-typescript": "^12.0.1",
|
||||
"eslint-config-standard-with-typescript": "^14.0.0",
|
||||
"eslint-plugin-import": "^2.20.1",
|
||||
"eslint-plugin-node": "^11.0.0",
|
||||
"eslint-plugin-promise": "^4.2.1",
|
||||
|
@ -56,9 +56,9 @@ function inboxController (req: express.Request, res: express.Response) {
|
||||
const rootActivity: RootActivity = req.body
|
||||
let activities: Activity[]
|
||||
|
||||
if ([ 'Collection', 'CollectionPage' ].indexOf(rootActivity.type) !== -1) {
|
||||
if ([ 'Collection', 'CollectionPage' ].includes(rootActivity.type)) {
|
||||
activities = (rootActivity as ActivityPubCollection).items
|
||||
} else if ([ 'OrderedCollection', 'OrderedCollectionPage' ].indexOf(rootActivity.type) !== -1) {
|
||||
} else if ([ 'OrderedCollection', 'OrderedCollectionPage' ].includes(rootActivity.type)) {
|
||||
activities = (rootActivity as ActivityPubOrderedCollection<Activity>).orderedItems
|
||||
} else {
|
||||
activities = [ rootActivity as Activity ]
|
||||
|
@ -60,7 +60,7 @@ function searchVideoChannels (req: express.Request, res: express.Response) {
|
||||
|
||||
// Handle strings like @toto@example.com
|
||||
if (parts.length === 3 && parts[0].length === 0) parts.shift()
|
||||
const isWebfingerSearch = parts.length === 2 && parts.every(p => p && p.indexOf(' ') === -1)
|
||||
const isWebfingerSearch = parts.length === 2 && parts.every(p => p && !p.includes(' '))
|
||||
|
||||
if (isURISearch || isWebfingerSearch) return searchVideoChannelURI(search, isWebfingerSearch, res)
|
||||
|
||||
|
@ -76,7 +76,7 @@ function serveServerTranslations (req: express.Request, res: express.Response) {
|
||||
const locale = req.params.locale
|
||||
const file = req.params.file
|
||||
|
||||
if (is18nLocale(locale) && LOCALE_FILES.indexOf(file) !== -1) {
|
||||
if (is18nLocale(locale) && LOCALE_FILES.includes(file)) {
|
||||
const completeLocale = getCompleteLocale(locale)
|
||||
const completeFileLocale = buildFileLocale(completeLocale)
|
||||
|
||||
|
@ -28,7 +28,7 @@ function isActorPublicKeyValid (publicKey: string) {
|
||||
return exists(publicKey) &&
|
||||
typeof publicKey === 'string' &&
|
||||
publicKey.startsWith('-----BEGIN PUBLIC KEY-----') &&
|
||||
publicKey.indexOf('-----END PUBLIC KEY-----') !== -1 &&
|
||||
publicKey.includes('-----END PUBLIC KEY-----') &&
|
||||
validator.isLength(publicKey, CONSTRAINTS_FIELDS.ACTORS.PUBLIC_KEY)
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ function isActorPrivateKeyValid (privateKey: string) {
|
||||
typeof privateKey === 'string' &&
|
||||
privateKey.startsWith('-----BEGIN RSA PRIVATE KEY-----') &&
|
||||
// Sometimes there is a \n at the end, so just assert the string contains the end mark
|
||||
privateKey.indexOf('-----END RSA PRIVATE KEY-----') !== -1 &&
|
||||
privateKey.includes('-----END RSA PRIVATE KEY-----') &&
|
||||
validator.isLength(privateKey, CONSTRAINTS_FIELDS.ACTORS.PRIVATE_KEY)
|
||||
}
|
||||
|
||||
|
@ -84,19 +84,19 @@ function sanitizeAndCheckVideoTorrentObject (video: any) {
|
||||
function isRemoteVideoUrlValid (url: any) {
|
||||
return url.type === 'Link' &&
|
||||
(
|
||||
ACTIVITY_PUB.URL_MIME_TYPES.VIDEO.indexOf(url.mediaType) !== -1 &&
|
||||
ACTIVITY_PUB.URL_MIME_TYPES.VIDEO.includes(url.mediaType) &&
|
||||
isActivityPubUrlValid(url.href) &&
|
||||
validator.isInt(url.height + '', { min: 0 }) &&
|
||||
validator.isInt(url.size + '', { min: 0 }) &&
|
||||
(!url.fps || validator.isInt(url.fps + '', { min: -1 }))
|
||||
) ||
|
||||
(
|
||||
ACTIVITY_PUB.URL_MIME_TYPES.TORRENT.indexOf(url.mediaType) !== -1 &&
|
||||
ACTIVITY_PUB.URL_MIME_TYPES.TORRENT.includes(url.mediaType) &&
|
||||
isActivityPubUrlValid(url.href) &&
|
||||
validator.isInt(url.height + '', { min: 0 })
|
||||
) ||
|
||||
(
|
||||
ACTIVITY_PUB.URL_MIME_TYPES.MAGNET.indexOf(url.mediaType) !== -1 &&
|
||||
ACTIVITY_PUB.URL_MIME_TYPES.MAGNET.includes(url.mediaType) &&
|
||||
validator.isLength(url.href, { min: 5 }) &&
|
||||
validator.isInt(url.height + '', { min: 0 })
|
||||
) ||
|
||||
|
@ -13,7 +13,7 @@ function isValidRSSFeed (value: string) {
|
||||
'atom1'
|
||||
]
|
||||
|
||||
return feedExtensions.indexOf(value) !== -1
|
||||
return feedExtensions.includes(value)
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
@ -4,7 +4,7 @@ import { LogLevel } from '../../../shared/models/server/log-level.type'
|
||||
const logLevels: LogLevel[] = [ 'debug', 'info', 'warn', 'error' ]
|
||||
|
||||
function isValidLogLevel (value: any) {
|
||||
return exists(value) && logLevels.indexOf(value) !== -1
|
||||
return exists(value) && logLevels.includes(value)
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
@ -46,7 +46,7 @@ function isUserEmailVerifiedValid (value: any) {
|
||||
|
||||
const nsfwPolicies = values(NSFW_POLICY_TYPES)
|
||||
function isUserNSFWPolicyValid (value: any) {
|
||||
return exists(value) && nsfwPolicies.indexOf(value) !== -1
|
||||
return exists(value) && nsfwPolicies.includes(value)
|
||||
}
|
||||
|
||||
function isUserWebTorrentEnabledValid (value: any) {
|
||||
|
@ -73,7 +73,7 @@ function isVideoViewsValid (value: string) {
|
||||
}
|
||||
|
||||
function isVideoRatingTypeValid (value: string) {
|
||||
return value === 'none' || values(VIDEO_RATE_TYPES).indexOf(value as VideoRateType) !== -1
|
||||
return value === 'none' || values(VIDEO_RATE_TYPES).includes(value as VideoRateType)
|
||||
}
|
||||
|
||||
function isVideoFileExtnameValid (value: string) {
|
||||
|
@ -257,7 +257,7 @@ function getTags (tags: any) {
|
||||
function getLicence (licence: string) {
|
||||
if (!licence) return undefined
|
||||
|
||||
if (licence.indexOf('Creative Commons Attribution') !== -1) return 1
|
||||
if (licence.includes('Creative Commons Attribution')) return 1
|
||||
|
||||
return undefined
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ function checkConfig () {
|
||||
const defaultNSFWPolicy = CONFIG.INSTANCE.DEFAULT_NSFW_POLICY
|
||||
{
|
||||
const available = [ 'do_not_list', 'blur', 'display' ]
|
||||
if (available.indexOf(defaultNSFWPolicy) === -1) {
|
||||
if (available.includes(defaultNSFWPolicy) === false) {
|
||||
return 'NSFW policy setting should be ' + available.join(' or ') + ' instead of ' + defaultNSFWPolicy
|
||||
}
|
||||
}
|
||||
@ -64,7 +64,7 @@ function checkConfig () {
|
||||
if (isArray(redundancyVideos)) {
|
||||
const available = [ 'most-views', 'trending', 'recently-added' ]
|
||||
for (const r of redundancyVideos) {
|
||||
if (available.indexOf(r.strategy) === -1) {
|
||||
if (available.includes(r.strategy) === false) {
|
||||
return 'Videos redundancy should have ' + available.join(' or ') + ' strategy instead of ' + r.strategy
|
||||
}
|
||||
|
||||
|
@ -335,7 +335,7 @@ export function reloadConfig () {
|
||||
|
||||
function purge () {
|
||||
for (const fileName in require.cache) {
|
||||
if (fileName.indexOf(directory()) === -1) {
|
||||
if (fileName.includes(directory()) === false) {
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as Sequelize from 'sequelize'
|
||||
import * as uuidv4 from 'uuid/v4'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
|
||||
async function up (utils: {
|
||||
transaction: Sequelize.Transaction
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as Sequelize from 'sequelize'
|
||||
import { VideoPlaylistPrivacy, VideoPlaylistType } from '../../../shared/models/videos'
|
||||
import * as uuidv4 from 'uuid/v4'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import { WEBSERVER } from '../constants'
|
||||
|
||||
async function up (utils: {
|
||||
|
@ -1,8 +1,8 @@
|
||||
import * as Bluebird from 'bluebird'
|
||||
import { Transaction } from 'sequelize'
|
||||
import { URL } from 'url'
|
||||
import * as uuidv4 from 'uuid/v4'
|
||||
import { ActivityPubActor, ActivityPubActorType } from '../../../shared/models/activitypub'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import { ActivityPubActor, ActivityPubActorType, ActivityPubOrderedCollection } from '../../../shared/models/activitypub'
|
||||
import { ActivityPubAttributedTo } from '../../../shared/models/activitypub/objects'
|
||||
import { checkUrlsSameHost, getAPId } from '../../helpers/activitypub'
|
||||
import { sanitizeAndCheckActorObject } from '../../helpers/custom-validators/activitypub/actor'
|
||||
@ -207,7 +207,7 @@ async function fetchActorTotalItems (url: string) {
|
||||
}
|
||||
|
||||
try {
|
||||
const { body } = await doRequest(options)
|
||||
const { body } = await doRequest<ActivityPubOrderedCollection<unknown>>(options)
|
||||
return body.totalItems ? body.totalItems : 0
|
||||
} catch (err) {
|
||||
logger.warn('Cannot fetch remote actor count %s.', url, { err })
|
||||
|
@ -20,7 +20,9 @@ import { MAccountDefault, MAccountId, MVideoId } from '../../typings/models'
|
||||
import { MVideoPlaylist, MVideoPlaylistId, MVideoPlaylistOwner } from '../../typings/models/video/video-playlist'
|
||||
|
||||
function playlistObjectToDBAttributes (playlistObject: PlaylistObject, byAccount: MAccountId, to: string[]) {
|
||||
const privacy = to.indexOf(ACTIVITY_PUB.PUBLIC) !== -1 ? VideoPlaylistPrivacy.PUBLIC : VideoPlaylistPrivacy.UNLISTED
|
||||
const privacy = to.includes(ACTIVITY_PUB.PUBLIC)
|
||||
? VideoPlaylistPrivacy.PUBLIC
|
||||
: VideoPlaylistPrivacy.UNLISTED
|
||||
|
||||
return {
|
||||
name: playlistObject.name,
|
||||
@ -205,7 +207,7 @@ async function fetchRemoteVideoPlaylist (playlistUrl: string): Promise<{ statusC
|
||||
|
||||
logger.info('Fetching remote playlist %s.', playlistUrl)
|
||||
|
||||
const { response, body } = await doRequest(options)
|
||||
const { response, body } = await doRequest<any>(options)
|
||||
|
||||
if (isPlaylistObjectValid(body) === false || checkUrlsSameHost(body.id, playlistUrl) !== true) {
|
||||
logger.debug('Remote video playlist JSON is not valid.', { body })
|
||||
|
@ -44,7 +44,7 @@ async function sendVideoRelatedActivity (activityBuilder: (audience: ActivityAud
|
||||
async function forwardVideoRelatedActivity (
|
||||
activity: Activity,
|
||||
t: Transaction,
|
||||
followersException: MActorWithInboxes[] = [],
|
||||
followersException: MActorWithInboxes[],
|
||||
video: MVideoId
|
||||
) {
|
||||
// Mastodon does not add our announces in audience, so we forward to them manually
|
||||
@ -161,7 +161,7 @@ async function computeFollowerUris (toFollowersOf: MActorId[], actorsException:
|
||||
const result = await ActorFollowModel.listAcceptedFollowerSharedInboxUrls(toActorFollowerIds, t)
|
||||
const sharedInboxesException = await buildSharedInboxesException(actorsException)
|
||||
|
||||
return result.data.filter(sharedInbox => sharedInboxesException.indexOf(sharedInbox) === -1)
|
||||
return result.data.filter(sharedInbox => sharedInboxesException.includes(sharedInbox) === false)
|
||||
}
|
||||
|
||||
async function computeUris (toActors: MActor[], actorsException: MActorWithInboxes[] = []) {
|
||||
@ -174,7 +174,7 @@ async function computeUris (toActors: MActor[], actorsException: MActorWithInbox
|
||||
|
||||
const sharedInboxesException = await buildSharedInboxesException(actorsException)
|
||||
return Array.from(toActorSharedInboxesSet)
|
||||
.filter(sharedInbox => sharedInboxesException.indexOf(sharedInbox) === -1)
|
||||
.filter(sharedInbox => sharedInboxesException.includes(sharedInbox) === false)
|
||||
}
|
||||
|
||||
async function buildSharedInboxesException (actorsException: MActorWithInboxes[]) {
|
||||
|
@ -111,7 +111,7 @@ async function fetchRemoteVideo (videoUrl: string): Promise<{ response: request.
|
||||
|
||||
logger.info('Fetching remote video %s.', videoUrl)
|
||||
|
||||
const { response, body } = await doRequest(options)
|
||||
const { response, body } = await doRequest<any>(options)
|
||||
|
||||
if (sanitizeAndCheckVideoTorrentObject(body) === false || checkUrlsSameHost(body.id, videoUrl) !== true) {
|
||||
logger.debug('Remote video JSON is not valid.', { body })
|
||||
@ -129,7 +129,7 @@ async function fetchRemoteVideoDescription (video: MVideoAccountLight) {
|
||||
json: true
|
||||
}
|
||||
|
||||
const { body } = await doRequest(options)
|
||||
const { body } = await doRequest<any>(options)
|
||||
return body.description ? body.description : ''
|
||||
}
|
||||
|
||||
@ -507,7 +507,7 @@ function isAPVideoUrlObject (url: any): url is ActivityVideoUrlObject {
|
||||
const mimeTypes = Object.keys(MIMETYPES.VIDEO.MIMETYPE_EXT)
|
||||
|
||||
const urlMediaType = url.mediaType
|
||||
return mimeTypes.indexOf(urlMediaType) !== -1 && urlMediaType.startsWith('video/')
|
||||
return mimeTypes.includes(urlMediaType) && urlMediaType.startsWith('video/')
|
||||
}
|
||||
|
||||
function isAPStreamingPlaylistUrlObject (url: ActivityUrlObject): url is ActivityPlaylistUrlObject {
|
||||
@ -623,9 +623,11 @@ async function createVideo (videoObject: VideoTorrentObject, channel: MChannelAc
|
||||
}
|
||||
|
||||
function videoActivityObjectToDBAttributes (videoChannel: MChannelId, videoObject: VideoTorrentObject, to: string[] = []) {
|
||||
const privacy = to.indexOf(ACTIVITY_PUB.PUBLIC) !== -1 ? VideoPrivacy.PUBLIC : VideoPrivacy.UNLISTED
|
||||
const duration = videoObject.duration.replace(/[^\d]+/, '')
|
||||
const privacy = to.includes(ACTIVITY_PUB.PUBLIC)
|
||||
? VideoPrivacy.PUBLIC
|
||||
: VideoPrivacy.UNLISTED
|
||||
|
||||
const duration = videoObject.duration.replace(/[^\d]+/, '')
|
||||
const language = videoObject.language?.identifier
|
||||
|
||||
const category = videoObject.category
|
||||
|
@ -5,7 +5,7 @@ import { updateActorAvatarInstance } from './activitypub'
|
||||
import { processImage } from '../helpers/image-utils'
|
||||
import { extname, join } from 'path'
|
||||
import { retryTransactionWrapper } from '../helpers/database-utils'
|
||||
import * as uuidv4 from 'uuid/v4'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import { CONFIG } from '../initializers/config'
|
||||
import { sequelizeTypescript } from '../initializers/database'
|
||||
import * as LRUCache from 'lru-cache'
|
||||
|
@ -1,4 +1,4 @@
|
||||
import * as uuidv4 from 'uuid/v4'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import { ActivityPubActorType } from '../../shared/models/activitypub'
|
||||
import { SERVER_ACTOR_NAME, WEBSERVER } from '../initializers/constants'
|
||||
import { AccountModel } from '../models/account/account'
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as Sequelize from 'sequelize'
|
||||
import * as uuidv4 from 'uuid/v4'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import { VideoChannelCreate } from '../../shared/models'
|
||||
import { VideoChannelModel } from '../models/video/video-channel'
|
||||
import { buildActorInstance, federateVideoIfNeeded, getVideoChannelActivityPubUrl } from './activitypub'
|
||||
|
@ -38,7 +38,7 @@ async function checkSignature (req: Request, res: Response, next: NextFunction)
|
||||
|
||||
function executeIfActivityPub (req: Request, res: Response, next: NextFunction) {
|
||||
const accepted = req.accepts(ACCEPT_HEADERS)
|
||||
if (accepted === false || ACTIVITY_PUB.POTENTIAL_ACCEPT_HEADERS.indexOf(accepted) === -1) {
|
||||
if (accepted === false || ACTIVITY_PUB.POTENTIAL_ACCEPT_HEADERS.includes(accepted) === false) {
|
||||
// Bypass this route
|
||||
return next('route')
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ import { addUserSubscription, removeUserSubscription } from '../../../../shared/
|
||||
import { VideoPrivacy } from '../../../../shared/models/videos'
|
||||
import { getBadVideoUrl, getYoutubeVideoUrl, importVideo } from '../../../../shared/extra-utils/videos/video-imports'
|
||||
import { addVideoCommentReply, addVideoCommentThread } from '../../../../shared/extra-utils/videos/video-comments'
|
||||
import * as uuidv4 from 'uuid/v4'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import { addAccountToAccountBlocklist, removeAccountFromAccountBlocklist } from '../../../../shared/extra-utils/users/blocklist'
|
||||
import { CustomConfig } from '../../../../shared/models/server'
|
||||
import { VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'
|
||||
|
@ -49,7 +49,7 @@ describe('Test tracker', function () {
|
||||
torrent.on('error', done)
|
||||
torrent.on('warning', warn => {
|
||||
const message = typeof warn === 'string' ? warn : warn.message
|
||||
if (message.indexOf('Unknown infoHash ') !== -1) return done()
|
||||
if (message.includes('Unknown infoHash ')) return done()
|
||||
})
|
||||
|
||||
torrent.on('done', () => done(new Error('No error on infohash')))
|
||||
@ -64,7 +64,7 @@ describe('Test tracker', function () {
|
||||
torrent.on('error', done)
|
||||
torrent.on('warning', warn => {
|
||||
const message = typeof warn === 'string' ? warn : warn.message
|
||||
if (message.indexOf('Unknown infoHash ') !== -1) return done(new Error('Error on infohash'))
|
||||
if (message.includes('Unknown infoHash ')) return done(new Error('Error on infohash'))
|
||||
})
|
||||
|
||||
torrent.on('done', done)
|
||||
@ -83,7 +83,7 @@ describe('Test tracker', function () {
|
||||
torrent.on('error', done)
|
||||
torrent.on('warning', warn => {
|
||||
const message = typeof warn === 'string' ? warn : warn.message
|
||||
if (message.indexOf('disabled ') !== -1) return done()
|
||||
if (message.includes('disabled ')) return done()
|
||||
})
|
||||
|
||||
torrent.on('done', () => done(new Error('Tracker is enabled')))
|
||||
|
@ -22,7 +22,7 @@ import {
|
||||
} from '../../../shared/extra-utils'
|
||||
import { Account, VideoPlaylistPrivacy } from '../../../shared/models'
|
||||
import { createFile, readdir } from 'fs-extra'
|
||||
import * as uuidv4 from 'uuid/v4'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import { join } from 'path'
|
||||
|
||||
const expect = chai.expect
|
||||
|
@ -133,7 +133,7 @@ program
|
||||
.description('set an existing entry as default')
|
||||
.action(async url => {
|
||||
const settings = await getSettings()
|
||||
const instanceExists = settings.remotes.indexOf(url) !== -1
|
||||
const instanceExists = settings.remotes.includes(url)
|
||||
|
||||
if (instanceExists) {
|
||||
settings.default = settings.remotes.indexOf(url)
|
||||
|
@ -274,7 +274,7 @@ async function getCategory (categories: string[], url: string) {
|
||||
function getLicence (licence: string) {
|
||||
if (!licence) return undefined
|
||||
|
||||
if (licence.indexOf('Creative Commons Attribution licence') !== -1) return 1
|
||||
if (licence.includes('Creative Commons Attribution licence')) return 1
|
||||
|
||||
return undefined
|
||||
}
|
||||
|
@ -2,10 +2,7 @@ import { registerTSPaths } from '../helpers/register-ts-paths'
|
||||
import * as repl from 'repl'
|
||||
import * as path from 'path'
|
||||
import * as _ from 'lodash'
|
||||
import * as uuidv1 from 'uuid/v1'
|
||||
import * as uuidv3 from 'uuid/v3'
|
||||
import * as uuidv4 from 'uuid/v4'
|
||||
import * as uuidv5 from 'uuid/v5'
|
||||
import { uuidv1, uuidv3, uuidv4, uuidv5 } from 'uuid'
|
||||
import * as Sequelize from 'sequelize'
|
||||
import * as YoutubeDL from 'youtube-dl'
|
||||
|
||||
|
@ -69,11 +69,11 @@ export function peertubeTranslate (str: string, translations?: { [ id: string ]:
|
||||
|
||||
const possiblePaths = POSSIBLE_LOCALES.map(l => '/' + l)
|
||||
export function is18nPath (path: string) {
|
||||
return possiblePaths.indexOf(path) !== -1
|
||||
return possiblePaths.includes(path)
|
||||
}
|
||||
|
||||
export function is18nLocale (locale: string) {
|
||||
return POSSIBLE_LOCALES.indexOf(locale) !== -1
|
||||
return POSSIBLE_LOCALES.includes(locale)
|
||||
}
|
||||
|
||||
export function getCompleteLocale (locale: string) {
|
||||
@ -85,7 +85,7 @@ export function getCompleteLocale (locale: string) {
|
||||
}
|
||||
|
||||
export function getShortLocale (locale: string) {
|
||||
if (locale.indexOf('-') === -1) return locale
|
||||
if (locale.includes('-') === false) return locale
|
||||
|
||||
return locale.split('-')[0]
|
||||
}
|
||||
|
@ -38,5 +38,5 @@ const userRoleRights: { [ id in UserRole ]: UserRight[] } = {
|
||||
export function hasUserRight (userRole: UserRole, userRight: UserRight) {
|
||||
const userRights = userRoleRights[userRole]
|
||||
|
||||
return userRights.indexOf(UserRight.ALL) !== -1 || userRights.indexOf(userRight) !== -1
|
||||
return userRights.includes(UserRight.ALL) || userRights.includes(userRight)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user