diff options
Diffstat (limited to 'shared')
-rw-r--r-- | shared/extra-utils/server/servers.ts | 89 | ||||
-rw-r--r-- | shared/extra-utils/users/login.ts | 4 |
2 files changed, 49 insertions, 44 deletions
diff --git a/shared/extra-utils/server/servers.ts b/shared/extra-utils/server/servers.ts index 8e80a9842..41b48a8ee 100644 --- a/shared/extra-utils/server/servers.ts +++ b/shared/extra-utils/server/servers.ts | |||
@@ -41,25 +41,25 @@ import { RedundancyCommand } from './redundancy-command' | |||
41 | import { StatsCommand } from './stats-command' | 41 | import { StatsCommand } from './stats-command' |
42 | 42 | ||
43 | interface ServerInfo { | 43 | interface ServerInfo { |
44 | app: ChildProcess | 44 | app?: ChildProcess |
45 | 45 | ||
46 | url: string | 46 | url: string |
47 | host: string | 47 | host?: string |
48 | hostname: string | 48 | hostname?: string |
49 | port: number | 49 | port?: number |
50 | 50 | ||
51 | rtmpPort: number | 51 | rtmpPort?: number |
52 | 52 | ||
53 | parallel: boolean | 53 | parallel?: boolean |
54 | internalServerNumber: number | 54 | internalServerNumber: number |
55 | serverNumber: number | 55 | serverNumber?: number |
56 | 56 | ||
57 | client: { | 57 | client?: { |
58 | id: string | 58 | id?: string |
59 | secret: string | 59 | secret?: string |
60 | } | 60 | } |
61 | 61 | ||
62 | user: { | 62 | user?: { |
63 | username: string | 63 | username: string |
64 | password: string | 64 | password: string |
65 | email?: string | 65 | email?: string |
@@ -328,43 +328,47 @@ async function runServer (server: ServerInfo, configOverrideArg?: any, args = [] | |||
328 | } catch { /* empty */ } | 328 | } catch { /* empty */ } |
329 | }) | 329 | }) |
330 | 330 | ||
331 | server.bulkCommand = new BulkCommand(server) | 331 | assignCommands(server) |
332 | server.cliCommand = new CLICommand(server) | ||
333 | server.customPageCommand = new CustomPagesCommand(server) | ||
334 | server.feedCommand = new FeedCommand(server) | ||
335 | server.logsCommand = new LogsCommand(server) | ||
336 | server.abusesCommand = new AbusesCommand(server) | ||
337 | server.overviewsCommand = new OverviewsCommand(server) | ||
338 | server.searchCommand = new SearchCommand(server) | ||
339 | server.contactFormCommand = new ContactFormCommand(server) | ||
340 | server.debugCommand = new DebugCommand(server) | ||
341 | server.followsCommand = new FollowsCommand(server) | ||
342 | server.jobsCommand = new JobsCommand(server) | ||
343 | server.pluginsCommand = new PluginsCommand(server) | ||
344 | server.redundancyCommand = new RedundancyCommand(server) | ||
345 | server.statsCommand = new StatsCommand(server) | ||
346 | server.configCommand = new ConfigCommand(server) | ||
347 | server.socketIOCommand = new SocketIOCommand(server) | ||
348 | server.accountsCommand = new AccountsCommand(server) | ||
349 | server.blocklistCommand = new BlocklistCommand(server) | ||
350 | server.subscriptionsCommand = new SubscriptionsCommand(server) | ||
351 | server.liveCommand = new LiveCommand(server) | ||
352 | server.servicesCommand = new ServicesCommand(server) | ||
353 | server.blacklistCommand = new BlacklistCommand(server) | ||
354 | server.captionsCommand = new CaptionsCommand(server) | ||
355 | server.changeOwnershipCommand = new ChangeOwnershipCommand(server) | ||
356 | server.playlistsCommand = new PlaylistsCommand(server) | ||
357 | server.historyCommand = new HistoryCommand(server) | ||
358 | server.importsCommand = new ImportsCommand(server) | ||
359 | server.streamingPlaylistsCommand = new StreamingPlaylistsCommand(server) | ||
360 | server.channelsCommand = new ChannelsCommand(server) | ||
361 | server.commentsCommand = new CommentsCommand(server) | ||
362 | 332 | ||
363 | res(server) | 333 | res(server) |
364 | }) | 334 | }) |
365 | }) | 335 | }) |
366 | } | 336 | } |
367 | 337 | ||
338 | function assignCommands (server: ServerInfo) { | ||
339 | server.bulkCommand = new BulkCommand(server) | ||
340 | server.cliCommand = new CLICommand(server) | ||
341 | server.customPageCommand = new CustomPagesCommand(server) | ||
342 | server.feedCommand = new FeedCommand(server) | ||
343 | server.logsCommand = new LogsCommand(server) | ||
344 | server.abusesCommand = new AbusesCommand(server) | ||
345 | server.overviewsCommand = new OverviewsCommand(server) | ||
346 | server.searchCommand = new SearchCommand(server) | ||
347 | server.contactFormCommand = new ContactFormCommand(server) | ||
348 | server.debugCommand = new DebugCommand(server) | ||
349 | server.followsCommand = new FollowsCommand(server) | ||
350 | server.jobsCommand = new JobsCommand(server) | ||
351 | server.pluginsCommand = new PluginsCommand(server) | ||
352 | server.redundancyCommand = new RedundancyCommand(server) | ||
353 | server.statsCommand = new StatsCommand(server) | ||
354 | server.configCommand = new ConfigCommand(server) | ||
355 | server.socketIOCommand = new SocketIOCommand(server) | ||
356 | server.accountsCommand = new AccountsCommand(server) | ||
357 | server.blocklistCommand = new BlocklistCommand(server) | ||
358 | server.subscriptionsCommand = new SubscriptionsCommand(server) | ||
359 | server.liveCommand = new LiveCommand(server) | ||
360 | server.servicesCommand = new ServicesCommand(server) | ||
361 | server.blacklistCommand = new BlacklistCommand(server) | ||
362 | server.captionsCommand = new CaptionsCommand(server) | ||
363 | server.changeOwnershipCommand = new ChangeOwnershipCommand(server) | ||
364 | server.playlistsCommand = new PlaylistsCommand(server) | ||
365 | server.historyCommand = new HistoryCommand(server) | ||
366 | server.importsCommand = new ImportsCommand(server) | ||
367 | server.streamingPlaylistsCommand = new StreamingPlaylistsCommand(server) | ||
368 | server.channelsCommand = new ChannelsCommand(server) | ||
369 | server.commentsCommand = new CommentsCommand(server) | ||
370 | } | ||
371 | |||
368 | async function reRunServer (server: ServerInfo, configOverride?: any) { | 372 | async function reRunServer (server: ServerInfo, configOverride?: any) { |
369 | const newServer = await runServer(server, configOverride) | 373 | const newServer = await runServer(server, configOverride) |
370 | server.app = newServer.app | 374 | server.app = newServer.app |
@@ -475,5 +479,6 @@ export { | |||
475 | flushAndRunServer, | 479 | flushAndRunServer, |
476 | killallServers, | 480 | killallServers, |
477 | reRunServer, | 481 | reRunServer, |
482 | assignCommands, | ||
478 | waitUntilLog | 483 | waitUntilLog |
479 | } | 484 | } |
diff --git a/shared/extra-utils/users/login.ts b/shared/extra-utils/users/login.ts index 39e1a2747..c14367542 100644 --- a/shared/extra-utils/users/login.ts +++ b/shared/extra-utils/users/login.ts | |||
@@ -4,9 +4,9 @@ import { ServerInfo } from '../server/servers' | |||
4 | import { getClient } from '../server/clients' | 4 | import { getClient } from '../server/clients' |
5 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | 5 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' |
6 | 6 | ||
7 | type Client = { id: string, secret: string } | 7 | type Client = { id?: string, secret?: string } |
8 | type User = { username: string, password: string } | 8 | type User = { username: string, password: string } |
9 | type Server = { url: string, client: Client, user: User } | 9 | type Server = { url?: string, client?: Client, user?: User } |
10 | 10 | ||
11 | function login (url: string, client: Client, user: User, expectedStatus = HttpStatusCode.OK_200) { | 11 | function login (url: string, client: Client, user: User, expectedStatus = HttpStatusCode.OK_200) { |
12 | const path = '/api/v1/users/token' | 12 | const path = '/api/v1/users/token' |