diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-13 11:44:16 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:18 +0200 |
commit | d0a0fa429d4651710ed951a3c11af0219e408964 (patch) | |
tree | c0638f2604e3442d1f15715b9b0f01ecab17ab20 /server/tools/peertube-plugins.ts | |
parent | 41d1d075011174e73dccb74006181a92a618d7b4 (diff) | |
download | PeerTube-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.ts | 18 |
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' | |||
4 | registerTSPaths() | 4 | registerTSPaths() |
5 | 5 | ||
6 | import { program, Command, OptionValues } from 'commander' | 6 | import { program, Command, OptionValues } from 'commander' |
7 | import { buildServer, getAdminTokenOrDie, getServerCredentials } from './cli' | 7 | import { assignToken, buildServer, getServerCredentials } from './cli' |
8 | import { PluginType } from '../../shared/models' | 8 | import { PluginType } from '../../shared/models' |
9 | import { isAbsolute } from 'path' | 9 | import { isAbsolute } from 'path' |
10 | import * as CliTable3 from 'cli-table3' | 10 | import * as CliTable3 from 'cli-table3' |
@@ -62,8 +62,8 @@ program.parse(process.argv) | |||
62 | 62 | ||
63 | async function pluginsListCLI (command: Command, options: OptionValues) { | 63 | async 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 }) |