diff options
Diffstat (limited to 'server/helpers')
-rw-r--r-- | server/helpers/core-utils.ts | 8 | ||||
-rw-r--r-- | server/helpers/custom-validators/video-channels.ts | 4 | ||||
-rw-r--r-- | server/helpers/peertube-crypto.ts | 9 |
3 files changed, 12 insertions, 9 deletions
diff --git a/server/helpers/core-utils.ts b/server/helpers/core-utils.ts index c5b139378..64818d036 100644 --- a/server/helpers/core-utils.ts +++ b/server/helpers/core-utils.ts | |||
@@ -3,7 +3,6 @@ | |||
3 | Useful to avoid circular dependencies. | 3 | Useful to avoid circular dependencies. |
4 | */ | 4 | */ |
5 | 5 | ||
6 | import * as bcrypt from 'bcrypt' | ||
7 | import * as createTorrent from 'create-torrent' | 6 | import * as createTorrent from 'create-torrent' |
8 | import { createHash, HexBase64Latin1Encoding, pseudoRandomBytes } from 'crypto' | 7 | import { createHash, HexBase64Latin1Encoding, pseudoRandomBytes } from 'crypto' |
9 | import { isAbsolute, join } from 'path' | 8 | import { isAbsolute, join } from 'path' |
@@ -258,9 +257,6 @@ function promisify2WithVoid<T, U> (func: (arg1: T, arg2: U, cb: (err: any) => vo | |||
258 | const pseudoRandomBytesPromise = promisify1<number, Buffer>(pseudoRandomBytes) | 257 | const pseudoRandomBytesPromise = promisify1<number, Buffer>(pseudoRandomBytes) |
259 | const createPrivateKey = promisify1<number, { key: string }>(pem.createPrivateKey) | 258 | const createPrivateKey = promisify1<number, { key: string }>(pem.createPrivateKey) |
260 | const getPublicKey = promisify1<string, { publicKey: string }>(pem.getPublicKey) | 259 | const getPublicKey = promisify1<string, { publicKey: string }>(pem.getPublicKey) |
261 | const bcryptComparePromise = promisify2<any, string, boolean>(bcrypt.compare) | ||
262 | const bcryptGenSaltPromise = promisify1<number, string>(bcrypt.genSalt) | ||
263 | const bcryptHashPromise = promisify2<any, string | number, string>(bcrypt.hash) | ||
264 | const createTorrentPromise = promisify2<string, any, any>(createTorrent) | 260 | const createTorrentPromise = promisify2<string, any, any>(createTorrent) |
265 | const execPromise2 = promisify2<string, any, string>(exec) | 261 | const execPromise2 = promisify2<string, any, string>(exec) |
266 | const execPromise = promisify1<string, string>(exec) | 262 | const execPromise = promisify1<string, string>(exec) |
@@ -287,13 +283,11 @@ export { | |||
287 | 283 | ||
288 | promisify0, | 284 | promisify0, |
289 | promisify1, | 285 | promisify1, |
286 | promisify2, | ||
290 | 287 | ||
291 | pseudoRandomBytesPromise, | 288 | pseudoRandomBytesPromise, |
292 | createPrivateKey, | 289 | createPrivateKey, |
293 | getPublicKey, | 290 | getPublicKey, |
294 | bcryptComparePromise, | ||
295 | bcryptGenSaltPromise, | ||
296 | bcryptHashPromise, | ||
297 | createTorrentPromise, | 291 | createTorrentPromise, |
298 | execPromise2, | 292 | execPromise2, |
299 | execPromise | 293 | execPromise |
diff --git a/server/helpers/custom-validators/video-channels.ts b/server/helpers/custom-validators/video-channels.ts index e1a2f9503..f818ce8f1 100644 --- a/server/helpers/custom-validators/video-channels.ts +++ b/server/helpers/custom-validators/video-channels.ts | |||
@@ -51,7 +51,9 @@ export { | |||
51 | 51 | ||
52 | function processVideoChannelExist (videoChannel: VideoChannelModel, res: express.Response) { | 52 | function processVideoChannelExist (videoChannel: VideoChannelModel, res: express.Response) { |
53 | if (!videoChannel) { | 53 | if (!videoChannel) { |
54 | `` | 54 | res.status(404) |
55 | .json({ error: 'Video channel not found' }) | ||
56 | .end() | ||
55 | 57 | ||
56 | return false | 58 | return false |
57 | } | 59 | } |
diff --git a/server/helpers/peertube-crypto.ts b/server/helpers/peertube-crypto.ts index 9148df2eb..1424949d0 100644 --- a/server/helpers/peertube-crypto.ts +++ b/server/helpers/peertube-crypto.ts | |||
@@ -1,12 +1,17 @@ | |||
1 | import { Request } from 'express' | 1 | import { Request } from 'express' |
2 | import { BCRYPT_SALT_SIZE, HTTP_SIGNATURE, PRIVATE_RSA_KEY_SIZE } from '../initializers/constants' | 2 | import { BCRYPT_SALT_SIZE, HTTP_SIGNATURE, PRIVATE_RSA_KEY_SIZE } from '../initializers/constants' |
3 | import { ActorModel } from '../models/activitypub/actor' | 3 | import { ActorModel } from '../models/activitypub/actor' |
4 | import { bcryptComparePromise, bcryptGenSaltPromise, bcryptHashPromise, createPrivateKey, getPublicKey, sha256 } from './core-utils' | 4 | import { createPrivateKey, getPublicKey, promisify1, promisify2, sha256 } from './core-utils' |
5 | import { jsig, jsonld } from './custom-jsonld-signature' | 5 | import { jsig, jsonld } from './custom-jsonld-signature' |
6 | import { logger } from './logger' | 6 | import { logger } from './logger' |
7 | import { cloneDeep } from 'lodash' | 7 | import { cloneDeep } from 'lodash' |
8 | import { createVerify } from 'crypto' | 8 | import { createVerify } from 'crypto' |
9 | import { buildDigest } from '../lib/job-queue/handlers/utils/activitypub-http-utils' | 9 | import { buildDigest } from '../lib/job-queue/handlers/utils/activitypub-http-utils' |
10 | import * as bcrypt from 'bcrypt' | ||
11 | |||
12 | const bcryptComparePromise = promisify2<any, string, boolean>(bcrypt.compare) | ||
13 | const bcryptGenSaltPromise = promisify1<number, string>(bcrypt.genSalt) | ||
14 | const bcryptHashPromise = promisify2<any, string | number, string>(bcrypt.hash) | ||
10 | 15 | ||
11 | const httpSignature = require('http-signature') | 16 | const httpSignature = require('http-signature') |
12 | 17 | ||
@@ -147,3 +152,5 @@ export { | |||
147 | cryptPassword, | 152 | cryptPassword, |
148 | signJsonLDObject | 153 | signJsonLDObject |
149 | } | 154 | } |
155 | |||
156 | // --------------------------------------------------------------------------- | ||