aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tools/peertube-repl.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-09-10 15:05:53 +0200
committerChocobozzz <me@florianbigard.com>2021-09-10 15:06:57 +0200
commit624e42fdf9456816f92000e632d01390f3b5c840 (patch)
tree83cadd83bbf6cf393bf570d9947ad0469083a42e /server/tools/peertube-repl.ts
parente367da949bb97c3db8c2f9a28ea09eef93abb2f5 (diff)
downloadPeerTube-624e42fdf9456816f92000e632d01390f3b5c840.tar.gz
PeerTube-624e42fdf9456816f92000e632d01390f3b5c840.tar.zst
PeerTube-624e42fdf9456816f92000e632d01390f3b5c840.zip
Remove peertube watch and peertube repl
I don't have time to maintain these scripts that cause some install issues/maintenance difficulties
Diffstat (limited to 'server/tools/peertube-repl.ts')
-rw-r--r--server/tools/peertube-repl.ts83
1 files changed, 0 insertions, 83 deletions
diff --git a/server/tools/peertube-repl.ts b/server/tools/peertube-repl.ts
deleted file mode 100644
index eb0a776b8..000000000
--- a/server/tools/peertube-repl.ts
+++ /dev/null
@@ -1,83 +0,0 @@
1import { registerTSPaths } from '../helpers/register-ts-paths'
2registerTSPaths()
3
4import * as repl from 'repl'
5import * as path from 'path'
6import * as _ from 'lodash'
7import * as Sequelize from 'sequelize'
8import * as YoutubeDL from 'youtube-dl'
9import { initDatabaseModels, sequelizeTypescript } from '../initializers/database'
10import * as cli from '../tools/cli'
11import { logger } from '../helpers/logger'
12import * as constants from '../initializers/constants'
13import * as modelsUtils from '../models/utils'
14import * as coreUtils from '../helpers/core-utils'
15import * as ffmpegUtils from '../helpers/ffmpeg-utils'
16import * as peertubeCryptoUtils from '../helpers/peertube-crypto'
17import * as utils from '../helpers/utils'
18import * as YoutubeDLUtils from '../helpers/youtube-dl'
19
20const start = async () => {
21 await initDatabaseModels(true)
22
23 const versionCommitHash = await utils.getServerCommit()
24
25 const initContext = (replServer) => {
26 return (context) => {
27 const properties = {
28 context,
29 repl: replServer,
30 env: process.env,
31 lodash: _,
32 path,
33 cli,
34 logger,
35 constants,
36 Sequelize,
37 sequelizeTypescript,
38 modelsUtils,
39 models: sequelizeTypescript.models,
40 transaction: sequelizeTypescript.transaction,
41 query: sequelizeTypescript.query,
42 queryInterface: sequelizeTypescript.getQueryInterface(),
43 YoutubeDL,
44 coreUtils,
45 ffmpegUtils,
46 peertubeCryptoUtils,
47 utils,
48 YoutubeDLUtils
49 }
50
51 for (const prop in properties) {
52 Object.defineProperty(context, prop, {
53 configurable: false,
54 enumerable: true,
55 value: properties[prop]
56 })
57 }
58 }
59 }
60
61 const replServer = repl.start({
62 prompt: `PeerTube [${cli.version}] (${versionCommitHash})> `
63 })
64
65 initContext(replServer)(replServer.context)
66 replServer.on('reset', initContext(replServer))
67 replServer.on('exit', () => process.exit())
68
69 const resetCommand = {
70 help: 'Reset REPL',
71 action () {
72 this.write('.clear\n')
73 this.displayPrompt()
74 }
75 }
76 replServer.defineCommand('reset', resetCommand)
77 replServer.defineCommand('r', resetCommand)
78}
79
80start()
81 .catch((err) => {
82 console.error(err)
83 })