aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tools/peertube-plugins.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-13 11:44:16 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commitd0a0fa429d4651710ed951a3c11af0219e408964 (patch)
treec0638f2604e3442d1f15715b9b0f01ecab17ab20 /server/tools/peertube-plugins.ts
parent41d1d075011174e73dccb74006181a92a618d7b4 (diff)
downloadPeerTube-d0a0fa429d4651710ed951a3c11af0219e408964.tar.gz
PeerTube-d0a0fa429d4651710ed951a3c11af0219e408964.tar.zst
PeerTube-d0a0fa429d4651710ed951a3c11af0219e408964.zip
Adapt CLI to new commands
Diffstat (limited to 'server/tools/peertube-plugins.ts')
-rw-r--r--server/tools/peertube-plugins.ts18
1 files changed, 9 insertions, 9 deletions
diff --git a/server/tools/peertube-plugins.ts b/server/tools/peertube-plugins.ts
index 63541bf2c..22a09b779 100644
--- a/server/tools/peertube-plugins.ts
+++ b/server/tools/peertube-plugins.ts
@@ -4,7 +4,7 @@ import { registerTSPaths } from '../helpers/register-ts-paths'
4registerTSPaths() 4registerTSPaths()
5 5
6import { program, Command, OptionValues } from 'commander' 6import { program, Command, OptionValues } from 'commander'
7import { buildServer, getAdminTokenOrDie, getServerCredentials } from './cli' 7import { assignToken, buildServer, getServerCredentials } from './cli'
8import { PluginType } from '../../shared/models' 8import { PluginType } from '../../shared/models'
9import { isAbsolute } from 'path' 9import { isAbsolute } from 'path'
10import * as CliTable3 from 'cli-table3' 10import * as CliTable3 from 'cli-table3'
@@ -62,8 +62,8 @@ program.parse(process.argv)
62 62
63async function pluginsListCLI (command: Command, options: OptionValues) { 63async function pluginsListCLI (command: Command, options: OptionValues) {
64 const { url, username, password } = await getServerCredentials(command) 64 const { url, username, password } = await getServerCredentials(command)
65 const token = await getAdminTokenOrDie(url, username, password) 65 const server = buildServer(url)
66 const server = buildServer(url, token) 66 await assignToken(server, username, password)
67 67
68 let pluginType: PluginType 68 let pluginType: PluginType
69 if (options.onlyThemes) pluginType = PluginType.THEME 69 if (options.onlyThemes) pluginType = PluginType.THEME
@@ -105,8 +105,8 @@ async function installPluginCLI (command: Command, options: OptionValues) {
105 } 105 }
106 106
107 const { url, username, password } = await getServerCredentials(command) 107 const { url, username, password } = await getServerCredentials(command)
108 const token = await getAdminTokenOrDie(url, username, password) 108 const server = buildServer(url)
109 const server = buildServer(url, token) 109 await assignToken(server, username, password)
110 110
111 try { 111 try {
112 await server.pluginsCommand.install({ npmName: options.npmName, path: options.path }) 112 await server.pluginsCommand.install({ npmName: options.npmName, path: options.path })
@@ -132,8 +132,8 @@ async function updatePluginCLI (command: Command, options: OptionValues) {
132 } 132 }
133 133
134 const { url, username, password } = await getServerCredentials(command) 134 const { url, username, password } = await getServerCredentials(command)
135 const token = await getAdminTokenOrDie(url, username, password) 135 const server = buildServer(url)
136 const server = buildServer(url, token) 136 await assignToken(server, username, password)
137 137
138 try { 138 try {
139 await server.pluginsCommand.update({ npmName: options.npmName, path: options.path }) 139 await server.pluginsCommand.update({ npmName: options.npmName, path: options.path })
@@ -154,8 +154,8 @@ async function uninstallPluginCLI (command: Command, options: OptionValues) {
154 } 154 }
155 155
156 const { url, username, password } = await getServerCredentials(command) 156 const { url, username, password } = await getServerCredentials(command)
157 const token = await getAdminTokenOrDie(url, username, password) 157 const server = buildServer(url)
158 const server = buildServer(url, token) 158 await assignToken(server, username, password)
159 159
160 try { 160 try {
161 await server.pluginsCommand.uninstall({ npmName: options.npmName }) 161 await server.pluginsCommand.uninstall({ npmName: options.npmName })