From bdd428a6d9138d751f8cde82867022a93f1a76cc Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 28 Feb 2020 16:03:39 +0100 Subject: Update dependencies --- server/controllers/activitypub/inbox.ts | 4 ++-- server/controllers/api/search.ts | 2 +- server/controllers/client.ts | 2 +- server/helpers/custom-validators/activitypub/actor.ts | 4 ++-- server/helpers/custom-validators/activitypub/videos.ts | 6 +++--- server/helpers/custom-validators/feeds.ts | 2 +- server/helpers/custom-validators/logs.ts | 2 +- server/helpers/custom-validators/users.ts | 2 +- server/helpers/custom-validators/videos.ts | 2 +- server/helpers/youtube-dl.ts | 2 +- server/initializers/checker-after-init.ts | 4 ++-- server/initializers/config.ts | 2 +- server/initializers/migrations/0080-video-channels.ts | 2 +- server/initializers/migrations/0345-video-playlists.ts | 2 +- server/lib/activitypub/actor.ts | 6 +++--- server/lib/activitypub/playlist.ts | 6 ++++-- server/lib/activitypub/send/utils.ts | 6 +++--- server/lib/activitypub/videos.ts | 12 +++++++----- server/lib/avatar.ts | 2 +- server/lib/user.ts | 2 +- server/lib/video-channel.ts | 2 +- server/middlewares/activitypub.ts | 2 +- server/tests/api/notifications/user-notifications.ts | 2 +- server/tests/api/server/tracker.ts | 6 +++--- server/tests/cli/prune-storage.ts | 2 +- server/tools/peertube-auth.ts | 2 +- server/tools/peertube-import-videos.ts | 2 +- server/tools/peertube-repl.ts | 5 +---- 28 files changed, 48 insertions(+), 47 deletions(-) (limited to 'server') diff --git a/server/controllers/activitypub/inbox.ts b/server/controllers/activitypub/inbox.ts index 3b8fb34a8..c5edf86b7 100644 --- a/server/controllers/activitypub/inbox.ts +++ b/server/controllers/activitypub/inbox.ts @@ -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).orderedItems } else { activities = [ rootActivity as Activity ] diff --git a/server/controllers/api/search.ts b/server/controllers/api/search.ts index 349650aca..16ffbf683 100644 --- a/server/controllers/api/search.ts +++ b/server/controllers/api/search.ts @@ -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) diff --git a/server/controllers/client.ts b/server/controllers/client.ts index 20689fb58..08c0f1fa6 100644 --- a/server/controllers/client.ts +++ b/server/controllers/client.ts @@ -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) diff --git a/server/helpers/custom-validators/activitypub/actor.ts b/server/helpers/custom-validators/activitypub/actor.ts index fec67823d..2f44522a5 100644 --- a/server/helpers/custom-validators/activitypub/actor.ts +++ b/server/helpers/custom-validators/activitypub/actor.ts @@ -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) } diff --git a/server/helpers/custom-validators/activitypub/videos.ts b/server/helpers/custom-validators/activitypub/videos.ts index 22b5e14a2..af8c8a0c8 100644 --- a/server/helpers/custom-validators/activitypub/videos.ts +++ b/server/helpers/custom-validators/activitypub/videos.ts @@ -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 }) ) || diff --git a/server/helpers/custom-validators/feeds.ts b/server/helpers/custom-validators/feeds.ts index 638e814f0..fa35a7da6 100644 --- a/server/helpers/custom-validators/feeds.ts +++ b/server/helpers/custom-validators/feeds.ts @@ -13,7 +13,7 @@ function isValidRSSFeed (value: string) { 'atom1' ] - return feedExtensions.indexOf(value) !== -1 + return feedExtensions.includes(value) } // --------------------------------------------------------------------------- diff --git a/server/helpers/custom-validators/logs.ts b/server/helpers/custom-validators/logs.ts index 30d0ce262..0f266ed3b 100644 --- a/server/helpers/custom-validators/logs.ts +++ b/server/helpers/custom-validators/logs.ts @@ -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) } // --------------------------------------------------------------------------- diff --git a/server/helpers/custom-validators/users.ts b/server/helpers/custom-validators/users.ts index 1ddbe0815..d6e91ad35 100644 --- a/server/helpers/custom-validators/users.ts +++ b/server/helpers/custom-validators/users.ts @@ -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) { diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.ts index cfb430c63..60e8075f6 100644 --- a/server/helpers/custom-validators/videos.ts +++ b/server/helpers/custom-validators/videos.ts @@ -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) { diff --git a/server/helpers/youtube-dl.ts b/server/helpers/youtube-dl.ts index fc9d416a1..26dbe6543 100644 --- a/server/helpers/youtube-dl.ts +++ b/server/helpers/youtube-dl.ts @@ -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 } diff --git a/server/initializers/checker-after-init.ts b/server/initializers/checker-after-init.ts index e01609eef..bc4aae957 100644 --- a/server/initializers/checker-after-init.ts +++ b/server/initializers/checker-after-init.ts @@ -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 } diff --git a/server/initializers/config.ts b/server/initializers/config.ts index 950ca61bd..3c07624e8 100644 --- a/server/initializers/config.ts +++ b/server/initializers/config.ts @@ -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 } diff --git a/server/initializers/migrations/0080-video-channels.ts b/server/initializers/migrations/0080-video-channels.ts index b8e9bd6d0..883224cb0 100644 --- a/server/initializers/migrations/0080-video-channels.ts +++ b/server/initializers/migrations/0080-video-channels.ts @@ -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 diff --git a/server/initializers/migrations/0345-video-playlists.ts b/server/initializers/migrations/0345-video-playlists.ts index 76813f93f..89a14a6ee 100644 --- a/server/initializers/migrations/0345-video-playlists.ts +++ b/server/initializers/migrations/0345-video-playlists.ts @@ -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: { diff --git a/server/lib/activitypub/actor.ts b/server/lib/activitypub/actor.ts index 9eabef4b0..c3598b75b 100644 --- a/server/lib/activitypub/actor.ts +++ b/server/lib/activitypub/actor.ts @@ -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>(options) return body.totalItems ? body.totalItems : 0 } catch (err) { logger.warn('Cannot fetch remote actor count %s.', url, { err }) diff --git a/server/lib/activitypub/playlist.ts b/server/lib/activitypub/playlist.ts index c52b715ef..c1d932a68 100644 --- a/server/lib/activitypub/playlist.ts +++ b/server/lib/activitypub/playlist.ts @@ -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(options) if (isPlaylistObjectValid(body) === false || checkUrlsSameHost(body.id, playlistUrl) !== true) { logger.debug('Remote video playlist JSON is not valid.', { body }) diff --git a/server/lib/activitypub/send/utils.ts b/server/lib/activitypub/send/utils.ts index b57bae8fd..6fd53d71b 100644 --- a/server/lib/activitypub/send/utils.ts +++ b/server/lib/activitypub/send/utils.ts @@ -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[]) { diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts index d182ca5a2..bce1666be 100644 --- a/server/lib/activitypub/videos.ts +++ b/server/lib/activitypub/videos.ts @@ -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(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(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 diff --git a/server/lib/avatar.ts b/server/lib/avatar.ts index ad4cdd3ab..3de45dd19 100644 --- a/server/lib/avatar.ts +++ b/server/lib/avatar.ts @@ -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' diff --git a/server/lib/user.ts b/server/lib/user.ts index 88e60a7df..316c57359 100644 --- a/server/lib/user.ts +++ b/server/lib/user.ts @@ -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' diff --git a/server/lib/video-channel.ts b/server/lib/video-channel.ts index 14829c9d6..c9887c667 100644 --- a/server/lib/video-channel.ts +++ b/server/lib/video-channel.ts @@ -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' diff --git a/server/middlewares/activitypub.ts b/server/middlewares/activitypub.ts index ab7d04d25..45899818e 100644 --- a/server/middlewares/activitypub.ts +++ b/server/middlewares/activitypub.ts @@ -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') } diff --git a/server/tests/api/notifications/user-notifications.ts b/server/tests/api/notifications/user-notifications.ts index 2a632e16f..625e344fa 100644 --- a/server/tests/api/notifications/user-notifications.ts +++ b/server/tests/api/notifications/user-notifications.ts @@ -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' diff --git a/server/tests/api/server/tracker.ts b/server/tests/api/server/tracker.ts index 9d3a274d4..611d5254a 100644 --- a/server/tests/api/server/tracker.ts +++ b/server/tests/api/server/tracker.ts @@ -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'))) diff --git a/server/tests/cli/prune-storage.ts b/server/tests/cli/prune-storage.ts index 304c8ca56..6cda80070 100644 --- a/server/tests/cli/prune-storage.ts +++ b/server/tests/cli/prune-storage.ts @@ -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 diff --git a/server/tools/peertube-auth.ts b/server/tools/peertube-auth.ts index 6b486e575..c1a804f83 100644 --- a/server/tools/peertube-auth.ts +++ b/server/tools/peertube-auth.ts @@ -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) diff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.ts index 3fb9979df..7f3b58bba 100644 --- a/server/tools/peertube-import-videos.ts +++ b/server/tools/peertube-import-videos.ts @@ -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 } diff --git a/server/tools/peertube-repl.ts b/server/tools/peertube-repl.ts index 7c936ae0d..ecbba8b0b 100644 --- a/server/tools/peertube-repl.ts +++ b/server/tools/peertube-repl.ts @@ -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' -- cgit v1.2.3