ActivityPub-federated video streaming platform using P2P directly in your web browser
Fix redundancy CLI
Chocobozzz40ac4ce3daef
diff --git a/apps/peertube-cli/src/peertube-redundancy.ts b/apps/peertube-cli/src/peertube-redundancy.tsindex 56fc6366b2..5e17d3a8d7 100644--- a/apps/peertube-cli/src/peertube-redundancy.ts+++ b/apps/peertube-cli/src/peertube-redundancy.ts@@ -1,9 +1,9 @@-import bytes from 'bytes'-import CliTable3 from 'cli-table3'-import { URL } from 'url'import { Command } from '@commander-js/extra-typings'import { forceNumber, uniqify } from '@peertube/peertube-core-utils'import { HttpStatusCode, VideoRedundanciesTarget } from '@peertube/peertube-models'+import bytes from 'bytes'+import CliTable3 from 'cli-table3'+import { URL } from 'url'import { assignToken, buildServer, CommonProgramOptions, getServerCredentials } from './shared/index.js'export function defineRedundancyProgram () {@@ -89,24 +89,22 @@ async function listRedundanciesCLI (options: CommonProgramOptions & { target: Viconst { data } = await server.redundancy.listVideos({ start: 0, count: 100, sort: 'name', target })const table = new CliTable3({- head: [ 'video id', 'video name', 'video url', 'files', 'playlists', 'by instances', 'total size' ]+ head: [ 'video id', 'video name', 'video url', 'playlists', 'by instances', 'total size' ]}) as anyfor (const redundancy of data) {- const webVideoFiles = redundancy.redundancies.filesconst streamingPlaylists = redundancy.redundancies.streamingPlaylistslet totalSize = ''if (target === 'remote-videos') {- const tmp = webVideoFiles.concat(streamingPlaylists)- .reduce((a, b) => a + b.size, 0)+ const tmp = streamingPlaylists.reduce((a, b) => a + b.size, 0)// FIXME: don't use external dependency to stringify bytes: we already have the functions in the clienttotalSize = bytes(tmp)}const instances = uniqify(- webVideoFiles.concat(streamingPlaylists)+ streamingPlaylists.map(r => r.fileUrl).map(u => new URL(u).host))@@ -115,7 +113,6 @@ async function listRedundanciesCLI (options: CommonProgramOptions & { target: Viredundancy.id.toString(),redundancy.name,redundancy.url,- webVideoFiles.length,streamingPlaylists.length,instances.join('\n'),totalSize@@ -174,8 +171,7 @@ async function removeRedundancyCLI (options: CommonProgramOptions & { video: numthrow new Error('Video redundancy not found.')}- const ids = videoRedundancy.redundancies.files- .concat(videoRedundancy.redundancies.streamingPlaylists)+ const ids = videoRedundancy.redundancies.streamingPlaylists.map(r => r.id)for (const id of ids) {