From 8d2be0ed7bb87283a1ec98609df6b82d83db706a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 11 Jul 2019 17:23:24 +0200 Subject: WIP plugins: move plugin CLI in peertube script Install/uninstall/list plugins remotely --- shared/extra-utils/miscs/miscs.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'shared/extra-utils/miscs') diff --git a/shared/extra-utils/miscs/miscs.ts b/shared/extra-utils/miscs/miscs.ts index fb6430e4f..42250886c 100644 --- a/shared/extra-utils/miscs/miscs.ts +++ b/shared/extra-utils/miscs/miscs.ts @@ -8,7 +8,7 @@ import { pathExists, readFile } from 'fs-extra' import * as ffmpeg from 'fluent-ffmpeg' const expect = chai.expect -let webtorrent = new WebTorrent() +let webtorrent: WebTorrent.Instance function immutableAssign (target: T, source: U) { return Object.assign<{}, T, U>({}, target, source) @@ -27,6 +27,9 @@ function wait (milliseconds: number) { } function webtorrentAdd (torrent: string, refreshWebTorrent = false) { + const WebTorrent = require('webtorrent') + + if (!webtorrent) webtorrent = new WebTorrent() if (refreshWebTorrent === true) webtorrent = new WebTorrent() return new Promise(res => webtorrent.add(torrent, res)) -- cgit v1.2.3