diff options
author | Chocobozzz <me@florianbigard.com> | 2022-08-17 15:36:03 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-08-17 15:36:03 +0200 |
commit | 690bb8f9f3413147a4f71d5ff0a3cd8170a94ce3 (patch) | |
tree | b16b8536acd2098aba8c1d6fe13a336dd6aa01a9 /server/lib | |
parent | bbd5aa7ead5f1554a0872963f957effc26d8c630 (diff) | |
download | PeerTube-690bb8f9f3413147a4f71d5ff0a3cd8170a94ce3.tar.gz PeerTube-690bb8f9f3413147a4f71d5ff0a3cd8170a94ce3.tar.zst PeerTube-690bb8f9f3413147a4f71d5ff0a3cd8170a94ce3.zip |
Prefer using Object.values
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/emailer.ts | 5 | ||||
-rw-r--r-- | server/lib/hls.ts | 7 |
2 files changed, 6 insertions, 6 deletions
diff --git a/server/lib/emailer.ts b/server/lib/emailer.ts index 3cdba5c76..39b662eb2 100644 --- a/server/lib/emailer.ts +++ b/server/lib/emailer.ts | |||
@@ -2,8 +2,7 @@ import { readFileSync } from 'fs-extra' | |||
2 | import { merge } from 'lodash' | 2 | import { merge } from 'lodash' |
3 | import { createTransport, Transporter } from 'nodemailer' | 3 | import { createTransport, Transporter } from 'nodemailer' |
4 | import { join } from 'path' | 4 | import { join } from 'path' |
5 | import { toArray } from '@server/helpers/custom-validators/misc' | 5 | import { arrayify, root } from '@shared/core-utils' |
6 | import { root } from '@shared/core-utils' | ||
7 | import { EmailPayload } from '@shared/models' | 6 | import { EmailPayload } from '@shared/models' |
8 | import { SendEmailDefaultOptions } from '../../shared/models/server/emailer.model' | 7 | import { SendEmailDefaultOptions } from '../../shared/models/server/emailer.model' |
9 | import { isTestOrDevInstance } from '../helpers/core-utils' | 8 | import { isTestOrDevInstance } from '../helpers/core-utils' |
@@ -159,7 +158,7 @@ class Emailer { | |||
159 | subjectPrefix: CONFIG.EMAIL.SUBJECT.PREFIX | 158 | subjectPrefix: CONFIG.EMAIL.SUBJECT.PREFIX |
160 | }) | 159 | }) |
161 | 160 | ||
162 | const toEmails = toArray(options.to) | 161 | const toEmails = arrayify(options.to) |
163 | 162 | ||
164 | for (const to of toEmails) { | 163 | for (const to of toEmails) { |
165 | const baseOptions: SendEmailDefaultOptions = { | 164 | const baseOptions: SendEmailDefaultOptions = { |
diff --git a/server/lib/hls.ts b/server/lib/hls.ts index 9ec931b4f..a0a5afc0f 100644 --- a/server/lib/hls.ts +++ b/server/lib/hls.ts | |||
@@ -1,8 +1,9 @@ | |||
1 | import { close, ensureDir, move, open, outputJSON, read, readFile, remove, stat, writeFile } from 'fs-extra' | 1 | import { close, ensureDir, move, open, outputJSON, read, readFile, remove, stat, writeFile } from 'fs-extra' |
2 | import { flatten, uniq } from 'lodash' | 2 | import { flatten } from 'lodash' |
3 | import PQueue from 'p-queue' | 3 | import PQueue from 'p-queue' |
4 | import { basename, dirname, join } from 'path' | 4 | import { basename, dirname, join } from 'path' |
5 | import { MStreamingPlaylist, MStreamingPlaylistFilesVideo, MVideo } from '@server/types/models' | 5 | import { MStreamingPlaylist, MStreamingPlaylistFilesVideo, MVideo } from '@server/types/models' |
6 | import { uniqify } from '@shared/core-utils' | ||
6 | import { sha256 } from '@shared/extra-utils' | 7 | import { sha256 } from '@shared/extra-utils' |
7 | import { VideoStorage } from '@shared/models' | 8 | import { VideoStorage } from '@shared/models' |
8 | import { getAudioStreamCodec, getVideoStreamCodec, getVideoStreamDimensionsInfo } from '../helpers/ffmpeg' | 9 | import { getAudioStreamCodec, getVideoStreamCodec, getVideoStreamDimensionsInfo } from '../helpers/ffmpeg' |
@@ -182,7 +183,7 @@ function downloadPlaylistSegments (playlistUrl: string, destinationDir: string, | |||
182 | const subPlaylistUrls = await fetchUniqUrls(playlistUrl) | 183 | const subPlaylistUrls = await fetchUniqUrls(playlistUrl) |
183 | 184 | ||
184 | const subRequests = subPlaylistUrls.map(u => fetchUniqUrls(u)) | 185 | const subRequests = subPlaylistUrls.map(u => fetchUniqUrls(u)) |
185 | const fileUrls = uniq(flatten(await Promise.all(subRequests))) | 186 | const fileUrls = uniqify(flatten(await Promise.all(subRequests))) |
186 | 187 | ||
187 | logger.debug('Will download %d HLS files.', fileUrls.length, { fileUrls }) | 188 | logger.debug('Will download %d HLS files.', fileUrls.length, { fileUrls }) |
188 | 189 | ||
@@ -227,7 +228,7 @@ function downloadPlaylistSegments (playlistUrl: string, destinationDir: string, | |||
227 | return `${dirname(playlistUrl)}/${url}` | 228 | return `${dirname(playlistUrl)}/${url}` |
228 | }) | 229 | }) |
229 | 230 | ||
230 | return uniq(urls) | 231 | return uniqify(urls) |
231 | } | 232 | } |
232 | } | 233 | } |
233 | 234 | ||