From ba5a8d89bbf049e4afc41543bcc072cccdb02669 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 3 Feb 2021 09:33:05 +0100 Subject: Update server dependencies --- server/helpers/captions-utils.ts | 2 +- server/helpers/core-utils.ts | 10 +++++----- server/helpers/custom-jsonld-signature.ts | 1 + server/helpers/logger.ts | 2 +- server/helpers/webtorrent.ts | 2 +- server/helpers/youtube-dl.ts | 2 +- 6 files changed, 10 insertions(+), 9 deletions(-) (limited to 'server/helpers') 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 { // --------------------------------------------------------------------------- function convertSrtToVtt (source: string, destination: string) { - return new Promise((res, rej) => { + return new Promise((res, rej) => { const file = createReadStream(source) const converter = srt2vtt() 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 @@ Useful to avoid circular dependencies. */ -import { createHash, HexBase64Latin1Encoding, randomBytes } from 'crypto' +import { exec, ExecOptions } from 'child_process' +import { BinaryToTextEncoding, createHash, randomBytes } from 'crypto' +import { truncate } from 'lodash' import { basename, isAbsolute, join, resolve } from 'path' import * as pem from 'pem' import { URL } from 'url' -import { truncate } from 'lodash' -import { exec, ExecOptions } from 'child_process' const objectConverter = (oldObject: any, keyConverter: (e: string) => string, valueConverter: (e: any) => any) => { if (!oldObject || typeof oldObject !== 'object') { @@ -205,11 +205,11 @@ function peertubeTruncate (str: string, options: { length: number, separator?: R return truncate(str, options) } -function sha256 (str: string | Buffer, encoding: HexBase64Latin1Encoding = 'hex') { +function sha256 (str: string | Buffer, encoding: BinaryToTextEncoding = 'hex') { return createHash('sha256').update(str).digest(encoding) } -function sha1 (str: string | Buffer, encoding: HexBase64Latin1Encoding = 'hex') { +function sha1 (str: string | Buffer, encoding: BinaryToTextEncoding = 'hex') { return createHash('sha1').update(str).digest(encoding) } 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({ } }) +/* eslint-disable no-import-assign */ jsonld.documentLoader = (url) => { return new Promise((res, rej) => { 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 => { if (CONFIG.LOG.PRETTIFY_SQL) { additionalInfos += '\n' + sqlFormat(info.sql, { language: 'sql', - ident: ' ' + indent: ' ' }) } else { 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 ( downloadedFile?: { directoryPath: string, filepath: string }, torrentName?: string ) { - return new Promise(res => { + return new Promise(res => { webtorrent.destroy(err => { // Delete torrent file 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 () { await ensureDir(binDirectory) - return new Promise(res => { + return new Promise(res => { request.get(url, { followRedirect: false }, (err, result) => { if (err) { logger.error('Cannot update youtube-dl.', { err }) -- cgit v1.2.3