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/helpers | |
parent | 57c318653e6a8ae9d0c2541a62853fb8dd582d5d (diff) | |
download | PeerTube-83002a823465fe03a8d82833cb2e073a383405a8.tar.gz PeerTube-83002a823465fe03a8d82833cb2e073a383405a8.tar.zst PeerTube-83002a823465fe03a8d82833cb2e073a383405a8.zip |
Update server dependencies
Diffstat (limited to 'server/helpers')
-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 |
3 files changed, 6 insertions, 5 deletions
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 | // --------------------------------------------------------------------------- |