Useful to avoid circular dependencies.
*/
-import * as createTorrent from 'create-torrent'
import { createHash, HexBase64Latin1Encoding, pseudoRandomBytes } from 'crypto'
import { isAbsolute, join } from 'path'
import * as pem from 'pem'
const pseudoRandomBytesPromise = promisify1<number, Buffer>(pseudoRandomBytes)
const createPrivateKey = promisify1<number, { key: string }>(pem.createPrivateKey)
const getPublicKey = promisify1<string, { publicKey: string }>(pem.getPublicKey)
-const createTorrentPromise = promisify2<string, any, any>(createTorrent)
const execPromise2 = promisify2<string, any, string>(exec)
const execPromise = promisify1<string, string>(exec)
pseudoRandomBytesPromise,
createPrivateKey,
getPublicKey,
- createTorrentPromise,
execPromise2,
execPromise
}
import { createWriteStream, ensureDir, remove } from 'fs-extra'
import { CONFIG } from '../initializers/config'
import { dirname, join } from 'path'
+import * as createTorrent from 'create-torrent'
+import { promisify2 } from './core-utils'
async function downloadWebTorrentVideo (target: { magnetUri: string, torrentName?: string }, timeout: number) {
const id = target.magnetUri || target.torrentName
})
}
+const createTorrentPromise = promisify2<string, any, any>(createTorrent)
+
// ---------------------------------------------------------------------------
export {
+ createTorrentPromise,
downloadWebTorrentVideo
}
import { VideoTorrentObject } from '../../../shared/models/activitypub/objects'
import { Video, VideoDetails, VideoFile } from '../../../shared/models/videos'
import { VideoFilter } from '../../../shared/models/videos/video-query.type'
-import { createTorrentPromise, peertubeTruncate } from '../../helpers/core-utils'
+import { peertubeTruncate } from '../../helpers/core-utils'
import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
import { isArray, isBooleanValid } from '../../helpers/custom-validators/misc'
import {
import { CONFIG } from '../../initializers/config'
import { ThumbnailModel } from './thumbnail'
import { ThumbnailType } from '../../../shared/models/videos/thumbnail.type'
+import { createTorrentPromise } from '../../helpers/webtorrent'
// FIXME: Define indexes here because there is an issue with TS and Sequelize.literal when called directly in the annotation
const indexes: (ModelIndexesOptions & { where?: WhereOptions })[] = [
+import { PluginType } from './plugin.type'
+
export interface PeerTubePlugin {
name: string
- type: number
+ type: PluginType
latestVersion: string
version: string
enabled: boolean