From 83002a823465fe03a8d82833cb2e073a383405a8 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 22 May 2023 17:04:39 +0200 Subject: Update server dependencies --- server/controllers/tracker.ts | 2 +- server/helpers/custom-validators/videos.ts | 4 ++-- server/helpers/image-utils.ts | 3 ++- server/helpers/webtorrent.ts | 4 ++-- server/lib/activitypub/videos/shared/object-to-model-attributes.ts | 4 ++-- server/lib/auth/tokens-cache.ts | 2 +- server/lib/local-actor.ts | 2 +- server/lib/video-tokens-manager.ts | 2 +- server/middlewares/validators/static.ts | 2 +- server/tests/api/check-params/upload-quota.ts | 2 +- server/tests/api/redundancy/redundancy.ts | 4 ++-- server/tests/api/server/tracker.ts | 6 +++--- server/tests/peertube-runner/vod-transcoding.ts | 2 +- server/tests/shared/mock-servers/mock-proxy.ts | 4 ++-- 14 files changed, 22 insertions(+), 21 deletions(-) (limited to 'server') diff --git a/server/controllers/tracker.ts b/server/controllers/tracker.ts index c4f3a8889..53eab73ac 100644 --- a/server/controllers/tracker.ts +++ b/server/controllers/tracker.ts @@ -1,7 +1,7 @@ import { Server as TrackerServer } from 'bittorrent-tracker' import express from 'express' import { createServer } from 'http' -import LRUCache from 'lru-cache' +import { LRUCache } from 'lru-cache' import proxyAddr from 'proxy-addr' import { WebSocketServer } from 'ws' import { logger } from '../helpers/logger' diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.ts index 9e8177f77..5f75ec27c 100644 --- a/server/helpers/custom-validators/videos.ts +++ b/server/helpers/custom-validators/videos.ts @@ -1,5 +1,5 @@ import { UploadFilesForCheck } from 'express' -import magnetUtil from 'magnet-uri' +import { decode as magnetUriDecode } from 'magnet-uri' import validator from 'validator' import { VideoFilter, VideoInclude, VideoPrivacy, VideoRateType } from '@shared/models' import { @@ -137,7 +137,7 @@ function isVideoFileSizeValid (value: string) { function isVideoMagnetUriValid (value: string) { if (!exists(value)) return false - const parsed = magnetUtil.decode(value) + const parsed = magnetUriDecode(value) return parsed && isVideoFileInfoHashValid(parsed.infoHash) } diff --git a/server/helpers/image-utils.ts b/server/helpers/image-utils.ts index 05b258d8a..f86f7216d 100644 --- a/server/helpers/image-utils.ts +++ b/server/helpers/image-utils.ts @@ -1,6 +1,7 @@ import { copy, readFile, remove, rename } from 'fs-extra' import Jimp, { read as jimpRead } from 'jimp' import { join } from 'path' +import { ColorActionName } from '@jimp/plugin-color' import { getLowercaseExtension } from '@shared/core-utils' import { buildUUID } from '@shared/extra-utils' import { convertWebPToJPG, generateThumbnailFromVideo, processGIF } from './ffmpeg' @@ -131,7 +132,7 @@ async function autoResize (options: { if (sourceIsPortrait && !destIsPortraitOrSquare) { const baseImage = sourceImage.cloneQuiet().cover(newSize.width, newSize.height) - .color([ { apply: 'shade', params: [ 50 ] } ]) + .color([ { apply: ColorActionName.SHADE, params: [ 50 ] } ]) const topImage = sourceImage.cloneQuiet().contain(newSize.width, newSize.height) diff --git a/server/helpers/webtorrent.ts b/server/helpers/webtorrent.ts index e690e3890..f33a7bccd 100644 --- a/server/helpers/webtorrent.ts +++ b/server/helpers/webtorrent.ts @@ -1,7 +1,7 @@ import { decode, encode } from 'bencode' import createTorrent from 'create-torrent' import { createWriteStream, ensureDir, pathExists, readFile, remove, writeFile } from 'fs-extra' -import magnetUtil from 'magnet-uri' +import { encode as magnetUriEncode } from 'magnet-uri' import parseTorrent from 'parse-torrent' import { dirname, join } from 'path' import { pipeline } from 'stream' @@ -185,7 +185,7 @@ function generateMagnetUri ( name: video.name } - return magnetUtil.encode(magnetHash) + return magnetUriEncode(magnetHash) } // --------------------------------------------------------------------------- diff --git a/server/lib/activitypub/videos/shared/object-to-model-attributes.ts b/server/lib/activitypub/videos/shared/object-to-model-attributes.ts index 86699c5b8..8fd0a816c 100644 --- a/server/lib/activitypub/videos/shared/object-to-model-attributes.ts +++ b/server/lib/activitypub/videos/shared/object-to-model-attributes.ts @@ -1,5 +1,5 @@ import { maxBy, minBy } from 'lodash' -import magnetUtil from 'magnet-uri' +import { decode as magnetUriDecode } from 'magnet-uri' import { basename } from 'path' import { isAPVideoFileUrlMetadataObject } from '@server/helpers/custom-validators/activitypub/videos' import { isVideoFileInfoHashValid } from '@server/helpers/custom-validators/videos' @@ -62,7 +62,7 @@ function getFileAttributesFromUrl ( if (!magnet) throw new Error('Cannot find associated magnet uri for file ' + fileUrl.href) - const parsed = magnetUtil.decode(magnet.href) + const parsed = magnetUriDecode(magnet.href) if (!parsed || isVideoFileInfoHashValid(parsed.infoHash) === false) { throw new Error('Cannot parse magnet URI ' + magnet.href) } diff --git a/server/lib/auth/tokens-cache.ts b/server/lib/auth/tokens-cache.ts index 43efc7d02..e7b12159b 100644 --- a/server/lib/auth/tokens-cache.ts +++ b/server/lib/auth/tokens-cache.ts @@ -1,4 +1,4 @@ -import LRUCache from 'lru-cache' +import { LRUCache } from 'lru-cache' import { MOAuthTokenUser } from '@server/types/models' import { LRU_CACHE } from '../../initializers/constants' diff --git a/server/lib/local-actor.ts b/server/lib/local-actor.ts index 8c10ed700..16dc265a3 100644 --- a/server/lib/local-actor.ts +++ b/server/lib/local-actor.ts @@ -1,5 +1,5 @@ import { remove } from 'fs-extra' -import LRUCache from 'lru-cache' +import { LRUCache } from 'lru-cache' import { join } from 'path' import { Transaction } from 'sequelize/types' import { ActorModel } from '@server/models/actor/actor' diff --git a/server/lib/video-tokens-manager.ts b/server/lib/video-tokens-manager.ts index 17aa29cdd..660533528 100644 --- a/server/lib/video-tokens-manager.ts +++ b/server/lib/video-tokens-manager.ts @@ -1,4 +1,4 @@ -import LRUCache from 'lru-cache' +import { LRUCache } from 'lru-cache' import { LRU_CACHE } from '@server/initializers/constants' import { MUserAccountUrl } from '@server/types/models' import { pick } from '@shared/core-utils' diff --git a/server/middlewares/validators/static.ts b/server/middlewares/validators/static.ts index 45d56bcd6..9c2d890ba 100644 --- a/server/middlewares/validators/static.ts +++ b/server/middlewares/validators/static.ts @@ -1,6 +1,6 @@ import express from 'express' import { query } from 'express-validator' -import LRUCache from 'lru-cache' +import { LRUCache } from 'lru-cache' import { basename, dirname } from 'path' import { exists, isSafePeerTubeFilenameWithoutExtension, isUUIDValid, toBooleanOrNull } from '@server/helpers/custom-validators/misc' import { logger } from '@server/helpers/logger' diff --git a/server/tests/api/check-params/upload-quota.ts b/server/tests/api/check-params/upload-quota.ts index 008537524..06698c056 100644 --- a/server/tests/api/check-params/upload-quota.ts +++ b/server/tests/api/check-params/upload-quota.ts @@ -54,7 +54,7 @@ describe('Test upload quota', function () { }) it('Should fail with a registered user having too many videos with resumable upload', async function () { - this.timeout(30000) + this.timeout(120000) const user = { username: 'registered' + randomInt(1, 1500), password: 'password' } await server.registrations.register(user) diff --git a/server/tests/api/redundancy/redundancy.ts b/server/tests/api/redundancy/redundancy.ts index 57939775e..5262c503f 100644 --- a/server/tests/api/redundancy/redundancy.ts +++ b/server/tests/api/redundancy/redundancy.ts @@ -2,7 +2,7 @@ import { expect } from 'chai' import { readdir } from 'fs-extra' -import magnetUtil from 'magnet-uri' +import { decode as magnetUriDecode } from 'magnet-uri' import { basename, join } from 'path' import { checkSegmentHash, checkVideoFilesWereRemoved, saveVideoInServers } from '@server/tests/shared' import { wait } from '@shared/core-utils' @@ -29,7 +29,7 @@ let servers: PeerTubeServer[] = [] let video1Server2: VideoDetails async function checkMagnetWebseeds (file: VideoFile, baseWebseeds: string[], server: PeerTubeServer) { - const parsed = magnetUtil.decode(file.magnetUri) + const parsed = magnetUriDecode(file.magnetUri) for (const ws of baseWebseeds) { const found = parsed.urlList.find(url => url === `${ws}${basename(file.fileUrl)}`) diff --git a/server/tests/api/server/tracker.ts b/server/tests/api/server/tracker.ts index 34d450998..a0ce2ca35 100644 --- a/server/tests/api/server/tracker.ts +++ b/server/tests/api/server/tracker.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await,@typescript-eslint/no-floating-promises */ -import magnetUtil from 'magnet-uri' +import { decode as magnetUriDecode, encode as magnetUriEncode } from 'magnet-uri' import WebTorrent from 'webtorrent' import { cleanupTests, createSingleServer, killallServers, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' @@ -19,10 +19,10 @@ describe('Test tracker', function () { const video = await server.videos.get({ id: uuid }) goodMagnet = video.files[0].magnetUri - const parsed = magnetUtil.decode(goodMagnet) + const parsed = magnetUriDecode(goodMagnet) parsed.infoHash = '010597bb88b1968a5693a4fa8267c592ca65f2e9' - badMagnet = magnetUtil.encode(parsed) + badMagnet = magnetUriEncode(parsed) } }) diff --git a/server/tests/peertube-runner/vod-transcoding.ts b/server/tests/peertube-runner/vod-transcoding.ts index f1670c1fb..dc505baab 100644 --- a/server/tests/peertube-runner/vod-transcoding.ts +++ b/server/tests/peertube-runner/vod-transcoding.ts @@ -189,7 +189,7 @@ describe('Test VOD transcoding in peertube-runner program', function () { }) it('Should transcode videos on manual run', async function () { - this.timeout(360000) + this.timeout(120000) await servers[0].config.disableTranscoding() diff --git a/server/tests/shared/mock-servers/mock-proxy.ts b/server/tests/shared/mock-servers/mock-proxy.ts index cbc7c4466..e741d6735 100644 --- a/server/tests/shared/mock-servers/mock-proxy.ts +++ b/server/tests/shared/mock-servers/mock-proxy.ts @@ -1,5 +1,5 @@ import { createServer, Server } from 'http' -import proxy from 'proxy' +import { createProxy } from 'proxy' import { getPort, terminateServer } from './shared' class MockProxy { @@ -7,7 +7,7 @@ class MockProxy { initialize () { return new Promise(res => { - this.server = proxy(createServer()) + this.server = createProxy(createServer()) this.server.listen(0, () => res(getPort(this.server))) }) } -- cgit v1.2.3