aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-16 09:04:35 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commit89d241a79c262b9775c233b73cff080043ebb5e6 (patch)
treecb3b6cb431d25d891ef4e02f66c61d252d17048f /shared
parentd23dd9fbfc4d26026352c10f81d2795ceaf2908a (diff)
downloadPeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.gz
PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.zst
PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.zip
Shorter server command names
Diffstat (limited to 'shared')
-rw-r--r--shared/extra-utils/miscs/checks.ts2
-rw-r--r--shared/extra-utils/miscs/webtorrent.ts2
-rw-r--r--shared/extra-utils/server/follows.ts4
-rw-r--r--shared/extra-utils/server/jobs.ts4
-rw-r--r--shared/extra-utils/server/plugins-command.ts2
-rw-r--r--shared/extra-utils/server/plugins.ts2
-rw-r--r--shared/extra-utils/server/servers-command.ts6
-rw-r--r--shared/extra-utils/server/servers.ts230
-rw-r--r--shared/extra-utils/users/accounts.ts2
-rw-r--r--shared/extra-utils/users/login-command.ts12
-rw-r--r--shared/extra-utils/users/login.ts2
-rw-r--r--shared/extra-utils/users/notifications.ts20
-rw-r--r--shared/extra-utils/users/users-command.ts4
-rw-r--r--shared/extra-utils/videos/channels.ts4
-rw-r--r--shared/extra-utils/videos/live-command.ts8
-rw-r--r--shared/extra-utils/videos/live.ts4
-rw-r--r--shared/extra-utils/videos/playlists-command.ts2
-rw-r--r--shared/extra-utils/videos/streaming-playlists.ts6
-rw-r--r--shared/extra-utils/videos/videos-command.ts2
-rw-r--r--shared/extra-utils/videos/videos.ts10
20 files changed, 164 insertions, 164 deletions
diff --git a/shared/extra-utils/miscs/checks.ts b/shared/extra-utils/miscs/checks.ts
index 86b861cd2..8f7bdb9b5 100644
--- a/shared/extra-utils/miscs/checks.ts
+++ b/shared/extra-utils/miscs/checks.ts
@@ -34,7 +34,7 @@ async function testImage (url: string, imageName: string, imagePath: string, ext
34} 34}
35 35
36async function testFileExistsOrNot (server: ServerInfo, directory: string, filePath: string, exist: boolean) { 36async function testFileExistsOrNot (server: ServerInfo, directory: string, filePath: string, exist: boolean) {
37 const base = server.serversCommand.buildDirectory(directory) 37 const base = server.servers.buildDirectory(directory)
38 38
39 expect(await pathExists(join(base, filePath))).to.equal(exist) 39 expect(await pathExists(join(base, filePath))).to.equal(exist)
40} 40}
diff --git a/shared/extra-utils/miscs/webtorrent.ts b/shared/extra-utils/miscs/webtorrent.ts
index 63e648309..84e390b2a 100644
--- a/shared/extra-utils/miscs/webtorrent.ts
+++ b/shared/extra-utils/miscs/webtorrent.ts
@@ -17,7 +17,7 @@ function webtorrentAdd (torrent: string, refreshWebTorrent = false) {
17 17
18async function parseTorrentVideo (server: ServerInfo, videoUUID: string, resolution: number) { 18async function parseTorrentVideo (server: ServerInfo, videoUUID: string, resolution: number) {
19 const torrentName = videoUUID + '-' + resolution + '.torrent' 19 const torrentName = videoUUID + '-' + resolution + '.torrent'
20 const torrentPath = server.serversCommand.buildDirectory(join('torrents', torrentName)) 20 const torrentPath = server.servers.buildDirectory(join('torrents', torrentName))
21 21
22 const data = await readFile(torrentPath) 22 const data = await readFile(torrentPath)
23 23
diff --git a/shared/extra-utils/server/follows.ts b/shared/extra-utils/server/follows.ts
index c23cebd81..50ae898cc 100644
--- a/shared/extra-utils/server/follows.ts
+++ b/shared/extra-utils/server/follows.ts
@@ -3,8 +3,8 @@ import { ServerInfo } from './servers'
3 3
4async function doubleFollow (server1: ServerInfo, server2: ServerInfo) { 4async function doubleFollow (server1: ServerInfo, server2: ServerInfo) {
5 await Promise.all([ 5 await Promise.all([
6 server1.followsCommand.follow({ targets: [ server2.url ] }), 6 server1.follows.follow({ targets: [ server2.url ] }),
7 server2.followsCommand.follow({ targets: [ server1.url ] }) 7 server2.follows.follow({ targets: [ server1.url ] })
8 ]) 8 ])
9 9
10 // Wait request propagation 10 // Wait request propagation
diff --git a/shared/extra-utils/server/jobs.ts b/shared/extra-utils/server/jobs.ts
index 36ef882b3..754530977 100644
--- a/shared/extra-utils/server/jobs.ts
+++ b/shared/extra-utils/server/jobs.ts
@@ -23,7 +23,7 @@ async function waitJobs (serversArg: ServerInfo[] | ServerInfo) {
23 // Check if each server has pending request 23 // Check if each server has pending request
24 for (const server of servers) { 24 for (const server of servers) {
25 for (const state of states) { 25 for (const state of states) {
26 const p = server.jobsCommand.getJobsList({ 26 const p = server.jobs.getJobsList({
27 state, 27 state,
28 start: 0, 28 start: 0,
29 count: 10, 29 count: 10,
@@ -39,7 +39,7 @@ async function waitJobs (serversArg: ServerInfo[] | ServerInfo) {
39 tasks.push(p) 39 tasks.push(p)
40 } 40 }
41 41
42 const p = server.debugCommand.getDebug() 42 const p = server.debug.getDebug()
43 .then(obj => { 43 .then(obj => {
44 if (obj.activityPubMessagesWaiting !== 0) { 44 if (obj.activityPubMessagesWaiting !== 0) {
45 pendingRequests = true 45 pendingRequests = true
diff --git a/shared/extra-utils/server/plugins-command.ts b/shared/extra-utils/server/plugins-command.ts
index 5bed51d1a..98049ce19 100644
--- a/shared/extra-utils/server/plugins-command.ts
+++ b/shared/extra-utils/server/plugins-command.ts
@@ -251,6 +251,6 @@ export class PluginsCommand extends AbstractCommand {
251 } 251 }
252 252
253 private getPackageJSONPath (npmName: string) { 253 private getPackageJSONPath (npmName: string) {
254 return this.server.serversCommand.buildDirectory(join('plugins', 'node_modules', npmName, 'package.json')) 254 return this.server.servers.buildDirectory(join('plugins', 'node_modules', npmName, 'package.json'))
255 } 255 }
256} 256}
diff --git a/shared/extra-utils/server/plugins.ts b/shared/extra-utils/server/plugins.ts
index 1084ea4f4..d1cc7e383 100644
--- a/shared/extra-utils/server/plugins.ts
+++ b/shared/extra-utils/server/plugins.ts
@@ -4,7 +4,7 @@ import { expect } from 'chai'
4import { ServerInfo } from '../server/servers' 4import { ServerInfo } from '../server/servers'
5 5
6async function testHelloWorldRegisteredSettings (server: ServerInfo) { 6async function testHelloWorldRegisteredSettings (server: ServerInfo) {
7 const body = await server.pluginsCommand.getRegisteredSettings({ npmName: 'peertube-plugin-hello-world' }) 7 const body = await server.plugins.getRegisteredSettings({ npmName: 'peertube-plugin-hello-world' })
8 8
9 const registeredSettings = body.registeredSettings 9 const registeredSettings = body.registeredSettings
10 expect(registeredSettings).to.have.length.at.least(1) 10 expect(registeredSettings).to.have.length.at.least(1)
diff --git a/shared/extra-utils/server/servers-command.ts b/shared/extra-utils/server/servers-command.ts
index 9ef68fede..a7c5a868d 100644
--- a/shared/extra-utils/server/servers-command.ts
+++ b/shared/extra-utils/server/servers-command.ts
@@ -37,7 +37,7 @@ export class ServersCommand extends AbstractCommand {
37 if (isGithubCI()) { 37 if (isGithubCI()) {
38 await ensureDir('artifacts') 38 await ensureDir('artifacts')
39 39
40 const origin = this.server.serversCommand.buildDirectory('logs/peertube.log') 40 const origin = this.server.servers.buildDirectory('logs/peertube.log')
41 const destname = `peertube-${this.server.internalServerNumber}.log` 41 const destname = `peertube-${this.server.internalServerNumber}.log`
42 console.log('Saving logs %s.', destname) 42 console.log('Saving logs %s.', destname)
43 43
@@ -56,7 +56,7 @@ export class ServersCommand extends AbstractCommand {
56 } 56 }
57 57
58 async waitUntilLog (str: string, count = 1, strictCount = true) { 58 async waitUntilLog (str: string, count = 1, strictCount = true) {
59 const logfile = this.server.serversCommand.buildDirectory('logs/peertube.log') 59 const logfile = this.server.servers.buildDirectory('logs/peertube.log')
60 60
61 while (true) { 61 while (true) {
62 const buf = await readFile(logfile) 62 const buf = await readFile(logfile)
@@ -74,7 +74,7 @@ export class ServersCommand extends AbstractCommand {
74 } 74 }
75 75
76 async getServerFileSize (subPath: string) { 76 async getServerFileSize (subPath: string) {
77 const path = this.server.serversCommand.buildDirectory(subPath) 77 const path = this.server.servers.buildDirectory(subPath)
78 78
79 return getFileSize(path) 79 return getFileSize(path)
80 } 80 }
diff --git a/shared/extra-utils/server/servers.ts b/shared/extra-utils/server/servers.ts
index fda5c3d6d..ea3f19a92 100644
--- a/shared/extra-utils/server/servers.ts
+++ b/shared/extra-utils/server/servers.ts
@@ -53,83 +53,81 @@ interface ServerInfo {
53 53
54 parallel?: boolean 54 parallel?: boolean
55 internalServerNumber: number 55 internalServerNumber: number
56
56 serverNumber?: number 57 serverNumber?: number
58 customConfigFile?: string
57 59
58 client?: { 60 store?: {
59 id?: string 61 client?: {
60 secret?: string 62 id?: string
61 } 63 secret?: string
64 }
62 65
63 user?: { 66 user?: {
64 username: string 67 username: string
65 password: string 68 password: string
66 email?: string 69 email?: string
67 } 70 }
68 71
69 customConfigFile?: string 72 channel?: VideoChannel
70 73
71 accessToken?: string 74 video?: {
72 refreshToken?: string 75 id: number
73 videoChannel?: VideoChannel 76 uuid: string
77 shortUUID: string
78 name?: string
79 url?: string
74 80
75 video?: { 81 account?: {
76 id: number 82 name: string
77 uuid: string 83 }
78 shortUUID: string
79 name?: string
80 url?: string
81 84
82 account?: { 85 embedPath?: string
83 name: string
84 } 86 }
85 87
86 embedPath?: string 88 videos?: { id: number, uuid: string }[]
87 } 89 }
88 90
89 remoteVideo?: { 91 accessToken?: string
90 id: number 92 refreshToken?: string
91 uuid: string
92 }
93 93
94 videos?: { id: number, uuid: string }[] 94 bulk?: BulkCommand
95 95 cli?: CLICommand
96 bulkCommand?: BulkCommand 96 customPage?: CustomPagesCommand
97 cliCommand?: CLICommand 97 feed?: FeedCommand
98 customPageCommand?: CustomPagesCommand 98 logs?: LogsCommand
99 feedCommand?: FeedCommand 99 abuses?: AbusesCommand
100 logsCommand?: LogsCommand 100 overviews?: OverviewsCommand
101 abusesCommand?: AbusesCommand 101 search?: SearchCommand
102 overviewsCommand?: OverviewsCommand 102 contactForm?: ContactFormCommand
103 searchCommand?: SearchCommand 103 debug?: DebugCommand
104 contactFormCommand?: ContactFormCommand 104 follows?: FollowsCommand
105 debugCommand?: DebugCommand 105 jobs?: JobsCommand
106 followsCommand?: FollowsCommand 106 plugins?: PluginsCommand
107 jobsCommand?: JobsCommand 107 redundancy?: RedundancyCommand
108 pluginsCommand?: PluginsCommand 108 stats?: StatsCommand
109 redundancyCommand?: RedundancyCommand 109 config?: ConfigCommand
110 statsCommand?: StatsCommand 110 socketIO?: SocketIOCommand
111 configCommand?: ConfigCommand 111 accounts?: AccountsCommand
112 socketIOCommand?: SocketIOCommand 112 blocklist?: BlocklistCommand
113 accountsCommand?: AccountsCommand 113 subscriptions?: SubscriptionsCommand
114 blocklistCommand?: BlocklistCommand 114 live?: LiveCommand
115 subscriptionsCommand?: SubscriptionsCommand 115 services?: ServicesCommand
116 liveCommand?: LiveCommand 116 blacklist?: BlacklistCommand
117 servicesCommand?: ServicesCommand 117 captions?: CaptionsCommand
118 blacklistCommand?: BlacklistCommand 118 changeOwnership?: ChangeOwnershipCommand
119 captionsCommand?: CaptionsCommand 119 playlists?: PlaylistsCommand
120 changeOwnershipCommand?: ChangeOwnershipCommand 120 history?: HistoryCommand
121 playlistsCommand?: PlaylistsCommand 121 imports?: ImportsCommand
122 historyCommand?: HistoryCommand 122 streamingPlaylists?: StreamingPlaylistsCommand
123 importsCommand?: ImportsCommand 123 channels?: ChannelsCommand
124 streamingPlaylistsCommand?: StreamingPlaylistsCommand 124 comments?: CommentsCommand
125 channelsCommand?: ChannelsCommand 125 sql?: SQLCommand
126 commentsCommand?: CommentsCommand 126 notifications?: NotificationsCommand
127 sqlCommand?: SQLCommand 127 servers?: ServersCommand
128 notificationsCommand?: NotificationsCommand 128 login?: LoginCommand
129 serversCommand?: ServersCommand 129 users?: UsersCommand
130 loginCommand?: LoginCommand 130 videos?: VideosCommand
131 usersCommand?: UsersCommand
132 videosCommand?: VideosCommand
133} 131}
134 132
135function flushAndRunMultipleServers (totalServers: number, configOverride?: Object) { 133function flushAndRunMultipleServers (totalServers: number, configOverride?: Object) {
@@ -189,13 +187,15 @@ async function flushAndRunServer (serverNumber: number, configOverride?: Object,
189 url: `http://localhost:${port}`, 187 url: `http://localhost:${port}`,
190 host: `localhost:${port}`, 188 host: `localhost:${port}`,
191 hostname: 'localhost', 189 hostname: 'localhost',
192 client: { 190 store: {
193 id: null, 191 client: {
194 secret: null 192 id: null,
195 }, 193 secret: null
196 user: { 194 },
197 username: null, 195 user: {
198 password: null 196 username: null,
197 password: null
198 }
199 } 199 }
200 } 200 }
201 201
@@ -291,10 +291,10 @@ async function runServer (server: ServerInfo, configOverrideArg?: any, args = []
291 const regexp = regexps[key] 291 const regexp = regexps[key]
292 const matches = data.toString().match(regexp) 292 const matches = data.toString().match(regexp)
293 if (matches !== null) { 293 if (matches !== null) {
294 if (key === 'client_id') server.client.id = matches[1] 294 if (key === 'client_id') server.store.client.id = matches[1]
295 else if (key === 'client_secret') server.client.secret = matches[1] 295 else if (key === 'client_secret') server.store.client.secret = matches[1]
296 else if (key === 'user_username') server.user.username = matches[1] 296 else if (key === 'user_username') server.store.user.username = matches[1]
297 else if (key === 'user_password') server.user.password = matches[1] 297 else if (key === 'user_password') server.store.user.password = matches[1]
298 } 298 }
299 } 299 }
300 300
@@ -327,43 +327,43 @@ async function runServer (server: ServerInfo, configOverrideArg?: any, args = []
327} 327}
328 328
329function assignCommands (server: ServerInfo) { 329function assignCommands (server: ServerInfo) {
330 server.bulkCommand = new BulkCommand(server) 330 server.bulk = new BulkCommand(server)
331 server.cliCommand = new CLICommand(server) 331 server.cli = new CLICommand(server)
332 server.customPageCommand = new CustomPagesCommand(server) 332 server.customPage = new CustomPagesCommand(server)
333 server.feedCommand = new FeedCommand(server) 333 server.feed = new FeedCommand(server)
334 server.logsCommand = new LogsCommand(server) 334 server.logs = new LogsCommand(server)
335 server.abusesCommand = new AbusesCommand(server) 335 server.abuses = new AbusesCommand(server)
336 server.overviewsCommand = new OverviewsCommand(server) 336 server.overviews = new OverviewsCommand(server)
337 server.searchCommand = new SearchCommand(server) 337 server.search = new SearchCommand(server)
338 server.contactFormCommand = new ContactFormCommand(server) 338 server.contactForm = new ContactFormCommand(server)
339 server.debugCommand = new DebugCommand(server) 339 server.debug = new DebugCommand(server)
340 server.followsCommand = new FollowsCommand(server) 340 server.follows = new FollowsCommand(server)
341 server.jobsCommand = new JobsCommand(server) 341 server.jobs = new JobsCommand(server)
342 server.pluginsCommand = new PluginsCommand(server) 342 server.plugins = new PluginsCommand(server)
343 server.redundancyCommand = new RedundancyCommand(server) 343 server.redundancy = new RedundancyCommand(server)
344 server.statsCommand = new StatsCommand(server) 344 server.stats = new StatsCommand(server)
345 server.configCommand = new ConfigCommand(server) 345 server.config = new ConfigCommand(server)
346 server.socketIOCommand = new SocketIOCommand(server) 346 server.socketIO = new SocketIOCommand(server)
347 server.accountsCommand = new AccountsCommand(server) 347 server.accounts = new AccountsCommand(server)
348 server.blocklistCommand = new BlocklistCommand(server) 348 server.blocklist = new BlocklistCommand(server)
349 server.subscriptionsCommand = new SubscriptionsCommand(server) 349 server.subscriptions = new SubscriptionsCommand(server)
350 server.liveCommand = new LiveCommand(server) 350 server.live = new LiveCommand(server)
351 server.servicesCommand = new ServicesCommand(server) 351 server.services = new ServicesCommand(server)
352 server.blacklistCommand = new BlacklistCommand(server) 352 server.blacklist = new BlacklistCommand(server)
353 server.captionsCommand = new CaptionsCommand(server) 353 server.captions = new CaptionsCommand(server)
354 server.changeOwnershipCommand = new ChangeOwnershipCommand(server) 354 server.changeOwnership = new ChangeOwnershipCommand(server)
355 server.playlistsCommand = new PlaylistsCommand(server) 355 server.playlists = new PlaylistsCommand(server)
356 server.historyCommand = new HistoryCommand(server) 356 server.history = new HistoryCommand(server)
357 server.importsCommand = new ImportsCommand(server) 357 server.imports = new ImportsCommand(server)
358 server.streamingPlaylistsCommand = new StreamingPlaylistsCommand(server) 358 server.streamingPlaylists = new StreamingPlaylistsCommand(server)
359 server.channelsCommand = new ChannelsCommand(server) 359 server.channels = new ChannelsCommand(server)
360 server.commentsCommand = new CommentsCommand(server) 360 server.comments = new CommentsCommand(server)
361 server.sqlCommand = new SQLCommand(server) 361 server.sql = new SQLCommand(server)
362 server.notificationsCommand = new NotificationsCommand(server) 362 server.notifications = new NotificationsCommand(server)
363 server.serversCommand = new ServersCommand(server) 363 server.servers = new ServersCommand(server)
364 server.loginCommand = new LoginCommand(server) 364 server.login = new LoginCommand(server)
365 server.usersCommand = new UsersCommand(server) 365 server.users = new UsersCommand(server)
366 server.videosCommand = new VideosCommand(server) 366 server.videos = new VideosCommand(server)
367} 367}
368 368
369async function reRunServer (server: ServerInfo, configOverride?: any) { 369async function reRunServer (server: ServerInfo, configOverride?: any) {
@@ -377,7 +377,7 @@ async function killallServers (servers: ServerInfo[]) {
377 for (const server of servers) { 377 for (const server of servers) {
378 if (!server.app) continue 378 if (!server.app) continue
379 379
380 await server.sqlCommand.cleanup() 380 await server.sql.cleanup()
381 381
382 process.kill(-server.app.pid) 382 process.kill(-server.app.pid)
383 383
@@ -394,7 +394,7 @@ async function cleanupTests (servers: ServerInfo[]) {
394 394
395 let p: Promise<any>[] = [] 395 let p: Promise<any>[] = []
396 for (const server of servers) { 396 for (const server of servers) {
397 p = p.concat(server.serversCommand.cleanupTests()) 397 p = p.concat(server.servers.cleanupTests())
398 } 398 }
399 399
400 return Promise.all(p) 400 return Promise.all(p)
diff --git a/shared/extra-utils/users/accounts.ts b/shared/extra-utils/users/accounts.ts
index ee94351e8..2c9a4b71c 100644
--- a/shared/extra-utils/users/accounts.ts
+++ b/shared/extra-utils/users/accounts.ts
@@ -14,7 +14,7 @@ async function expectAccountFollows (options: {
14}) { 14}) {
15 const { server, handle, followers, following } = options 15 const { server, handle, followers, following } = options
16 16
17 const body = await server.accountsCommand.list() 17 const body = await server.accounts.list()
18 const account = body.data.find(a => a.name + '@' + a.host === handle) 18 const account = body.data.find(a => a.name + '@' + a.host === handle)
19 19
20 const message = `${handle} on ${server.url}` 20 const message = `${handle} on ${server.url}`
diff --git a/shared/extra-utils/users/login-command.ts b/shared/extra-utils/users/login-command.ts
index b4e3bb602..10c3db851 100644
--- a/shared/extra-utils/users/login-command.ts
+++ b/shared/extra-utils/users/login-command.ts
@@ -9,7 +9,7 @@ export class LoginCommand extends AbstractCommand {
9 client?: { id?: string, secret?: string } 9 client?: { id?: string, secret?: string }
10 user?: { username: string, password?: string } 10 user?: { username: string, password?: string }
11 } = {}) { 11 } = {}) {
12 const { client = this.server.client, user = this.server.user } = options 12 const { client = this.server.store.client, user = this.server.store.user } = options
13 const path = '/api/v1/users/token' 13 const path = '/api/v1/users/token'
14 14
15 const body = { 15 const body = {
@@ -38,7 +38,7 @@ export class LoginCommand extends AbstractCommand {
38 async getAccessToken (arg1?: { username: string, password?: string } | string, password?: string) { 38 async getAccessToken (arg1?: { username: string, password?: string } | string, password?: string) {
39 let user: { username: string, password?: string } 39 let user: { username: string, password?: string }
40 40
41 if (!arg1) user = this.server.user 41 if (!arg1) user = this.server.store.user
42 else if (typeof arg1 === 'object') user = arg1 42 else if (typeof arg1 === 'object') user = arg1
43 else user = { username: arg1, password } 43 else user = { username: arg1, password }
44 44
@@ -59,8 +59,8 @@ export class LoginCommand extends AbstractCommand {
59 const path = '/api/v1/users/token' 59 const path = '/api/v1/users/token'
60 60
61 const body = { 61 const body = {
62 client_id: this.server.client.id, 62 client_id: this.server.store.client.id,
63 client_secret: this.server.client.secret, 63 client_secret: this.server.store.client.secret,
64 username: username, 64 username: username,
65 response_type: 'code', 65 response_type: 'code',
66 grant_type: 'password', 66 grant_type: 'password',
@@ -100,8 +100,8 @@ export class LoginCommand extends AbstractCommand {
100 const path = '/api/v1/users/token' 100 const path = '/api/v1/users/token'
101 101
102 const body = { 102 const body = {
103 client_id: this.server.client.id, 103 client_id: this.server.store.client.id,
104 client_secret: this.server.client.secret, 104 client_secret: this.server.store.client.secret,
105 refresh_token: options.refreshToken, 105 refresh_token: options.refreshToken,
106 response_type: 'code', 106 response_type: 'code',
107 grant_type: 'refresh_token' 107 grant_type: 'refresh_token'
diff --git a/shared/extra-utils/users/login.ts b/shared/extra-utils/users/login.ts
index d4ee8e517..d0c26a4f0 100644
--- a/shared/extra-utils/users/login.ts
+++ b/shared/extra-utils/users/login.ts
@@ -4,7 +4,7 @@ function setAccessTokensToServers (servers: ServerInfo[]) {
4 const tasks: Promise<any>[] = [] 4 const tasks: Promise<any>[] = []
5 5
6 for (const server of servers) { 6 for (const server of servers) {
7 const p = server.loginCommand.getAccessToken() 7 const p = server.login.getAccessToken()
8 .then(t => { server.accessToken = t }) 8 .then(t => { server.accessToken = t })
9 tasks.push(p) 9 tasks.push(p)
10 } 10 }
diff --git a/shared/extra-utils/users/notifications.ts b/shared/extra-utils/users/notifications.ts
index 0af7d8a18..9196f0bf5 100644
--- a/shared/extra-utils/users/notifications.ts
+++ b/shared/extra-utils/users/notifications.ts
@@ -49,7 +49,7 @@ async function checkNotification (
49 const check = base.check || { web: true, mail: true } 49 const check = base.check || { web: true, mail: true }
50 50
51 if (check.web) { 51 if (check.web) {
52 const notification = await base.server.notificationsCommand.getLastest({ token: base.token }) 52 const notification = await base.server.notifications.getLastest({ token: base.token })
53 53
54 if (notification || checkType !== 'absence') { 54 if (notification || checkType !== 'absence') {
55 notificationChecker(notification, checkType) 55 notificationChecker(notification, checkType)
@@ -651,31 +651,31 @@ async function prepareNotificationsTest (serversCount = 3, overrideConfigArg: an
651 } 651 }
652 652
653 const user = { username: 'user_1', password: 'super password' } 653 const user = { username: 'user_1', password: 'super password' }
654 await servers[0].usersCommand.create({ ...user, videoQuota: 10 * 1000 * 1000 }) 654 await servers[0].users.create({ ...user, videoQuota: 10 * 1000 * 1000 })
655 const userAccessToken = await servers[0].loginCommand.getAccessToken(user) 655 const userAccessToken = await servers[0].login.getAccessToken(user)
656 656
657 await servers[0].notificationsCommand.updateMySettings({ token: userAccessToken, settings: getAllNotificationsSettings() }) 657 await servers[0].notifications.updateMySettings({ token: userAccessToken, settings: getAllNotificationsSettings() })
658 await servers[0].notificationsCommand.updateMySettings({ settings: getAllNotificationsSettings() }) 658 await servers[0].notifications.updateMySettings({ settings: getAllNotificationsSettings() })
659 659
660 if (serversCount > 1) { 660 if (serversCount > 1) {
661 await servers[1].notificationsCommand.updateMySettings({ settings: getAllNotificationsSettings() }) 661 await servers[1].notifications.updateMySettings({ settings: getAllNotificationsSettings() })
662 } 662 }
663 663
664 { 664 {
665 const socket = servers[0].socketIOCommand.getUserNotificationSocket({ token: userAccessToken }) 665 const socket = servers[0].socketIO.getUserNotificationSocket({ token: userAccessToken })
666 socket.on('new-notification', n => userNotifications.push(n)) 666 socket.on('new-notification', n => userNotifications.push(n))
667 } 667 }
668 { 668 {
669 const socket = servers[0].socketIOCommand.getUserNotificationSocket() 669 const socket = servers[0].socketIO.getUserNotificationSocket()
670 socket.on('new-notification', n => adminNotifications.push(n)) 670 socket.on('new-notification', n => adminNotifications.push(n))
671 } 671 }
672 672
673 if (serversCount > 1) { 673 if (serversCount > 1) {
674 const socket = servers[1].socketIOCommand.getUserNotificationSocket() 674 const socket = servers[1].socketIO.getUserNotificationSocket()
675 socket.on('new-notification', n => adminNotificationsServer2.push(n)) 675 socket.on('new-notification', n => adminNotificationsServer2.push(n))
676 } 676 }
677 677
678 const { videoChannels } = await servers[0].usersCommand.getMyInfo() 678 const { videoChannels } = await servers[0].users.getMyInfo()
679 const channelId = videoChannels[0].id 679 const channelId = videoChannels[0].id
680 680
681 return { 681 return {
diff --git a/shared/extra-utils/users/users-command.ts b/shared/extra-utils/users/users-command.ts
index 202528b8d..59dc6d018 100644
--- a/shared/extra-utils/users/users-command.ts
+++ b/shared/extra-utils/users/users-command.ts
@@ -194,7 +194,7 @@ export class UsersCommand extends AbstractCommand {
194 const password = 'password' 194 const password = 'password'
195 const user = await this.create({ username, password }) 195 const user = await this.create({ username, password })
196 196
197 const token = await this.server.loginCommand.getAccessToken({ username, password }) 197 const token = await this.server.login.getAccessToken({ username, password })
198 198
199 const me = await this.getMyInfo({ token }) 199 const me = await this.getMyInfo({ token })
200 200
@@ -209,7 +209,7 @@ export class UsersCommand extends AbstractCommand {
209 const password = 'password' 209 const password = 'password'
210 await this.create({ username, password }) 210 await this.create({ username, password })
211 211
212 return this.server.loginCommand.getAccessToken({ username, password }) 212 return this.server.login.getAccessToken({ username, password })
213 } 213 }
214 214
215 register (options: OverrideCommandOptions & { 215 register (options: OverrideCommandOptions & {
diff --git a/shared/extra-utils/videos/channels.ts b/shared/extra-utils/videos/channels.ts
index 9e7ec565d..81e818094 100644
--- a/shared/extra-utils/videos/channels.ts
+++ b/shared/extra-utils/videos/channels.ts
@@ -4,8 +4,8 @@ function setDefaultVideoChannel (servers: ServerInfo[]) {
4 const tasks: Promise<any>[] = [] 4 const tasks: Promise<any>[] = []
5 5
6 for (const server of servers) { 6 for (const server of servers) {
7 const p = server.usersCommand.getMyInfo() 7 const p = server.users.getMyInfo()
8 .then(user => { server.videoChannel = user.videoChannels[0] }) 8 .then(user => { server.store.channel = user.videoChannels[0] })
9 9
10 tasks.push(p) 10 tasks.push(p)
11 } 11 }
diff --git a/shared/extra-utils/videos/live-command.ts b/shared/extra-utils/videos/live-command.ts
index 5adf601cc..fd66c9924 100644
--- a/shared/extra-utils/videos/live-command.ts
+++ b/shared/extra-utils/videos/live-command.ts
@@ -114,7 +114,7 @@ export class LiveCommand extends AbstractCommand {
114 const { resolution, segment, videoUUID } = options 114 const { resolution, segment, videoUUID } = options
115 const segmentName = `${resolution}-00000${segment}.ts` 115 const segmentName = `${resolution}-00000${segment}.ts`
116 116
117 return this.server.serversCommand.waitUntilLog(`${videoUUID}/${segmentName}`, 2, false) 117 return this.server.servers.waitUntilLog(`${videoUUID}/${segmentName}`, 2, false)
118 } 118 }
119 119
120 async waitUntilSaved (options: OverrideCommandOptions & { 120 async waitUntilSaved (options: OverrideCommandOptions & {
@@ -123,7 +123,7 @@ export class LiveCommand extends AbstractCommand {
123 let video: VideoDetails 123 let video: VideoDetails
124 124
125 do { 125 do {
126 video = await this.server.videosCommand.getWithToken({ token: options.token, id: options.videoId }) 126 video = await this.server.videos.getWithToken({ token: options.token, id: options.videoId })
127 127
128 await wait(500) 128 await wait(500)
129 } while (video.isLive === true && video.state.id !== VideoState.PUBLISHED) 129 } while (video.isLive === true && video.state.id !== VideoState.PUBLISHED)
@@ -132,7 +132,7 @@ export class LiveCommand extends AbstractCommand {
132 async countPlaylists (options: OverrideCommandOptions & { 132 async countPlaylists (options: OverrideCommandOptions & {
133 videoUUID: string 133 videoUUID: string
134 }) { 134 }) {
135 const basePath = this.server.serversCommand.buildDirectory('streaming-playlists') 135 const basePath = this.server.servers.buildDirectory('streaming-playlists')
136 const hlsPath = join(basePath, 'hls', options.videoUUID) 136 const hlsPath = join(basePath, 'hls', options.videoUUID)
137 137
138 const files = await readdir(hlsPath) 138 const files = await readdir(hlsPath)
@@ -147,7 +147,7 @@ export class LiveCommand extends AbstractCommand {
147 let video: VideoDetails 147 let video: VideoDetails
148 148
149 do { 149 do {
150 video = await this.server.videosCommand.getWithToken({ token: options.token, id: options.videoId }) 150 video = await this.server.videos.getWithToken({ token: options.token, id: options.videoId })
151 151
152 await wait(500) 152 await wait(500)
153 } while (video.state.id !== options.state) 153 } while (video.state.id !== options.state)
diff --git a/shared/extra-utils/videos/live.ts b/shared/extra-utils/videos/live.ts
index 0efcc2883..353595811 100644
--- a/shared/extra-utils/videos/live.ts
+++ b/shared/extra-utils/videos/live.ts
@@ -72,12 +72,12 @@ async function stopFfmpeg (command: ffmpeg.FfmpegCommand) {
72 72
73async function waitUntilLivePublishedOnAllServers (servers: ServerInfo[], videoId: string) { 73async function waitUntilLivePublishedOnAllServers (servers: ServerInfo[], videoId: string) {
74 for (const server of servers) { 74 for (const server of servers) {
75 await server.liveCommand.waitUntilPublished({ videoId }) 75 await server.live.waitUntilPublished({ videoId })
76 } 76 }
77} 77}
78 78
79async function checkLiveCleanup (server: ServerInfo, videoUUID: string, resolutions: number[] = []) { 79async function checkLiveCleanup (server: ServerInfo, videoUUID: string, resolutions: number[] = []) {
80 const basePath = server.serversCommand.buildDirectory('streaming-playlists') 80 const basePath = server.servers.buildDirectory('streaming-playlists')
81 const hlsPath = join(basePath, 'hls', videoUUID) 81 const hlsPath = join(basePath, 'hls', videoUUID)
82 82
83 if (resolutions.length === 0) { 83 if (resolutions.length === 0) {
diff --git a/shared/extra-utils/videos/playlists-command.ts b/shared/extra-utils/videos/playlists-command.ts
index 75c8f2433..cbfc7e10f 100644
--- a/shared/extra-utils/videos/playlists-command.ts
+++ b/shared/extra-utils/videos/playlists-command.ts
@@ -184,7 +184,7 @@ export class PlaylistsCommand extends AbstractCommand {
184 const attributes = { 184 const attributes = {
185 ...options.attributes, 185 ...options.attributes,
186 186
187 videoId: await this.server.videosCommand.getId({ ...options, uuid: options.attributes.videoId }) 187 videoId: await this.server.videos.getId({ ...options, uuid: options.attributes.videoId })
188 } 188 }
189 189
190 const path = '/api/v1/video-playlists/' + options.playlistId + '/videos' 190 const path = '/api/v1/video-playlists/' + options.playlistId + '/videos'
diff --git a/shared/extra-utils/videos/streaming-playlists.ts b/shared/extra-utils/videos/streaming-playlists.ts
index 0324c739a..e8fd2f232 100644
--- a/shared/extra-utils/videos/streaming-playlists.ts
+++ b/shared/extra-utils/videos/streaming-playlists.ts
@@ -13,7 +13,7 @@ async function checkSegmentHash (options: {
13 hlsPlaylist: VideoStreamingPlaylist 13 hlsPlaylist: VideoStreamingPlaylist
14}) { 14}) {
15 const { server, baseUrlPlaylist, baseUrlSegment, videoUUID, resolution, hlsPlaylist } = options 15 const { server, baseUrlPlaylist, baseUrlSegment, videoUUID, resolution, hlsPlaylist } = options
16 const command = server.streamingPlaylistsCommand 16 const command = server.streamingPlaylists
17 17
18 const playlist = await command.get({ url: `${baseUrlPlaylist}/${videoUUID}/${resolution}.m3u8` }) 18 const playlist = await command.get({ url: `${baseUrlPlaylist}/${videoUUID}/${resolution}.m3u8` })
19 19
@@ -43,7 +43,7 @@ async function checkLiveSegmentHash (options: {
43 hlsPlaylist: VideoStreamingPlaylist 43 hlsPlaylist: VideoStreamingPlaylist
44}) { 44}) {
45 const { server, baseUrlSegment, videoUUID, segmentName, hlsPlaylist } = options 45 const { server, baseUrlSegment, videoUUID, segmentName, hlsPlaylist } = options
46 const command = server.streamingPlaylistsCommand 46 const command = server.streamingPlaylists
47 47
48 const segmentBody = await command.getSegment({ url: `${baseUrlSegment}/${videoUUID}/${segmentName}` }) 48 const segmentBody = await command.getSegment({ url: `${baseUrlSegment}/${videoUUID}/${segmentName}` })
49 const shaBody = await command.getSegmentSha256({ url: hlsPlaylist.segmentsSha256Url }) 49 const shaBody = await command.getSegmentSha256({ url: hlsPlaylist.segmentsSha256Url })
@@ -58,7 +58,7 @@ async function checkResolutionsInMasterPlaylist (options: {
58}) { 58}) {
59 const { server, playlistUrl, resolutions } = options 59 const { server, playlistUrl, resolutions } = options
60 60
61 const masterPlaylist = await server.streamingPlaylistsCommand.get({ url: playlistUrl }) 61 const masterPlaylist = await server.streamingPlaylists.get({ url: playlistUrl })
62 62
63 for (const resolution of resolutions) { 63 for (const resolution of resolutions) {
64 const reg = new RegExp( 64 const reg = new RegExp(
diff --git a/shared/extra-utils/videos/videos-command.ts b/shared/extra-utils/videos/videos-command.ts
index 574705474..5556cddf6 100644
--- a/shared/extra-utils/videos/videos-command.ts
+++ b/shared/extra-utils/videos/videos-command.ts
@@ -336,7 +336,7 @@ export class VideosCommand extends AbstractCommand {
336 let defaultChannelId = 1 336 let defaultChannelId = 1
337 337
338 try { 338 try {
339 const { videoChannels } = await this.server.usersCommand.getMyInfo({ token: options.token }) 339 const { videoChannels } = await this.server.users.getMyInfo({ token: options.token })
340 defaultChannelId = videoChannels[0].id 340 defaultChannelId = videoChannels[0].id
341 } catch (e) { /* empty */ } 341 } catch (e) { /* empty */ }
342 342
diff --git a/shared/extra-utils/videos/videos.ts b/shared/extra-utils/videos/videos.ts
index 19f0df8b8..86f49384d 100644
--- a/shared/extra-utils/videos/videos.ts
+++ b/shared/extra-utils/videos/videos.ts
@@ -27,7 +27,7 @@ async function checkVideoFilesWereRemoved (
27 ] 27 ]
28) { 28) {
29 for (const directory of directories) { 29 for (const directory of directories) {
30 const directoryPath = server.serversCommand.buildDirectory(directory) 30 const directoryPath = server.servers.buildDirectory(directory)
31 31
32 const directoryExists = await pathExists(directoryPath) 32 const directoryExists = await pathExists(directoryPath)
33 if (directoryExists === false) continue 33 if (directoryExists === false) continue
@@ -47,8 +47,8 @@ function checkUploadVideoParam (
47 mode: 'legacy' | 'resumable' = 'legacy' 47 mode: 'legacy' | 'resumable' = 'legacy'
48) { 48) {
49 return mode === 'legacy' 49 return mode === 'legacy'
50 ? server.videosCommand.buildLegacyUpload({ token, attributes, expectedStatus }) 50 ? server.videos.buildLegacyUpload({ token, attributes, expectedStatus })
51 : server.videosCommand.buildResumeUpload({ token, attributes, expectedStatus }) 51 : server.videos.buildResumeUpload({ token, attributes, expectedStatus })
52} 52}
53 53
54async function completeVideoCheck ( 54async function completeVideoCheck (
@@ -131,7 +131,7 @@ async function completeVideoCheck (
131 expect(video.originallyPublishedAt).to.be.null 131 expect(video.originallyPublishedAt).to.be.null
132 } 132 }
133 133
134 const videoDetails = await server.videosCommand.get({ id: video.uuid }) 134 const videoDetails = await server.videos.get({ id: video.uuid })
135 135
136 expect(videoDetails.files).to.have.lengthOf(attributes.files.length) 136 expect(videoDetails.files).to.have.lengthOf(attributes.files.length)
137 expect(videoDetails.tags).to.deep.equal(attributes.tags) 137 expect(videoDetails.tags).to.deep.equal(attributes.tags)
@@ -202,7 +202,7 @@ async function uploadRandomVideoOnServers (
202 additionalParams?: VideoEdit & { prefixName?: string } 202 additionalParams?: VideoEdit & { prefixName?: string }
203) { 203) {
204 const server = servers.find(s => s.serverNumber === serverNumber) 204 const server = servers.find(s => s.serverNumber === serverNumber)
205 const res = await server.videosCommand.randomUpload({ wait: false, ...additionalParams }) 205 const res = await server.videos.randomUpload({ wait: false, ...additionalParams })
206 206
207 await waitJobs(servers) 207 await waitJobs(servers)
208 208