aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-05-22 17:04:39 +0200
committerChocobozzz <me@florianbigard.com>2023-05-22 17:11:31 +0200
commit83002a823465fe03a8d82833cb2e073a383405a8 (patch)
tree1b28e2d98c192b1be513cc448be301360f33c8ad /server/helpers
parent57c318653e6a8ae9d0c2541a62853fb8dd582d5d (diff)
downloadPeerTube-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.ts4
-rw-r--r--server/helpers/image-utils.ts3
-rw-r--r--server/helpers/webtorrent.ts4
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 @@
1import { UploadFilesForCheck } from 'express' 1import { UploadFilesForCheck } from 'express'
2import magnetUtil from 'magnet-uri' 2import { decode as magnetUriDecode } from 'magnet-uri'
3import validator from 'validator' 3import validator from 'validator'
4import { VideoFilter, VideoInclude, VideoPrivacy, VideoRateType } from '@shared/models' 4import { VideoFilter, VideoInclude, VideoPrivacy, VideoRateType } from '@shared/models'
5import { 5import {
@@ -137,7 +137,7 @@ function isVideoFileSizeValid (value: string) {
137function isVideoMagnetUriValid (value: string) { 137function 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 @@
1import { copy, readFile, remove, rename } from 'fs-extra' 1import { copy, readFile, remove, rename } from 'fs-extra'
2import Jimp, { read as jimpRead } from 'jimp' 2import Jimp, { read as jimpRead } from 'jimp'
3import { join } from 'path' 3import { join } from 'path'
4import { ColorActionName } from '@jimp/plugin-color'
4import { getLowercaseExtension } from '@shared/core-utils' 5import { getLowercaseExtension } from '@shared/core-utils'
5import { buildUUID } from '@shared/extra-utils' 6import { buildUUID } from '@shared/extra-utils'
6import { convertWebPToJPG, generateThumbnailFromVideo, processGIF } from './ffmpeg' 7import { 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 @@
1import { decode, encode } from 'bencode' 1import { decode, encode } from 'bencode'
2import createTorrent from 'create-torrent' 2import createTorrent from 'create-torrent'
3import { createWriteStream, ensureDir, pathExists, readFile, remove, writeFile } from 'fs-extra' 3import { createWriteStream, ensureDir, pathExists, readFile, remove, writeFile } from 'fs-extra'
4import magnetUtil from 'magnet-uri' 4import { encode as magnetUriEncode } from 'magnet-uri'
5import parseTorrent from 'parse-torrent' 5import parseTorrent from 'parse-torrent'
6import { dirname, join } from 'path' 6import { dirname, join } from 'path'
7import { pipeline } from 'stream' 7import { 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// ---------------------------------------------------------------------------