diff options
author | Chocobozzz <me@florianbigard.com> | 2023-05-22 17:04:39 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-05-22 17:11:31 +0200 |
commit | 83002a823465fe03a8d82833cb2e073a383405a8 (patch) | |
tree | 1b28e2d98c192b1be513cc448be301360f33c8ad /server | |
parent | 57c318653e6a8ae9d0c2541a62853fb8dd582d5d (diff) | |
download | PeerTube-83002a823465fe03a8d82833cb2e073a383405a8.tar.gz PeerTube-83002a823465fe03a8d82833cb2e073a383405a8.tar.zst PeerTube-83002a823465fe03a8d82833cb2e073a383405a8.zip |
Update server dependencies
Diffstat (limited to 'server')
-rw-r--r-- | server/controllers/tracker.ts | 2 | ||||
-rw-r--r-- | server/helpers/custom-validators/videos.ts | 4 | ||||
-rw-r--r-- | server/helpers/image-utils.ts | 3 | ||||
-rw-r--r-- | server/helpers/webtorrent.ts | 4 | ||||
-rw-r--r-- | server/lib/activitypub/videos/shared/object-to-model-attributes.ts | 4 | ||||
-rw-r--r-- | server/lib/auth/tokens-cache.ts | 2 | ||||
-rw-r--r-- | server/lib/local-actor.ts | 2 | ||||
-rw-r--r-- | server/lib/video-tokens-manager.ts | 2 | ||||
-rw-r--r-- | server/middlewares/validators/static.ts | 2 | ||||
-rw-r--r-- | server/tests/api/check-params/upload-quota.ts | 2 | ||||
-rw-r--r-- | server/tests/api/redundancy/redundancy.ts | 4 | ||||
-rw-r--r-- | server/tests/api/server/tracker.ts | 6 | ||||
-rw-r--r-- | server/tests/peertube-runner/vod-transcoding.ts | 2 | ||||
-rw-r--r-- | server/tests/shared/mock-servers/mock-proxy.ts | 4 |
14 files changed, 22 insertions, 21 deletions
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 @@ | |||
1 | import { Server as TrackerServer } from 'bittorrent-tracker' | 1 | import { Server as TrackerServer } from 'bittorrent-tracker' |
2 | import express from 'express' | 2 | import express from 'express' |
3 | import { createServer } from 'http' | 3 | import { createServer } from 'http' |
4 | import LRUCache from 'lru-cache' | 4 | import { LRUCache } from 'lru-cache' |
5 | import proxyAddr from 'proxy-addr' | 5 | import proxyAddr from 'proxy-addr' |
6 | import { WebSocketServer } from 'ws' | 6 | import { WebSocketServer } from 'ws' |
7 | import { logger } from '../helpers/logger' | 7 | 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 @@ | |||
1 | import { UploadFilesForCheck } from 'express' | 1 | import { UploadFilesForCheck } from 'express' |
2 | import magnetUtil from 'magnet-uri' | 2 | import { decode as magnetUriDecode } from 'magnet-uri' |
3 | import validator from 'validator' | 3 | import validator from 'validator' |
4 | import { VideoFilter, VideoInclude, VideoPrivacy, VideoRateType } from '@shared/models' | 4 | import { VideoFilter, VideoInclude, VideoPrivacy, VideoRateType } from '@shared/models' |
5 | import { | 5 | import { |
@@ -137,7 +137,7 @@ function isVideoFileSizeValid (value: string) { | |||
137 | function isVideoMagnetUriValid (value: string) { | 137 | function isVideoMagnetUriValid (value: string) { |
138 | if (!exists(value)) return false | 138 | if (!exists(value)) return false |
139 | 139 | ||
140 | const parsed = magnetUtil.decode(value) | 140 | const parsed = magnetUriDecode(value) |
141 | return parsed && isVideoFileInfoHashValid(parsed.infoHash) | 141 | return parsed && isVideoFileInfoHashValid(parsed.infoHash) |
142 | } | 142 | } |
143 | 143 | ||
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 @@ | |||
1 | import { copy, readFile, remove, rename } from 'fs-extra' | 1 | import { copy, readFile, remove, rename } from 'fs-extra' |
2 | import Jimp, { read as jimpRead } from 'jimp' | 2 | import Jimp, { read as jimpRead } from 'jimp' |
3 | import { join } from 'path' | 3 | import { join } from 'path' |
4 | import { ColorActionName } from '@jimp/plugin-color' | ||
4 | import { getLowercaseExtension } from '@shared/core-utils' | 5 | import { getLowercaseExtension } from '@shared/core-utils' |
5 | import { buildUUID } from '@shared/extra-utils' | 6 | import { buildUUID } from '@shared/extra-utils' |
6 | import { convertWebPToJPG, generateThumbnailFromVideo, processGIF } from './ffmpeg' | 7 | import { convertWebPToJPG, generateThumbnailFromVideo, processGIF } from './ffmpeg' |
@@ -131,7 +132,7 @@ async function autoResize (options: { | |||
131 | 132 | ||
132 | if (sourceIsPortrait && !destIsPortraitOrSquare) { | 133 | if (sourceIsPortrait && !destIsPortraitOrSquare) { |
133 | const baseImage = sourceImage.cloneQuiet().cover(newSize.width, newSize.height) | 134 | const baseImage = sourceImage.cloneQuiet().cover(newSize.width, newSize.height) |
134 | .color([ { apply: 'shade', params: [ 50 ] } ]) | 135 | .color([ { apply: ColorActionName.SHADE, params: [ 50 ] } ]) |
135 | 136 | ||
136 | const topImage = sourceImage.cloneQuiet().contain(newSize.width, newSize.height) | 137 | const topImage = sourceImage.cloneQuiet().contain(newSize.width, newSize.height) |
137 | 138 | ||
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 @@ | |||
1 | import { decode, encode } from 'bencode' | 1 | import { decode, encode } from 'bencode' |
2 | import createTorrent from 'create-torrent' | 2 | import createTorrent from 'create-torrent' |
3 | import { createWriteStream, ensureDir, pathExists, readFile, remove, writeFile } from 'fs-extra' | 3 | import { createWriteStream, ensureDir, pathExists, readFile, remove, writeFile } from 'fs-extra' |
4 | import magnetUtil from 'magnet-uri' | 4 | import { encode as magnetUriEncode } from 'magnet-uri' |
5 | import parseTorrent from 'parse-torrent' | 5 | import parseTorrent from 'parse-torrent' |
6 | import { dirname, join } from 'path' | 6 | import { dirname, join } from 'path' |
7 | import { pipeline } from 'stream' | 7 | import { pipeline } from 'stream' |
@@ -185,7 +185,7 @@ function generateMagnetUri ( | |||
185 | name: video.name | 185 | name: video.name |
186 | } | 186 | } |
187 | 187 | ||
188 | return magnetUtil.encode(magnetHash) | 188 | return magnetUriEncode(magnetHash) |
189 | } | 189 | } |
190 | 190 | ||
191 | // --------------------------------------------------------------------------- | 191 | // --------------------------------------------------------------------------- |
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 @@ | |||
1 | import { maxBy, minBy } from 'lodash' | 1 | import { maxBy, minBy } from 'lodash' |
2 | import magnetUtil from 'magnet-uri' | 2 | import { decode as magnetUriDecode } from 'magnet-uri' |
3 | import { basename } from 'path' | 3 | import { basename } from 'path' |
4 | import { isAPVideoFileUrlMetadataObject } from '@server/helpers/custom-validators/activitypub/videos' | 4 | import { isAPVideoFileUrlMetadataObject } from '@server/helpers/custom-validators/activitypub/videos' |
5 | import { isVideoFileInfoHashValid } from '@server/helpers/custom-validators/videos' | 5 | import { isVideoFileInfoHashValid } from '@server/helpers/custom-validators/videos' |
@@ -62,7 +62,7 @@ function getFileAttributesFromUrl ( | |||
62 | 62 | ||
63 | if (!magnet) throw new Error('Cannot find associated magnet uri for file ' + fileUrl.href) | 63 | if (!magnet) throw new Error('Cannot find associated magnet uri for file ' + fileUrl.href) |
64 | 64 | ||
65 | const parsed = magnetUtil.decode(magnet.href) | 65 | const parsed = magnetUriDecode(magnet.href) |
66 | if (!parsed || isVideoFileInfoHashValid(parsed.infoHash) === false) { | 66 | if (!parsed || isVideoFileInfoHashValid(parsed.infoHash) === false) { |
67 | throw new Error('Cannot parse magnet URI ' + magnet.href) | 67 | throw new Error('Cannot parse magnet URI ' + magnet.href) |
68 | } | 68 | } |
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 @@ | |||
1 | import LRUCache from 'lru-cache' | 1 | import { LRUCache } from 'lru-cache' |
2 | import { MOAuthTokenUser } from '@server/types/models' | 2 | import { MOAuthTokenUser } from '@server/types/models' |
3 | import { LRU_CACHE } from '../../initializers/constants' | 3 | import { LRU_CACHE } from '../../initializers/constants' |
4 | 4 | ||
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 @@ | |||
1 | import { remove } from 'fs-extra' | 1 | import { remove } from 'fs-extra' |
2 | import LRUCache from 'lru-cache' | 2 | import { LRUCache } from 'lru-cache' |
3 | import { join } from 'path' | 3 | import { join } from 'path' |
4 | import { Transaction } from 'sequelize/types' | 4 | import { Transaction } from 'sequelize/types' |
5 | import { ActorModel } from '@server/models/actor/actor' | 5 | 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 @@ | |||
1 | import LRUCache from 'lru-cache' | 1 | import { LRUCache } from 'lru-cache' |
2 | import { LRU_CACHE } from '@server/initializers/constants' | 2 | import { LRU_CACHE } from '@server/initializers/constants' |
3 | import { MUserAccountUrl } from '@server/types/models' | 3 | import { MUserAccountUrl } from '@server/types/models' |
4 | import { pick } from '@shared/core-utils' | 4 | 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 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { query } from 'express-validator' | 2 | import { query } from 'express-validator' |
3 | import LRUCache from 'lru-cache' | 3 | import { LRUCache } from 'lru-cache' |
4 | import { basename, dirname } from 'path' | 4 | import { basename, dirname } from 'path' |
5 | import { exists, isSafePeerTubeFilenameWithoutExtension, isUUIDValid, toBooleanOrNull } from '@server/helpers/custom-validators/misc' | 5 | import { exists, isSafePeerTubeFilenameWithoutExtension, isUUIDValid, toBooleanOrNull } from '@server/helpers/custom-validators/misc' |
6 | import { logger } from '@server/helpers/logger' | 6 | 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 () { | |||
54 | }) | 54 | }) |
55 | 55 | ||
56 | it('Should fail with a registered user having too many videos with resumable upload', async function () { | 56 | it('Should fail with a registered user having too many videos with resumable upload', async function () { |
57 | this.timeout(30000) | 57 | this.timeout(120000) |
58 | 58 | ||
59 | const user = { username: 'registered' + randomInt(1, 1500), password: 'password' } | 59 | const user = { username: 'registered' + randomInt(1, 1500), password: 'password' } |
60 | await server.registrations.register(user) | 60 | 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 @@ | |||
2 | 2 | ||
3 | import { expect } from 'chai' | 3 | import { expect } from 'chai' |
4 | import { readdir } from 'fs-extra' | 4 | import { readdir } from 'fs-extra' |
5 | import magnetUtil from 'magnet-uri' | 5 | import { decode as magnetUriDecode } from 'magnet-uri' |
6 | import { basename, join } from 'path' | 6 | import { basename, join } from 'path' |
7 | import { checkSegmentHash, checkVideoFilesWereRemoved, saveVideoInServers } from '@server/tests/shared' | 7 | import { checkSegmentHash, checkVideoFilesWereRemoved, saveVideoInServers } from '@server/tests/shared' |
8 | import { wait } from '@shared/core-utils' | 8 | import { wait } from '@shared/core-utils' |
@@ -29,7 +29,7 @@ let servers: PeerTubeServer[] = [] | |||
29 | let video1Server2: VideoDetails | 29 | let video1Server2: VideoDetails |
30 | 30 | ||
31 | async function checkMagnetWebseeds (file: VideoFile, baseWebseeds: string[], server: PeerTubeServer) { | 31 | async function checkMagnetWebseeds (file: VideoFile, baseWebseeds: string[], server: PeerTubeServer) { |
32 | const parsed = magnetUtil.decode(file.magnetUri) | 32 | const parsed = magnetUriDecode(file.magnetUri) |
33 | 33 | ||
34 | for (const ws of baseWebseeds) { | 34 | for (const ws of baseWebseeds) { |
35 | const found = parsed.urlList.find(url => url === `${ws}${basename(file.fileUrl)}`) | 35 | 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 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await,@typescript-eslint/no-floating-promises */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await,@typescript-eslint/no-floating-promises */ |
2 | 2 | ||
3 | import magnetUtil from 'magnet-uri' | 3 | import { decode as magnetUriDecode, encode as magnetUriEncode } from 'magnet-uri' |
4 | import WebTorrent from 'webtorrent' | 4 | import WebTorrent from 'webtorrent' |
5 | import { cleanupTests, createSingleServer, killallServers, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' | 5 | import { cleanupTests, createSingleServer, killallServers, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' |
6 | 6 | ||
@@ -19,10 +19,10 @@ describe('Test tracker', function () { | |||
19 | const video = await server.videos.get({ id: uuid }) | 19 | const video = await server.videos.get({ id: uuid }) |
20 | goodMagnet = video.files[0].magnetUri | 20 | goodMagnet = video.files[0].magnetUri |
21 | 21 | ||
22 | const parsed = magnetUtil.decode(goodMagnet) | 22 | const parsed = magnetUriDecode(goodMagnet) |
23 | parsed.infoHash = '010597bb88b1968a5693a4fa8267c592ca65f2e9' | 23 | parsed.infoHash = '010597bb88b1968a5693a4fa8267c592ca65f2e9' |
24 | 24 | ||
25 | badMagnet = magnetUtil.encode(parsed) | 25 | badMagnet = magnetUriEncode(parsed) |
26 | } | 26 | } |
27 | }) | 27 | }) |
28 | 28 | ||
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 () { | |||
189 | }) | 189 | }) |
190 | 190 | ||
191 | it('Should transcode videos on manual run', async function () { | 191 | it('Should transcode videos on manual run', async function () { |
192 | this.timeout(360000) | 192 | this.timeout(120000) |
193 | 193 | ||
194 | await servers[0].config.disableTranscoding() | 194 | await servers[0].config.disableTranscoding() |
195 | 195 | ||
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 @@ | |||
1 | import { createServer, Server } from 'http' | 1 | import { createServer, Server } from 'http' |
2 | import proxy from 'proxy' | 2 | import { createProxy } from 'proxy' |
3 | import { getPort, terminateServer } from './shared' | 3 | import { getPort, terminateServer } from './shared' |
4 | 4 | ||
5 | class MockProxy { | 5 | class MockProxy { |
@@ -7,7 +7,7 @@ class MockProxy { | |||
7 | 7 | ||
8 | initialize () { | 8 | initialize () { |
9 | return new Promise<number>(res => { | 9 | return new Promise<number>(res => { |
10 | this.server = proxy(createServer()) | 10 | this.server = createProxy(createServer()) |
11 | this.server.listen(0, () => res(getPort(this.server))) | 11 | this.server.listen(0, () => res(getPort(this.server))) |
12 | }) | 12 | }) |
13 | } | 13 | } |