aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers')
-rw-r--r--server/helpers/captions-utils.ts2
-rw-r--r--server/helpers/core-utils.ts10
-rw-r--r--server/helpers/custom-jsonld-signature.ts1
-rw-r--r--server/helpers/logger.ts2
-rw-r--r--server/helpers/webtorrent.ts2
-rw-r--r--server/helpers/youtube-dl.ts2
6 files changed, 10 insertions, 9 deletions
diff --git a/server/helpers/captions-utils.ts b/server/helpers/captions-utils.ts
index 0dad23759..7cbfb3561 100644
--- a/server/helpers/captions-utils.ts
+++ b/server/helpers/captions-utils.ts
@@ -30,7 +30,7 @@ export {
30// --------------------------------------------------------------------------- 30// ---------------------------------------------------------------------------
31 31
32function convertSrtToVtt (source: string, destination: string) { 32function convertSrtToVtt (source: string, destination: string) {
33 return new Promise((res, rej) => { 33 return new Promise<void>((res, rej) => {
34 const file = createReadStream(source) 34 const file = createReadStream(source)
35 const converter = srt2vtt() 35 const converter = srt2vtt()
36 const writer = createWriteStream(destination) 36 const writer = createWriteStream(destination)
diff --git a/server/helpers/core-utils.ts b/server/helpers/core-utils.ts
index e1c15a6eb..935fd22d9 100644
--- a/server/helpers/core-utils.ts
+++ b/server/helpers/core-utils.ts
@@ -5,12 +5,12 @@
5 Useful to avoid circular dependencies. 5 Useful to avoid circular dependencies.
6*/ 6*/
7 7
8import { createHash, HexBase64Latin1Encoding, randomBytes } from 'crypto' 8import { exec, ExecOptions } from 'child_process'
9import { BinaryToTextEncoding, createHash, randomBytes } from 'crypto'
10import { truncate } from 'lodash'
9import { basename, isAbsolute, join, resolve } from 'path' 11import { basename, isAbsolute, join, resolve } from 'path'
10import * as pem from 'pem' 12import * as pem from 'pem'
11import { URL } from 'url' 13import { URL } from 'url'
12import { truncate } from 'lodash'
13import { exec, ExecOptions } from 'child_process'
14 14
15const objectConverter = (oldObject: any, keyConverter: (e: string) => string, valueConverter: (e: any) => any) => { 15const objectConverter = (oldObject: any, keyConverter: (e: string) => string, valueConverter: (e: any) => any) => {
16 if (!oldObject || typeof oldObject !== 'object') { 16 if (!oldObject || typeof oldObject !== 'object') {
@@ -205,11 +205,11 @@ function peertubeTruncate (str: string, options: { length: number, separator?: R
205 return truncate(str, options) 205 return truncate(str, options)
206} 206}
207 207
208function sha256 (str: string | Buffer, encoding: HexBase64Latin1Encoding = 'hex') { 208function sha256 (str: string | Buffer, encoding: BinaryToTextEncoding = 'hex') {
209 return createHash('sha256').update(str).digest(encoding) 209 return createHash('sha256').update(str).digest(encoding)
210} 210}
211 211
212function sha1 (str: string | Buffer, encoding: HexBase64Latin1Encoding = 'hex') { 212function sha1 (str: string | Buffer, encoding: BinaryToTextEncoding = 'hex') {
213 return createHash('sha1').update(str).digest(encoding) 213 return createHash('sha1').update(str).digest(encoding)
214} 214}
215 215
diff --git a/server/helpers/custom-jsonld-signature.ts b/server/helpers/custom-jsonld-signature.ts
index 749c50cb3..56f10086c 100644
--- a/server/helpers/custom-jsonld-signature.ts
+++ b/server/helpers/custom-jsonld-signature.ts
@@ -76,6 +76,7 @@ const lru = new AsyncLRU({
76 } 76 }
77}) 77})
78 78
79/* eslint-disable no-import-assign */
79jsonld.documentLoader = (url) => { 80jsonld.documentLoader = (url) => {
80 return new Promise((res, rej) => { 81 return new Promise((res, rej) => {
81 lru.get(url, (err, value) => { 82 lru.get(url, (err, value) => {
diff --git a/server/helpers/logger.ts b/server/helpers/logger.ts
index 746b2e0a6..6917a64d9 100644
--- a/server/helpers/logger.ts
+++ b/server/helpers/logger.ts
@@ -61,7 +61,7 @@ const consoleLoggerFormat = winston.format.printf(info => {
61 if (CONFIG.LOG.PRETTIFY_SQL) { 61 if (CONFIG.LOG.PRETTIFY_SQL) {
62 additionalInfos += '\n' + sqlFormat(info.sql, { 62 additionalInfos += '\n' + sqlFormat(info.sql, {
63 language: 'sql', 63 language: 'sql',
64 ident: ' ' 64 indent: ' '
65 }) 65 })
66 } else { 66 } else {
67 additionalInfos += ' - ' + info.sql 67 additionalInfos += ' - ' + info.sql
diff --git a/server/helpers/webtorrent.ts b/server/helpers/webtorrent.ts
index 089954e32..9c5df2083 100644
--- a/server/helpers/webtorrent.ts
+++ b/server/helpers/webtorrent.ts
@@ -149,7 +149,7 @@ function safeWebtorrentDestroy (
149 downloadedFile?: { directoryPath: string, filepath: string }, 149 downloadedFile?: { directoryPath: string, filepath: string },
150 torrentName?: string 150 torrentName?: string
151) { 151) {
152 return new Promise(res => { 152 return new Promise<void>(res => {
153 webtorrent.destroy(err => { 153 webtorrent.destroy(err => {
154 // Delete torrent file 154 // Delete torrent file
155 if (torrentName) { 155 if (torrentName) {
diff --git a/server/helpers/youtube-dl.ts b/server/helpers/youtube-dl.ts
index 3a9e57561..8537a5772 100644
--- a/server/helpers/youtube-dl.ts
+++ b/server/helpers/youtube-dl.ts
@@ -195,7 +195,7 @@ async function updateYoutubeDLBinary () {
195 195
196 await ensureDir(binDirectory) 196 await ensureDir(binDirectory)
197 197
198 return new Promise(res => { 198 return new Promise<void>(res => {
199 request.get(url, { followRedirect: false }, (err, result) => { 199 request.get(url, { followRedirect: false }, (err, result) => {
200 if (err) { 200 if (err) {
201 logger.error('Cannot update youtube-dl.', { err }) 201 logger.error('Cannot update youtube-dl.', { err })