diff options
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 | // --------------------------------------------------------------------------- |