Update server dependencies

This commit is contained in:
Chocobozzz 2023-10-11 09:20:23 +02:00
parent 066efd4b94
commit 2db1f3238d
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
27 changed files with 2972 additions and 3031 deletions

View File

@ -86,19 +86,18 @@
"dependencies": {
"@aws-sdk/client-s3": "^3.190.0",
"@aws-sdk/lib-storage": "^3.190.0",
"@aws-sdk/node-http-handler": "^3.190.0",
"@aws-sdk/s3-request-presigner": "^3.345.0",
"@babel/parser": "^7.17.8",
"@commander-js/extra-typings": "^11.0.0",
"@node-oauth/oauth2-server": "^4.2.0",
"@opentelemetry/api": "^1.1.0",
"@opentelemetry/exporter-jaeger": "^1.15.1",
"@opentelemetry/exporter-prometheus": "~0.41.1",
"@opentelemetry/instrumentation": "^0.41.1",
"@opentelemetry/exporter-prometheus": "~0.44.0",
"@opentelemetry/instrumentation": "^0.44.0",
"@opentelemetry/instrumentation-dns": "^0.32.0",
"@opentelemetry/instrumentation-express": "^0.33.0",
"@opentelemetry/instrumentation-fs": "^0.8.0",
"@opentelemetry/instrumentation-http": "^0.41.1",
"@opentelemetry/instrumentation-http": "^0.44.0",
"@opentelemetry/instrumentation-ioredis": "^0.35.0",
"@opentelemetry/instrumentation-pg": "^0.36.0",
"@opentelemetry/resources": "^1.15.1",
@ -108,28 +107,29 @@
"@opentelemetry/semantic-conventions": "^1.15.1",
"@peertube/feed": "^5.1.1",
"@peertube/http-signature": "^1.7.0",
"@smithy/node-http-handler": "^2.1.7",
"@uploadx/core": "^6.0.0",
"async-lru": "^1.1.1",
"async-mutex": "^0.4.0",
"bcrypt": "5.1.0",
"bencode": "^3.1.1",
"bittorrent-tracker": "^9",
"bcrypt": "5.1.1",
"bencode": "^4.0.0",
"bittorrent-tracker": "^10.0.12",
"bluebird": "^3.5.0",
"bullmq": "^3.6.6",
"bytes": "^3.0.0",
"chokidar": "^3.4.2",
"commander": "^10.0.0",
"commander": "^11.0.0",
"config": "^3.0.0",
"cookie-parser": "^1.4.3",
"cors": "^2.8.1",
"create-torrent": "^5",
"create-torrent": "^6.0.15",
"deep-object-diff": "^1.1.0",
"email-templates": "^11.0.3",
"execa": "^5.1.1",
"execa": "^8.0.1",
"express": "^4.18.1",
"express-rate-limit": "^6.1.0",
"express-rate-limit": "^7.1.1",
"express-validator": "^7.0.1",
"flat": "^5.0.0",
"flat": "^6.0.1",
"fluent-ffmpeg": "^2.1.0",
"fs-extra": "^11.1.0",
"got": "^13.0.0",
@ -138,15 +138,14 @@
"http-problem-details": "^0.1.5",
"ioredis": "^5.2.3",
"ip-anonymize": "^0.1.0",
"ipaddr.js": "2.0.1",
"is-cidr": "^4.0.0",
"ipaddr.js": "2.1.0",
"iso-639-3": "3.0.1",
"jimp": "^0.22.4",
"js-yaml": "^4.0.0",
"jsonld": "~8.2.0",
"jsonld": "~8.3.1",
"lodash-es": "^4.17.21",
"lru-cache": "^9.1.1",
"magnet-uri": "^6",
"lru-cache": "^10.0.1",
"magnet-uri": "^7.0.5",
"markdown-it": "^13.0.1",
"markdown-it-emoji": "^2.0.0",
"maxmind": "^4.3.6",
@ -158,28 +157,28 @@
"opentelemetry-instrumentation-sequelize": "^0.39.1",
"otpauth": "^9.0.2",
"p-queue": "^7.3.4",
"parse-torrent": "^9",
"parse-torrent": "^11.0.14",
"password-generator": "^2.0.2",
"pg": "^8.2.1",
"piscina": "^3.2.0",
"piscina": "^4.1.0",
"prompt": "^1.0.0",
"proxy-addr": "^2.0.7",
"pug": "^3.0.0",
"reflect-metadata": "^0.1.12",
"sanitize-html": "2.x",
"sequelize": "6.31.1",
"sequelize": "6.33.0",
"sequelize-typescript": "^2.0.0-beta.1",
"short-uuid": "^4.2.0",
"sitemap": "^7.0.0",
"socket.io": "^4.5.4",
"sql-formatter": "^12.0.1",
"sql-formatter": "^13.0.0",
"srt-to-vtt": "^1.1.2",
"tslib": "^2.0.0",
"useragent": "^2.3.0",
"validator": "^13.0.0",
"webfinger.js": "^2.6.6",
"webtorrent": "^1.9",
"winston": "3.8.2",
"webtorrent": "^2.1.27",
"winston": "3.11.0",
"ws": "^8.0.0"
},
"devDependencies": {
@ -214,7 +213,7 @@
"@types/validator": "^13.9.0",
"@types/webtorrent": "^0.109.0",
"@types/ws": "^8.2.0",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/eslint-plugin": "^6.7.5",
"autocannon": "^7.0.4",
"chai": "^4.1.1",
"chai-json-schema": "^1.5.0",
@ -222,8 +221,8 @@
"concurrently": "^8.0.1",
"depcheck": "^1.4.2",
"esbuild": "^0.19.0",
"eslint": "8.41.0",
"eslint-config-standard-with-typescript": "34.0.1",
"eslint": "8.51.0",
"eslint-config-standard-with-typescript": "39.1.1",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-n": "^16.0.0",
"eslint-plugin-node": "^11.0.0",
@ -239,7 +238,7 @@
"swagger-cli": "^4.0.2",
"tsc-watch": "^6.0.0",
"tsx": "^3.12.7",
"typescript": "~5.0.4"
"typescript": "~5.2.2"
},
"bundlewatch": {
"files": [

View File

@ -1,4 +1,3 @@
export * from './plugin-playlist-privacy-manager.model.js'
export * from './plugin-settings-manager.model.js'
export * from './plugin-storage-manager.model.js'

View File

@ -1,4 +1,3 @@
export * from './user-video-rate-update.model.js'
export * from './user-video-rate.model.js'
export * from './account-video-rate.model.js'

View File

@ -1,4 +1,3 @@
import { HttpStatusCode, ResultList, VideoImport, VideoImportCreate } from '@peertube/peertube-models'
import { unwrapBody } from '../requests/index.js'
import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'

View File

@ -1,4 +1,3 @@
import { expect } from 'chai'
import { getAllFiles, wait } from '@peertube/peertube-core-utils'
import { areMockObjectStorageTestsDisabled } from '@peertube/peertube-node-utils'

View File

@ -400,7 +400,7 @@ async function checkNewCommentOnMyVideo (options: CheckerBaseParams & {
checkVideo(notification.comment.video, undefined, shortUUID)
} else {
expect(notification).to.satisfy((n: UserNotification) => {
return n === undefined || n.comment === undefined || n.comment.id !== commentId
return n?.comment === undefined || n.comment.id !== commentId
})
}
}
@ -437,7 +437,7 @@ async function checkNewVideoAbuseForModerators (options: CheckerBaseParams & {
checkVideo(notification.abuse.video, videoName, shortUUID)
} else {
expect(notification).to.satisfy((n: UserNotification) => {
return n === undefined || n.abuse === undefined || n.abuse.video.shortUUID !== shortUUID
return n?.abuse === undefined || n.abuse.video.shortUUID !== shortUUID
})
}
}
@ -499,7 +499,7 @@ async function checkAbuseStateChange (options: CheckerBaseParams & {
expect(notification.abuse.state).to.equal(state)
} else {
expect(notification).to.satisfy((n: UserNotification) => {
return n === undefined || n.abuse === undefined || n.abuse.id !== abuseId
return n?.abuse === undefined || n.abuse.id !== abuseId
})
}
}
@ -534,7 +534,7 @@ async function checkNewCommentAbuseForModerators (options: CheckerBaseParams & {
checkVideo(notification.abuse.comment.video, videoName, shortUUID)
} else {
expect(notification).to.satisfy((n: UserNotification) => {
return n === undefined || n.abuse === undefined || n.abuse.comment.video.shortUUID !== shortUUID
return n?.abuse === undefined || n.abuse.comment.video.shortUUID !== shortUUID
})
}
}
@ -563,7 +563,7 @@ async function checkNewAccountAbuseForModerators (options: CheckerBaseParams & {
expect(notification.abuse.account.displayName).to.equal(displayName)
} else {
expect(notification).to.satisfy((n: UserNotification) => {
return n === undefined || n.abuse === undefined || n.abuse.account.displayName !== displayName
return n?.abuse === undefined || n.abuse.account.displayName !== displayName
})
}
}
@ -593,7 +593,7 @@ async function checkVideoAutoBlacklistForModerators (options: CheckerBaseParams
checkVideo(notification.videoBlacklist.video, videoName, shortUUID)
} else {
expect(notification).to.satisfy((n: UserNotification) => {
return n === undefined || n.video === undefined || n.video.shortUUID !== shortUUID
return n?.video === undefined || n.video.shortUUID !== shortUUID
})
}
}
@ -653,7 +653,7 @@ async function checkNewPeerTubeVersion (options: CheckerBaseParams & {
expect(notification.peertube.latestVersion).to.equal(latestVersion)
} else {
expect(notification).to.satisfy((n: UserNotification) => {
return n === undefined || n.peertube === undefined || n.peertube.latestVersion !== latestVersion
return n?.peertube === undefined || n.peertube.latestVersion !== latestVersion
})
}
}
@ -684,7 +684,7 @@ async function checkNewPluginVersion (options: CheckerBaseParams & {
expect(notification.plugin.type).to.equal(pluginType)
} else {
expect(notification).to.satisfy((n: UserNotification) => {
return n === undefined || n.plugin === undefined || n.plugin.name !== pluginName
return n?.plugin === undefined || n.plugin.name !== pluginName
})
}
}

View File

@ -1,5 +1,5 @@
import { ChildProcess, fork, ForkOptions } from 'child_process'
import execa from 'execa'
import { execa } from 'execa'
import { join } from 'path'
import { root } from '@peertube/peertube-node-utils'
import { PeerTubeServer } from '@peertube/peertube-server-commands'

View File

@ -11,7 +11,7 @@ import {
import { AUDIT_LOG_FILENAME } from '@server/initializers/constants.js'
import { diff } from 'deep-object-diff'
import express from 'express'
import flatten from 'flat'
import { flatten } from 'flat'
import { join } from 'path'
import { addColors, config, createLogger, format, transports } from 'winston'
import { CONFIG } from '../initializers/config.js'

View File

@ -1,4 +1,3 @@
import { UploadFilesForCheck } from 'express'
import { CONSTRAINTS_FIELDS } from '../../initializers/constants.js'
import { isFileValid } from './misc.js'

View File

@ -129,7 +129,8 @@ async function createTorrentAndSetInfoHashFromPath (
await remove(join(CONFIG.STORAGE.TORRENTS_DIR, videoFile.torrentFilename))
}
const parsedTorrent = parseTorrent(torrentContent)
// FIXME: typings: parseTorrent now returns an async result
const parsedTorrent = await (parseTorrent(torrentContent) as unknown as Promise<parseTorrent.Instance>)
videoFile.infoHash = parsedTorrent.infoHash
videoFile.torrentFilename = torrentFilename
}

View File

@ -1,4 +1,4 @@
import execa from 'execa'
import { execa, NodeOptions as ExecaNodeOptions } from 'execa'
import { ensureDir, pathExists } from 'fs-extra/esm'
import { writeFile } from 'fs/promises'
import { OptionsOfBufferResponseBody } from 'got'
@ -111,7 +111,7 @@ export class YoutubeDLCLI {
url: string
format: string
output: string
processOptions: execa.NodeOptions
processOptions: ExecaNodeOptions
timeout?: number
additionalYoutubeDLArgs?: string[]
}) {
@ -129,7 +129,7 @@ export class YoutubeDLCLI {
async getInfo (options: {
url: string
format: string
processOptions: execa.NodeOptions
processOptions: ExecaNodeOptions
additionalYoutubeDLArgs?: string[]
}) {
const { url, format, additionalYoutubeDLArgs = [], processOptions } = options
@ -149,7 +149,7 @@ export class YoutubeDLCLI {
async getListInfo (options: {
url: string
latestVideosCount?: number
processOptions: execa.NodeOptions
processOptions: ExecaNodeOptions
}): Promise<{ upload_date: string, webpage_url: string }[]> {
const additionalYoutubeDLArgs = [ '--skip-download', '--playlist-reverse' ]
@ -178,7 +178,7 @@ export class YoutubeDLCLI {
async getSubs (options: {
url: string
format: 'vtt'
processOptions: execa.NodeOptions
processOptions: ExecaNodeOptions
}) {
const { url, format, processOptions } = options
@ -204,7 +204,7 @@ export class YoutubeDLCLI {
url: string
args: string[]
timeout?: number
processOptions: execa.NodeOptions
processOptions: ExecaNodeOptions
}) {
const { url, args, timeout, processOptions } = options

View File

@ -1,4 +1,3 @@
import * as Sequelize from 'sequelize'
async function up (utils: {

View File

@ -1,4 +1,3 @@
import { logger, loggerTagsFactory, LoggerTagsFn } from '@server/helpers/logger.js'
import { sequelizeTypescript } from '@server/initializers/database.js'
import { Hooks } from '@server/lib/plugins/hooks.js'

View File

@ -1,4 +1,3 @@
import { VideoState } from '@peertube/peertube-models'
import { AbstractOwnedVideoPublication } from './abstract-owned-video-publication.js'

View File

@ -10,7 +10,7 @@ async function getProxyRequestHandler () {
const { agent } = getAgent()
const { NodeHttpHandler } = await import('@aws-sdk/node-http-handler')
const { NodeHttpHandler } = await import('@smithy/node-http-handler')
return new NodeHttpHandler({
httpAgent: agent.http,

View File

@ -1,4 +1,3 @@
import {
RunnerJobState,
RunnerJobStateType,

View File

@ -1,4 +1,3 @@
import {
RunnerJobState,
RunnerJobStateType,

View File

@ -5,7 +5,7 @@ export abstract class AbstractScheduler {
protected abstract schedulerIntervalMs: number
private interval: NodeJS.Timer
private interval: NodeJS.Timeout
private isRunning = false
enable () {

View File

@ -1,4 +1,3 @@
import { doJSONRequest } from '@server/helpers/requests.js'
import { ApplicationModel } from '@server/models/application/application.js'
import { compareSemVer } from '@peertube/peertube-core-utils'

View File

@ -1,4 +1,3 @@
import { logger, loggerTagsFactory } from '@server/helpers/logger.js'
import { SCHEDULER_INTERVALS_MS } from '@server/initializers/constants.js'
import { uploadx } from '../uploadx.js'

View File

@ -1,11 +1,10 @@
import ipaddr from 'ipaddr.js'
import isCidr from 'is-cidr'
import { CONFIG } from '../initializers/config.js'
import { UserModel } from '../models/user/user.js'
export type SignupMode = 'direct-registration' | 'request-registration'
async function isSignupAllowed (options: {
export async function isSignupAllowed (options: {
signupMode: SignupMode
ip: string // For plugins
@ -31,7 +30,7 @@ async function isSignupAllowed (options: {
return { allowed: totalUsers < CONFIG.SIGNUP.LIMIT, errorMessage: 'User limit is reached on this instance' }
}
function isSignupAllowedForCurrentIP (ip: string) {
export function isSignupAllowedForCurrentIP (ip: string) {
if (!ip) return false
const addr = ipaddr.parse(ip)
@ -39,25 +38,25 @@ function isSignupAllowedForCurrentIP (ip: string) {
let matched = ''
// if there is a valid, non-empty whitelist, we exclude all unknown addresses too
if (CONFIG.SIGNUP.FILTERS.CIDR.WHITELIST.filter(cidr => isCidr(cidr)).length > 0) {
if (CONFIG.SIGNUP.FILTERS.CIDR.WHITELIST.filter(cidr => isIPV4Cidr(cidr) || isIPV6Cidr(cidr))) {
excludeList.push('unknown')
}
if (addr.kind() === 'ipv4') {
const addrV4 = ipaddr.IPv4.parse(ip)
const rangeList = {
whitelist: CONFIG.SIGNUP.FILTERS.CIDR.WHITELIST.filter(cidr => isCidr.v4(cidr))
whitelist: CONFIG.SIGNUP.FILTERS.CIDR.WHITELIST.filter(cidr => isIPV4Cidr(cidr))
.map(cidr => ipaddr.IPv4.parseCIDR(cidr)),
blacklist: CONFIG.SIGNUP.FILTERS.CIDR.BLACKLIST.filter(cidr => isCidr.v4(cidr))
blacklist: CONFIG.SIGNUP.FILTERS.CIDR.BLACKLIST.filter(cidr => isIPV4Cidr(cidr))
.map(cidr => ipaddr.IPv4.parseCIDR(cidr))
}
matched = ipaddr.subnetMatch(addrV4, rangeList, 'unknown')
} else if (addr.kind() === 'ipv6') {
const addrV6 = ipaddr.IPv6.parse(ip)
const rangeList = {
whitelist: CONFIG.SIGNUP.FILTERS.CIDR.WHITELIST.filter(cidr => isCidr.v6(cidr))
whitelist: CONFIG.SIGNUP.FILTERS.CIDR.WHITELIST.filter(cidr => isIPV6Cidr(cidr))
.map(cidr => ipaddr.IPv6.parseCIDR(cidr)),
blacklist: CONFIG.SIGNUP.FILTERS.CIDR.BLACKLIST.filter(cidr => isCidr.v6(cidr))
blacklist: CONFIG.SIGNUP.FILTERS.CIDR.BLACKLIST.filter(cidr => isIPV6Cidr(cidr))
.map(cidr => ipaddr.IPv6.parseCIDR(cidr))
}
matched = ipaddr.subnetMatch(addrV6, rangeList, 'unknown')
@ -66,9 +65,24 @@ function isSignupAllowedForCurrentIP (ip: string) {
return !excludeList.includes(matched)
}
// ---------------------------------------------------------------------------
// Private
// ---------------------------------------------------------------------------
export {
isSignupAllowed,
isSignupAllowedForCurrentIP
function isIPV4Cidr (cidr: string) {
try {
ipaddr.IPv4.parseCIDR(cidr)
return true
} catch {
return false
}
}
function isIPV6Cidr (cidr: string) {
try {
ipaddr.IPv6.parseCIDR(cidr)
return true
} catch {
return false
}
}

View File

@ -1,4 +1,3 @@
import { logger } from '@server/helpers/logger.js'
import { FFmpegCommandWrapper, getDefaultAvailableEncoders } from '@peertube/peertube-ffmpeg'
import { AvailableEncoders, EncoderOptionsBuilder } from '@peertube/peertube-models'

View File

@ -1,4 +1,3 @@
import { MUserId, MVideoFile, MVideoFullLight } from '@server/types/models/index.js'
export abstract class AbstractJobBuilder {

View File

@ -1,4 +1,3 @@
import { STATIC_PATHS, WEBSERVER } from '@server/initializers/constants.js'
import { MStreamingPlaylist, MVideo, MVideoFile, MVideoUUID } from '@server/types/models/index.js'

View File

@ -1,4 +1,3 @@
import { forceNumber } from '@peertube/peertube-core-utils'
import { AbuseFilter, AbuseStateType, AbuseVideoIs } from '@peertube/peertube-models'
import { exists } from '@server/helpers/custom-validators/misc.js'

View File

@ -1,4 +1,3 @@
/**
*
* Class to build video attributes/join names we want to fetch from the database

5858
yarn.lock

File diff suppressed because it is too large Load Diff