diff options
Diffstat (limited to 'support/doc/tools.md')
-rw-r--r-- | support/doc/tools.md | 161 |
1 files changed, 0 insertions, 161 deletions
diff --git a/support/doc/tools.md b/support/doc/tools.md index 433aaeff7..78ace1344 100644 --- a/support/doc/tools.md +++ b/support/doc/tools.md | |||
@@ -10,7 +10,6 @@ | |||
10 | - [CLI wrapper](#cli-wrapper) | 10 | - [CLI wrapper](#cli-wrapper) |
11 | - [peertube-import-videos.js](#peertube-import-videosjs) | 11 | - [peertube-import-videos.js](#peertube-import-videosjs) |
12 | - [peertube-upload.js](#peertube-uploadjs) | 12 | - [peertube-upload.js](#peertube-uploadjs) |
13 | - [peertube-watch.js](#peertube-watchjs) | ||
14 | - [peertube-plugins.js](#peertube-pluginsjs) | 13 | - [peertube-plugins.js](#peertube-pluginsjs) |
15 | - [peertube-redundancy.js](#peertube-redundancyjs) | 14 | - [peertube-redundancy.js](#peertube-redundancyjs) |
16 | - [Server tools](#server-tools) | 15 | - [Server tools](#server-tools) |
@@ -22,11 +21,6 @@ | |||
22 | - [update-host.js](#update-hostjs) | 21 | - [update-host.js](#update-hostjs) |
23 | - [reset-password.js](#reset-passwordjs) | 22 | - [reset-password.js](#reset-passwordjs) |
24 | - [plugin install/uninstall](#plugin-installuninstall) | 23 | - [plugin install/uninstall](#plugin-installuninstall) |
25 | - [REPL (Read Eval Print Loop)](#repl-read-eval-print-loop) | ||
26 | - [.help](#help) | ||
27 | - [Lodash example](#lodash-example) | ||
28 | - [YoutubeDL example](#youtubedl-example) | ||
29 | - [Models examples](#models-examples) | ||
30 | 24 | ||
31 | <!-- END doctoc generated TOC please keep comment here to allow auto update --> | 25 | <!-- END doctoc generated TOC please keep comment here to allow auto update --> |
32 | 26 | ||
@@ -75,8 +69,6 @@ You can access it as `peertube` via an alias in your `.bashrc` like `alias peert | |||
75 | auth [action] register your accounts on remote instances to use them with other commands | 69 | auth [action] register your accounts on remote instances to use them with other commands |
76 | upload|up upload a video | 70 | upload|up upload a video |
77 | import-videos|import import a video from a streaming platform | 71 | import-videos|import import a video from a streaming platform |
78 | watch|w watch a video in the terminal ✩°。⋆ | ||
79 | repl initiate a REPL to access internals | ||
80 | plugins|p [action] manage instance plugins | 72 | plugins|p [action] manage instance plugins |
81 | redundancy|r [action] manage video redundancies | 73 | redundancy|r [action] manage video redundancies |
82 | help [cmd] display help for [cmd] | 74 | help [cmd] display help for [cmd] |
@@ -100,12 +92,6 @@ You can now use that account to upload videos without feeding the same parameter | |||
100 | $ peertube up <videoFile> | 92 | $ peertube up <videoFile> |
101 | ``` | 93 | ``` |
102 | 94 | ||
103 | And now that your video is online, you can watch it from the confort of your terminal (use `peertube watch --help` to see the supported players): | ||
104 | |||
105 | ```bash | ||
106 | $ peertube watch https://peertube.cpy.re/videos/watch/e8a1af4e-414a-4d58-bfe6-2146eed06d10 | ||
107 | ``` | ||
108 | |||
109 | To list, install, uninstall dynamically plugins/themes of an instance: | 95 | To list, install, uninstall dynamically plugins/themes of an instance: |
110 | 96 | ||
111 | ```bash | 97 | ```bash |
@@ -169,22 +155,6 @@ $ cd ${CLONE} | |||
169 | $ node dist/server/tools/peertube-upload.js --help | 155 | $ node dist/server/tools/peertube-upload.js --help |
170 | ``` | 156 | ``` |
171 | 157 | ||
172 | #### peertube-watch.js | ||
173 | |||
174 | You can use this script to play videos directly from the CLI. | ||
175 | |||
176 | It provides support for different players: | ||
177 | |||
178 | - ascii (default ; plays in ascii art in your terminal!) | ||
179 | - mpv | ||
180 | - mplayer | ||
181 | - vlc | ||
182 | - stdout | ||
183 | - xbmc | ||
184 | - airplay | ||
185 | - chromecast | ||
186 | |||
187 | |||
188 | #### peertube-plugins.js | 158 | #### peertube-plugins.js |
189 | 159 | ||
190 | Install/update/uninstall or list local or NPM PeerTube plugins: | 160 | Install/update/uninstall or list local or NPM PeerTube plugins: |
@@ -413,134 +383,3 @@ $ # Docker installation | |||
413 | $ cd /var/www/peertube-docker | 383 | $ cd /var/www/peertube-docker |
414 | $ docker-compose exec -u peertube peertube npm run plugin:uninstall -- --npm-name peertube-plugin-myplugin | 384 | $ docker-compose exec -u peertube peertube npm run plugin:uninstall -- --npm-name peertube-plugin-myplugin |
415 | ``` | 385 | ``` |
416 | |||
417 | ### REPL (Read Eval Print Loop) | ||
418 | |||
419 | If you want to interact with the application libraries and objects even when PeerTube is not running, there is a REPL for that. | ||
420 | |||
421 | usage: `node ./dist/server/tools/peertube-repl.js` | ||
422 | |||
423 | "The default evaluator will, by default, assign the result of the most recently evaluated expression to the special variable `_` (underscore). Explicitly setting `_` to a value will disable this behavior." | ||
424 | |||
425 | - type `.help` to list commands available in the repl, notice it starts with a dot | ||
426 | - type `.exit` to exit, note that you still have to press CTRL-C to actually exit, or press CTRL-C (3 times) without typing `.exit` to exit | ||
427 | - type `context` to list all available objects and libraries in the context, note: `Promise` is also available but it's not listed in the context, in case you need promises for something | ||
428 | - type `env` to see the loaded environment variables | ||
429 | - type `path` to access path library | ||
430 | - type `lodash` to access lodash library | ||
431 | - type `uuidv1` to access uuid/v1 library | ||
432 | - type `uuidv3` to access uuid/v3 library | ||
433 | - type `uuidv4` to access uuid/v4 library | ||
434 | - type `uuidv5` to access uuid/v5 library | ||
435 | - type `YoutubeDL` to access youtube-dl library | ||
436 | - type `cli` to access the cli helpers object | ||
437 | - type `logger` to access the logger; if you log to it, it will write to stdout and to the peertube.log file | ||
438 | - type `constants` to access the constants loaded by the server | ||
439 | - type `coreUtils` to access the core-utils helpers object | ||
440 | - type `ffmpegUtils` to access the ffmpeg-utils helpers object | ||
441 | - type `peertubeCryptoUtils` to access the peertube-crypto helpers object | ||
442 | - type `signupUtils` to access the signup helpers object | ||
443 | - type `utils` to access the utils helpers object | ||
444 | - type `YoutubeDLUtils` to access the youtube-dl helpers object | ||
445 | - type `sequelizeTypescript` to access sequelizeTypescript | ||
446 | - type `modelsUtils` to access the models/utils | ||
447 | - type `models` to access the shortcut to sequelizeTypescript.models | ||
448 | - type `transaction` to access the shortcut to sequelizeTypescript.transaction | ||
449 | - type `query` to access the shortcut to sequelizeTypescript.query | ||
450 | - type `queryInterface` to access the shortcut to sequelizeTypescript.queryInterface | ||
451 | |||
452 | #### .help | ||
453 | |||
454 | ``` | ||
455 | PeerTube [1.0.0] (b10eb595)> .help | ||
456 | .break Sometimes you get stuck, this gets you out | ||
457 | .clear Break, and also clear the local context | ||
458 | .editor Enter editor mode | ||
459 | .exit Exit the repl | ||
460 | .help Print this help message | ||
461 | .load Load JS from a file into the REPL session | ||
462 | .r Reset REPL | ||
463 | .reset Reset REPL | ||
464 | .save Save all evaluated commands in this REPL session to a file | ||
465 | PeerTube [1.0.0] (b10eb595)> | ||
466 | ``` | ||
467 | |||
468 | #### Lodash example | ||
469 | |||
470 | ``` | ||
471 | PeerTube [1.0.0] (b10eb595)> lodash.keys(context) | ||
472 | [ 'global', | ||
473 | 'console', | ||
474 | 'DTRACE_NET_SERVER_CONNECTION', | ||
475 | 'DTRACE_NET_STREAM_END', | ||
476 | 'DTRACE_HTTP_SERVER_REQUEST', | ||
477 | 'DTRACE_HTTP_SERVER_RESPONSE', | ||
478 | 'DTRACE_HTTP_CLIENT_REQUEST', | ||
479 | 'DTRACE_HTTP_CLIENT_RESPONSE', | ||
480 | 'process', | ||
481 | 'Buffer', | ||
482 | 'clearImmediate', | ||
483 | 'clearInterval', | ||
484 | 'clearTimeout', | ||
485 | 'setImmediate', | ||
486 | 'setInterval', | ||
487 | 'setTimeout', | ||
488 | 'XMLHttpRequest', | ||
489 | 'compact2string', | ||
490 | 'module', | ||
491 | 'require', | ||
492 | 'path', | ||
493 | 'repl', | ||
494 | 'context', | ||
495 | 'env', | ||
496 | 'lodash', | ||
497 | 'uuidv1', | ||
498 | 'uuidv3', | ||
499 | 'uuidv4', | ||
500 | 'uuidv5', | ||
501 | 'cli', | ||
502 | 'logger', | ||
503 | 'constants', | ||
504 | 'Sequelize', | ||
505 | 'sequelizeTypescript', | ||
506 | 'modelsUtils', | ||
507 | 'models', | ||
508 | 'transaction', | ||
509 | 'query', | ||
510 | 'queryInterface', | ||
511 | 'YoutubeDL', | ||
512 | 'coreUtils', | ||
513 | 'ffmpegUtils', | ||
514 | 'peertubeCryptoUtils', | ||
515 | 'signupUtils', | ||
516 | 'utils', | ||
517 | 'YoutubeDLUtils' ] | ||
518 | PeerTube [1.0.0] (b10eb595)> | ||
519 | ``` | ||
520 | |||
521 | #### YoutubeDL example | ||
522 | ``` | ||
523 | YoutubeDL.getInfo('https://www.youtube.com/watch?v=I5ZN289jjDo', function(err, data) {console.log(err, data)}) | ||
524 | ``` | ||
525 | |||
526 | #### Models examples | ||
527 | ``` | ||
528 | PeerTube [1.0.0] (b10eb595)> new models.ActorModel({id: 3}).getVideoChannel().then(function(data){console.log(data.dataValues.name)}) | ||
529 | Promise { | ||
530 | _bitField: 0, | ||
531 | _fulfillmentHandler0: undefined, | ||
532 | _rejectionHandler0: undefined, | ||
533 | _promise0: undefined, | ||
534 | _receiver0: undefined } | ||
535 | PeerTube [1.0.0] (b10eb595)> Main root channel | ||
536 | PeerTube [1.0.0] (b10eb595)> let out; new models.UserModel({id: 1}).getAccount().then(function (data) {out = data.dataValues.id}) | ||
537 | Promise { | ||
538 | _bitField: 0, | ||
539 | _fulfillmentHandler0: undefined, | ||
540 | _rejectionHandler0: undefined, | ||
541 | _promise0: undefined, | ||
542 | _receiver0: undefined } | ||
543 | PeerTube [1.0.0] (b10eb595)> out | ||
544 | 2 | ||
545 | PeerTube [1.0.0] (b10eb595)> | ||
546 | ``` | ||