1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-06 03:50:26 +02:00

Update dependencies

This commit is contained in:
Chocobozzz 2020-02-28 16:03:39 +01:00
parent 9d94e5d7b9
commit bdd428a6d9
No known key found for this signature in database
GPG key ID: 583A612D890159BE
33 changed files with 347 additions and 343 deletions

View file

@ -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 })

View file

@ -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 })

View file

@ -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[]) {

View file

@ -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

View file

@ -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'

View file

@ -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'

View file

@ -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'