diff options
Diffstat (limited to 'server/tools/peertube-repl.ts')
-rw-r--r-- | server/tools/peertube-repl.ts | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/server/tools/peertube-repl.ts b/server/tools/peertube-repl.ts index ab6e215d9..a5c35e9ea 100644 --- a/server/tools/peertube-repl.ts +++ b/server/tools/peertube-repl.ts | |||
@@ -4,14 +4,10 @@ registerTSPaths() | |||
4 | import * as repl from 'repl' | 4 | import * as repl from 'repl' |
5 | import * as path from 'path' | 5 | import * as path from 'path' |
6 | import * as _ from 'lodash' | 6 | import * as _ from 'lodash' |
7 | import * as uuidv1 from 'uuid/v1' | 7 | import { uuidv1, uuidv3, uuidv4, uuidv5 } from 'uuid' |
8 | import * as uuidv3 from 'uuid/v3' | ||
9 | import * as uuidv4 from 'uuid/v4' | ||
10 | import * as uuidv5 from 'uuid/v5' | ||
11 | import * as Sequelize from 'sequelize' | 8 | import * as Sequelize from 'sequelize' |
12 | import * as YoutubeDL from 'youtube-dl' | 9 | import * as YoutubeDL from 'youtube-dl' |
13 | 10 | import { initDatabaseModels, sequelizeTypescript } from '../initializers/database' | |
14 | import { initDatabaseModels, sequelizeTypescript } from '../initializers' | ||
15 | import * as cli from '../tools/cli' | 11 | import * as cli from '../tools/cli' |
16 | import { logger } from '../helpers/logger' | 12 | import { logger } from '../helpers/logger' |
17 | import * as constants from '../initializers/constants' | 13 | import * as constants from '../initializers/constants' |
@@ -31,22 +27,39 @@ const start = async () => { | |||
31 | const initContext = (replServer) => { | 27 | const initContext = (replServer) => { |
32 | return (context) => { | 28 | return (context) => { |
33 | const properties = { | 29 | const properties = { |
34 | context, repl: replServer, env: process.env, | 30 | context, |
35 | lodash: _, path, | 31 | repl: replServer, |
36 | uuidv1, uuidv3, uuidv4, uuidv5, | 32 | env: process.env, |
37 | cli, logger, constants, | 33 | lodash: _, |
38 | Sequelize, sequelizeTypescript, modelsUtils, | 34 | path, |
39 | models: sequelizeTypescript.models, transaction: sequelizeTypescript.transaction, | 35 | uuidv1, |
40 | query: sequelizeTypescript.query, queryInterface: sequelizeTypescript.getQueryInterface(), | 36 | uuidv3, |
37 | uuidv4, | ||
38 | uuidv5, | ||
39 | cli, | ||
40 | logger, | ||
41 | constants, | ||
42 | Sequelize, | ||
43 | sequelizeTypescript, | ||
44 | modelsUtils, | ||
45 | models: sequelizeTypescript.models, | ||
46 | transaction: sequelizeTypescript.transaction, | ||
47 | query: sequelizeTypescript.query, | ||
48 | queryInterface: sequelizeTypescript.getQueryInterface(), | ||
41 | YoutubeDL, | 49 | YoutubeDL, |
42 | coreUtils, ffmpegUtils, peertubeCryptoUtils, signupUtils, utils, YoutubeDLUtils | 50 | coreUtils, |
51 | ffmpegUtils, | ||
52 | peertubeCryptoUtils, | ||
53 | signupUtils, | ||
54 | utils, | ||
55 | YoutubeDLUtils | ||
43 | } | 56 | } |
44 | 57 | ||
45 | for (let prop in properties) { | 58 | for (const prop in properties) { |
46 | Object.defineProperty(context, prop, { | 59 | Object.defineProperty(context, prop, { |
47 | configurable: false, | 60 | configurable: false, |
48 | enumerable: true, | 61 | enumerable: true, |
49 | value: properties[ prop ] | 62 | value: properties[prop] |
50 | }) | 63 | }) |
51 | } | 64 | } |
52 | } | 65 | } |