aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/server/servers.ts
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/extra-utils/server/servers.ts
parentd23dd9fbfc4d26026352c10f81d2795ceaf2908a (diff)
downloadPeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.gz
PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.zst
PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.zip
Shorter server command names
Diffstat (limited to 'shared/extra-utils/server/servers.ts')
-rw-r--r--shared/extra-utils/server/servers.ts230
1 files changed, 115 insertions, 115 deletions
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)