aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
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// ---------------------------------------------------------------------------