aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers')
-rw-r--r--server/helpers/core-utils.ts8
-rw-r--r--server/helpers/custom-validators/video-channels.ts4
-rw-r--r--server/helpers/peertube-crypto.ts9
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
6import * as bcrypt from 'bcrypt'
7import * as createTorrent from 'create-torrent' 6import * as createTorrent from 'create-torrent'
8import { createHash, HexBase64Latin1Encoding, pseudoRandomBytes } from 'crypto' 7import { createHash, HexBase64Latin1Encoding, pseudoRandomBytes } from 'crypto'
9import { isAbsolute, join } from 'path' 8import { isAbsolute, join } from 'path'
@@ -258,9 +257,6 @@ function promisify2WithVoid<T, U> (func: (arg1: T, arg2: U, cb: (err: any) => vo
258const pseudoRandomBytesPromise = promisify1<number, Buffer>(pseudoRandomBytes) 257const pseudoRandomBytesPromise = promisify1<number, Buffer>(pseudoRandomBytes)
259const createPrivateKey = promisify1<number, { key: string }>(pem.createPrivateKey) 258const createPrivateKey = promisify1<number, { key: string }>(pem.createPrivateKey)
260const getPublicKey = promisify1<string, { publicKey: string }>(pem.getPublicKey) 259const getPublicKey = promisify1<string, { publicKey: string }>(pem.getPublicKey)
261const bcryptComparePromise = promisify2<any, string, boolean>(bcrypt.compare)
262const bcryptGenSaltPromise = promisify1<number, string>(bcrypt.genSalt)
263const bcryptHashPromise = promisify2<any, string | number, string>(bcrypt.hash)
264const createTorrentPromise = promisify2<string, any, any>(createTorrent) 260const createTorrentPromise = promisify2<string, any, any>(createTorrent)
265const execPromise2 = promisify2<string, any, string>(exec) 261const execPromise2 = promisify2<string, any, string>(exec)
266const execPromise = promisify1<string, string>(exec) 262const 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
52function processVideoChannelExist (videoChannel: VideoChannelModel, res: express.Response) { 52function 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 @@
1import { Request } from 'express' 1import { Request } from 'express'
2import { BCRYPT_SALT_SIZE, HTTP_SIGNATURE, PRIVATE_RSA_KEY_SIZE } from '../initializers/constants' 2import { BCRYPT_SALT_SIZE, HTTP_SIGNATURE, PRIVATE_RSA_KEY_SIZE } from '../initializers/constants'
3import { ActorModel } from '../models/activitypub/actor' 3import { ActorModel } from '../models/activitypub/actor'
4import { bcryptComparePromise, bcryptGenSaltPromise, bcryptHashPromise, createPrivateKey, getPublicKey, sha256 } from './core-utils' 4import { createPrivateKey, getPublicKey, promisify1, promisify2, sha256 } from './core-utils'
5import { jsig, jsonld } from './custom-jsonld-signature' 5import { jsig, jsonld } from './custom-jsonld-signature'
6import { logger } from './logger' 6import { logger } from './logger'
7import { cloneDeep } from 'lodash' 7import { cloneDeep } from 'lodash'
8import { createVerify } from 'crypto' 8import { createVerify } from 'crypto'
9import { buildDigest } from '../lib/job-queue/handlers/utils/activitypub-http-utils' 9import { buildDigest } from '../lib/job-queue/handlers/utils/activitypub-http-utils'
10import * as bcrypt from 'bcrypt'
11
12const bcryptComparePromise = promisify2<any, string, boolean>(bcrypt.compare)
13const bcryptGenSaltPromise = promisify1<number, string>(bcrypt.genSalt)
14const bcryptHashPromise = promisify2<any, string | number, string>(bcrypt.hash)
10 15
11const httpSignature = require('http-signature') 16const httpSignature = require('http-signature')
12 17
@@ -147,3 +152,5 @@ export {
147 cryptPassword, 152 cryptPassword,
148 signJsonLDObject 153 signJsonLDObject
149} 154}
155
156// ---------------------------------------------------------------------------