mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-06 03:50:26 +02:00
Introduce user command
This commit is contained in:
parent
d0a0fa429d
commit
7926c5f9b3
85 changed files with 1011 additions and 1505 deletions
|
@ -3,8 +3,7 @@ import { Netrc } from 'netrc-parser'
|
|||
import { join } from 'path'
|
||||
import { createLogger, format, transports } from 'winston'
|
||||
import { assignCommands, ServerInfo } from '@shared/extra-utils'
|
||||
import { getMyUserInformation } from '@shared/extra-utils/users/users'
|
||||
import { User, UserRole } from '@shared/models'
|
||||
import { UserRole } from '@shared/models'
|
||||
import { VideoPrivacy } from '../../shared/models/videos'
|
||||
import { getAppNumber, isTestInstance, root } from '../helpers/core-utils'
|
||||
|
||||
|
@ -16,16 +15,15 @@ const config = require('application-config')(configName)
|
|||
const version = require('../../../package.json').version
|
||||
|
||||
async function getAdminTokenOrDie (server: ServerInfo, username: string, password: string) {
|
||||
const accessToken = await server.loginCommand.getAccessToken(username, password)
|
||||
const resMe = await getMyUserInformation(server.url, accessToken)
|
||||
const me: User = resMe.body
|
||||
const token = await server.loginCommand.getAccessToken(username, password)
|
||||
const me = await server.usersCommand.getMyUserInformation({ token })
|
||||
|
||||
if (me.role !== UserRole.ADMINISTRATOR) {
|
||||
console.error('You must be an administrator.')
|
||||
process.exit(-1)
|
||||
}
|
||||
|
||||
return accessToken
|
||||
return token
|
||||
}
|
||||
|
||||
interface Settings {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue