diff options
author | Chocobozzz <me@florianbigard.com> | 2021-09-10 15:05:53 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-09-10 15:06:57 +0200 |
commit | 624e42fdf9456816f92000e632d01390f3b5c840 (patch) | |
tree | 83cadd83bbf6cf393bf570d9947ad0469083a42e /server/tools/peertube-repl.ts | |
parent | e367da949bb97c3db8c2f9a28ea09eef93abb2f5 (diff) | |
download | PeerTube-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.ts | 83 |
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 @@ | |||
1 | import { registerTSPaths } from '../helpers/register-ts-paths' | ||
2 | registerTSPaths() | ||
3 | |||
4 | import * as repl from 'repl' | ||
5 | import * as path from 'path' | ||
6 | import * as _ from 'lodash' | ||
7 | import * as Sequelize from 'sequelize' | ||
8 | import * as YoutubeDL from 'youtube-dl' | ||
9 | import { initDatabaseModels, sequelizeTypescript } from '../initializers/database' | ||
10 | import * as cli from '../tools/cli' | ||
11 | import { logger } from '../helpers/logger' | ||
12 | import * as constants from '../initializers/constants' | ||
13 | import * as modelsUtils from '../models/utils' | ||
14 | import * as coreUtils from '../helpers/core-utils' | ||
15 | import * as ffmpegUtils from '../helpers/ffmpeg-utils' | ||
16 | import * as peertubeCryptoUtils from '../helpers/peertube-crypto' | ||
17 | import * as utils from '../helpers/utils' | ||
18 | import * as YoutubeDLUtils from '../helpers/youtube-dl' | ||
19 | |||
20 | const 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 | |||
80 | start() | ||
81 | .catch((err) => { | ||
82 | console.error(err) | ||
83 | }) | ||